Let consumer parse the message instead of server
This commit is contained in:
parent
a1ac7d480d
commit
d269468287
4 changed files with 34 additions and 7 deletions
|
|
@ -257,11 +257,16 @@ class IRC(SocketServer):
|
|||
|
||||
def read(self):
|
||||
for line in SocketServer.read(self):
|
||||
# PING should be handled here, so start parsing here :/
|
||||
msg = IRCMessage(line, self.encoding)
|
||||
|
||||
if msg.cmd in self.hookscmd:
|
||||
self.hookscmd[msg.cmd](msg)
|
||||
|
||||
mes = msg.to_bot_message(self)
|
||||
if mes is not None:
|
||||
yield mes
|
||||
yield msg
|
||||
|
||||
|
||||
def parse(self, msg):
|
||||
mes = msg.to_bot_message(self)
|
||||
if mes is not None:
|
||||
yield mes
|
||||
|
|
|
|||
|
|
@ -139,6 +139,12 @@ class AbstractServer(io.IOBase):
|
|||
self.write(vprnt.pp)
|
||||
|
||||
|
||||
# Read
|
||||
|
||||
def parse(self, msg):
|
||||
raise NotImplemented
|
||||
|
||||
|
||||
# Exceptions
|
||||
|
||||
def exception(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue