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()
|
readbuffer = temp.pop()
|
||||||
|
|
||||||
for line in temp:
|
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
|
if (line[:nicksize] == Bnick and
|
||||||
line[nicksize+1:].strip()[:10] == b'my name is'):
|
line[nicksize+1:].strip()[:10] == b'my name is'):
|
||||||
name = line[nicksize+1:].strip()[11:].decode('utf-8',
|
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.srv.dcc_clients[self.realname] = self
|
||||||
self.send_dcc("Hi " + self.nick)
|
self.send_dcc("Hi " + self.nick)
|
||||||
else:
|
else:
|
||||||
self.send_dcc("This nickname is already in use,"
|
self.send_dcc("This nickname is already in use"
|
||||||
" please choose another one.")
|
", please choose another one.")
|
||||||
else:
|
else:
|
||||||
self.send_dcc("The name you entered contain"
|
self.send_dcc("The name you entered contain"
|
||||||
" invalid char.")
|
" invalid char.")
|
||||||
else:
|
else:
|
||||||
self.srv.treat_msg(
|
self.srv.treat_msg(
|
||||||
(":%s PRIVMSG %s :" % (self.sender,
|
(":%s PRIVMSG %s :" % (
|
||||||
self.srv.nick)).encode() + line,
|
self.sender,self.srv.nick)).encode() + line,
|
||||||
True)
|
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