Add subparse method in context, that use server parser

This commit is contained in:
nemunaire 2016-01-12 18:09:01 +01:00
parent d705d351c0
commit 277d55d521
2 changed files with 10 additions and 0 deletions

View File

@ -99,6 +99,10 @@ class ModuleContext:
def save():
context.datastore.save(module_name, self.data)
def subparse(orig, cnt):
if orig.server in context.servers:
return context.servers[orig.server].subparse(orig, cnt)
self.load_data = load_data
self.add_hook = add_hook
self.del_hook = del_hook
@ -107,6 +111,7 @@ class ModuleContext:
self.save = save
self.send_response = send_response
self.subtreat = subtreat
self.subparse = subparse
@property

View File

@ -268,3 +268,8 @@ class IRC(SocketServer):
mes = msg.to_bot_message(self)
if mes is not None:
yield mes
def subparse(self, orig, cnt):
msg = IRCMessage(("@time=%s :%s!user@host.com PRIVMSG %s :%s" % (orig.date.strftime("%Y-%m-%dT%H:%M:%S.%fZ"), orig.frm, ",".join(orig.to), cnt)).encode(self.encoding), self.encoding)
return msg.to_bot_message(self)