From 907841c3f57107b92a9ef54ebca625fb1895c89f Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Sat, 25 Aug 2012 23:29:47 -0400 Subject: [PATCH] This version passes our one trivial test... 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 | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/irker.py b/irker.py index a5a0625..7c04a68 100755 --- 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." -- 2.26.2