From 30a395bc05c8163ffe0e00f8336803b7b4360e56 Mon Sep 17 00:00:00 2001 From: "Brian S. Stephan" Date: Fri, 4 Jan 2013 10:14:37 -0600 Subject: [PATCH] Module: new_sendmsg, embrace one-connection idiom since we've been saying that the rule is one bot, one connection, we don't need to pass said connections around as much. this new_sendmsg(), which should eventually become sendmsg(), uses that, and leans on irc.server instead --- Module.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Module.py b/Module.py index 0579d9d..cf9ec61 100644 --- a/Module.py +++ b/Module.py @@ -140,6 +140,23 @@ class Module(object): for line in msgs: connection.privmsg(target, line) + def new_sendmsg(self,target, msg): + """Send a privmsg over IRC to target. + + This should replace Module.sendmsg() once all code has been converted. + + Args: + target destination on the network + msg the message to send + + """ + + if msg is not None: + if target is not None: + msgs = msg.split('\n') + for line in msgs: + self.irc.server.privmsg(target, line) + def save(self): """Save whatever the module may need to save. Sync files, etc.