Introducing new hooks manager
Currently, the manager use a naive implementation, this is mainly for architectural testing purpose.
This commit is contained in:
parent
29819c7874
commit
3bc53bb4ef
14 changed files with 346 additions and 441 deletions
|
|
@ -31,7 +31,7 @@ import server
|
|||
#Store all used ports
|
||||
PORTS = list()
|
||||
|
||||
class DCC(server.Server):
|
||||
class DCC(server.AbstractServer):
|
||||
def __init__(self, srv, dest, socket=None):
|
||||
server.Server.__init__(self)
|
||||
|
||||
|
|
|
|||
|
|
@ -42,6 +42,17 @@ class IRCServer(SocketServer):
|
|||
return True
|
||||
return False
|
||||
|
||||
def send_response(self, res):
|
||||
if type(res.channel) != list:
|
||||
res.channel = [ res.channel ]
|
||||
for channel in res.channel:
|
||||
if channel is not None and channel != self.nick:
|
||||
self.write("%s %s :%s" % ("PRIVMSG", channel, res.get_message()))
|
||||
else:
|
||||
channel = res.sender.split("!")[0]
|
||||
self.write("%s %s :%s" % ("NOTICE" if res.is_ctcp else "PRIVMSG", channel, res.get_message()))
|
||||
|
||||
|
||||
def _close(self):
|
||||
self.write("QUIT")
|
||||
SocketServer._close(self)
|
||||
|
|
|
|||
|
|
@ -63,6 +63,10 @@ class AbstractServer(io.IOBase):
|
|||
_xlist.remove(self)
|
||||
|
||||
|
||||
def send_response(self, res):
|
||||
return NotImplemented
|
||||
|
||||
|
||||
def write(self, message):
|
||||
"""Send a message to the server using send_callback"""
|
||||
self._send_callback(message)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue