Hand-merge of a compatibility fix by AI0867: irclib5 compatibility.
authorEric S. Raymond <esr@thyrsus.com>
Mon, 26 Nov 2012 05:52:56 +0000 (00:52 -0500)
committerEric S. Raymond <esr@thyrsus.com>
Mon, 26 Nov 2012 05:52:56 +0000 (00:52 -0500)
irkerd

diff --git a/irkerd b/irkerd
index bcff3616ddee7c7eaefb829d8b5b947e0608966d..ef87434c022c8aadb0d994d3e7080e687e51dda8 100755 (executable)
--- a/irkerd
+++ b/irkerd
@@ -398,7 +398,11 @@ class Irker:
         "Determine if and how we can set deaf mode."
         if connection.context:
             cxt = connection.context
-            for lump in event.arguments():
+            arguments = event.arguments
+            # irclib 5.0 compatibility, because the maintainer is a fool
+            if callable(arguments):
+                arguments = arguments()
+            for lump in arguments:
                 if lump.startswith("DEAF="):
                     connection.mode(cxt.nickname(), "+"+lump[5:])
                 elif lump.startswith("MAXCHANNELS="):
@@ -427,9 +431,14 @@ class Irker:
             connection.context.handle_disconnect()
     def _handle_kick(self, connection, event):
         "Server hung up the connection."
-        self.debug(1, "irker has been kicked from %s on %s" % (event.target(), connection.server))
+        target = event.target
+        # irclib 5.0 compatibility, because the maintainer continues to be a
+        # fool.
+       if callable(target):
+            target = target()
+        self.debug(1, "irker has been kicked from %s on %s" % (target, connection.server))
         if connection.context:
-            connection.context.handle_kick(event.target())
+            connection.context.handle_kick(target)
     def handle(self, line):
         "Perform a JSON relay request."
         try: