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
This commit is contained in:
Brian S. Stephan 2013-01-04 10:14:37 -06:00
parent 77ada246c7
commit 30a395bc05
1 changed files with 17 additions and 0 deletions

View File

@ -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.