Separate treat_msg function in DCC, in ordre to overwrite it
This commit is contained in:
parent
f5166aca16
commit
64d4997605
26
DCC.py
26
DCC.py
@ -212,6 +212,17 @@ class DCC(threading.Thread):
|
||||
readbuffer = temp.pop()
|
||||
|
||||
for line in temp:
|
||||
self.treat_msg(line)
|
||||
|
||||
if self.connected:
|
||||
self.conn.close()
|
||||
self.connected = False
|
||||
self.stopping.set()
|
||||
#Rearm Thread
|
||||
threading.Thread.__init__(self)
|
||||
|
||||
def treat_msg(self, line):
|
||||
"""Treat a receive message, *can be overwritten*"""
|
||||
if (line[:nicksize] == Bnick and
|
||||
line[nicksize+1:].strip()[:10] == b'my name is'):
|
||||
name = line[nicksize+1:].strip()[11:].decode('utf-8',
|
||||
@ -224,20 +235,13 @@ class DCC(threading.Thread):
|
||||
self.srv.dcc_clients[self.realname] = self
|
||||
self.send_dcc("Hi " + self.nick)
|
||||
else:
|
||||
self.send_dcc("This nickname is already in use,"
|
||||
" please choose another one.")
|
||||
self.send_dcc("This nickname is already in use"
|
||||
", please choose another one.")
|
||||
else:
|
||||
self.send_dcc("The name you entered contain"
|
||||
" invalid char.")
|
||||
else:
|
||||
self.srv.treat_msg(
|
||||
(":%s PRIVMSG %s :" % (self.sender,
|
||||
self.srv.nick)).encode() + line,
|
||||
(":%s PRIVMSG %s :" % (
|
||||
self.sender,self.srv.nick)).encode() + line,
|
||||
True)
|
||||
|
||||
if self.connected:
|
||||
self.conn.close()
|
||||
self.connected = False
|
||||
self.stopping.set()
|
||||
#Rearm Thread
|
||||
threading.Thread.__init__(self)
|
||||
|
Loading…
Reference in New Issue
Block a user