This version passes our one trivial test...
authorEric S. Raymond <esr@thyrsus.com>
Sun, 26 Aug 2012 03:29:47 +0000 (23:29 -0400)
committerEric S. Raymond <esr@thyrsus.com>
Sun, 26 Aug 2012 03:29:47 +0000 (23:29 -0400)
echo '{"channel":"irc://freenode.net/cia:223","message":"This is a test of the irker"}' | irker.py

and is ready for the attempt to switch to production.

irker.py

index a5a0625294829649ed2af1151ea116d9d9b7c565..7c04a68d522caa3bc7671fa101e92f7f16aaf19e 100755 (executable)
--- a/irker.py
+++ b/irker.py
@@ -23,15 +23,15 @@ class SessionException(exceptions.Exception):
 class Session():
     "IRC session and message queue processing."
     count = 1
-    def __init__(self, ircserver, url):
-        self.ircserver = ircserver
+    def __init__(self, irc, url):
+        self.irc = irc
         self.url = url
         # The consumer thread
         self.queue = Queue.Queue()
         self.thread = threading.Thread(target=self.dequeue)
         self.thread.daemon = True
         self.thread.start()
-        # Client setup
+        # Server connection setup
         parsed = urlparse.urlparse(url)
         host, sep, port = parsed.netloc.partition(':')
         if not port:
@@ -39,8 +39,8 @@ class Session():
         self.servername = host
         self.channel = parsed.path.lstrip('/')
         self.port = int(port)
-        #self.ircserver.connect(self.servername, self.port, self.name())
-        # Also must join the channel.
+        #self.server = self.irc.server()
+        #self.server.connect(self.servername, self.port, self.name())
         Session.count += 1
     def enqueue(self, message):
         "Enque a message for transmission."
@@ -59,8 +59,9 @@ class Session():
         self.queue.join()
     def ship(self, channel, message):
         "Ship a message to the channel."
-        # self.ircserver.privmsg(self.name(), message)
         print "%s: %s" % (channel, message)
+        # self.server.connection.join(chaannel)
+        # self.server.privmsg(channel, message)
 
 class Irker:
     "Persistent IRC multiplexer."