New event when connection with server is closed
This commit is contained in:
parent
cb0056b605
commit
818bc5f889
4
DCC.py
4
DCC.py
@ -206,13 +206,15 @@ class DCC(server.Server):
|
|||||||
|
|
||||||
print ("Closing connection with", self.nick)
|
print ("Closing connection with", self.nick)
|
||||||
self.stopping.set()
|
self.stopping.set()
|
||||||
|
if self.closing_event is not None:
|
||||||
|
self.closing_event()
|
||||||
#Rearm Thread
|
#Rearm Thread
|
||||||
threading.Thread.__init__(self)
|
threading.Thread.__init__(self)
|
||||||
|
|
||||||
def treat_msg(self, line):
|
def treat_msg(self, line):
|
||||||
"""Treat a receive message, *can be overwritten*"""
|
"""Treat a receive message, *can be overwritten*"""
|
||||||
if line == b'NEMUBOT###':
|
if line == b'NEMUBOT###':
|
||||||
bot = self.srv.context.add_networkbot(self.srv, self.sender, self)
|
bot = self.srv.add_networkbot(self.srv, self.sender, self)
|
||||||
self.treatement = bot.treat_msg
|
self.treatement = bot.treat_msg
|
||||||
self.send_dcc("NEMUBOT###")
|
self.send_dcc("NEMUBOT###")
|
||||||
elif (line[:self.nicksize] == self.Bnick and
|
elif (line[:self.nicksize] == self.Bnick and
|
||||||
|
@ -122,7 +122,7 @@ class IRCServer(server.Server):
|
|||||||
if msg.channel in self.channels:
|
if msg.channel in self.channels:
|
||||||
self.channels[msg.channel].treat(msg.cmd, msg)
|
self.channels[msg.channel].treat(msg.cmd, msg)
|
||||||
|
|
||||||
def accepted_channel(self, chan, sender = None):
|
def accepted_channel(self, chan, sender=None):
|
||||||
"""Return True if the channel (or the user) is authorized"""
|
"""Return True if the channel (or the user) is authorized"""
|
||||||
if self.allow_all:
|
if self.allow_all:
|
||||||
return True
|
return True
|
||||||
@ -204,6 +204,8 @@ class IRCServer(server.Server):
|
|||||||
if self.connected:
|
if self.connected:
|
||||||
self.s.close()
|
self.s.close()
|
||||||
self.connected = False
|
self.connected = False
|
||||||
|
if self.closing_event is not None:
|
||||||
|
self.closing_event()
|
||||||
print ("Server `%s' successfully stopped." % self.id)
|
print ("Server `%s' successfully stopped." % self.id)
|
||||||
self.stopping.set()
|
self.stopping.set()
|
||||||
# Rearm Thread
|
# Rearm Thread
|
||||||
|
Loading…
x
Reference in New Issue
Block a user