Based DCC connection state on realname instead of nickname and realname
This commit is contained in:
parent
336cab6b2a
commit
e4ea24bfa9
8
DCC.py
8
DCC.py
@ -153,6 +153,7 @@ class DCC(threading.Thread):
|
||||
self.conn.recv(4) #The client send a confirmation after each packet
|
||||
d = f.read(268435456) #Packets size: 256Mo
|
||||
else:
|
||||
if not self.connected:
|
||||
self.request_user()
|
||||
|
||||
#Start by sending all queued messages
|
||||
@ -179,11 +180,8 @@ class DCC(threading.Thread):
|
||||
if name not in self.srv.dcc_clients:
|
||||
del self.srv.dcc_clients[self.sender]
|
||||
self.nick = name
|
||||
if len(self.sender.split("!")) > 1:
|
||||
self.sender = self.nick + "!" + self.sender.split("!")[1]
|
||||
else:
|
||||
self.sender = self.nick
|
||||
self.srv.dcc_clients[self.sender] = self
|
||||
self.sender = self.nick + "!" + self.realname
|
||||
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.")
|
||||
|
@ -51,6 +51,7 @@ class Message:
|
||||
self.realname = (self.sender.split('!'))[1]
|
||||
else:
|
||||
self.realname = self.nick
|
||||
self.sender = self.nick + "!" + self.realname
|
||||
|
||||
if len(words) > 2:
|
||||
self.channel = words[2].decode()
|
||||
|
10
server.py
10
server.py
@ -106,10 +106,11 @@ class Server(threading.Thread):
|
||||
def send_dcc(self, msg, to):
|
||||
"""Send a message through DCC connection"""
|
||||
if msg is not None and to is not None:
|
||||
realname = to.split("!")[1]
|
||||
if to not in self.dcc_clients.keys():
|
||||
d = dcc.DCC(self, to)
|
||||
self.dcc_clients[to] = d
|
||||
self.dcc_clients[to].send_dcc(msg)
|
||||
d = dcc.DCC(self, realname)
|
||||
self.dcc_clients[realname] = d
|
||||
self.dcc_clients[realname].send_dcc(msg)
|
||||
|
||||
|
||||
def send_msg_final(self, channel, msg, cmd = "PRIVMSG", endl = "\r\n"):
|
||||
@ -131,7 +132,8 @@ class Server(threading.Thread):
|
||||
|
||||
def send_msg_usr(self, user, msg):
|
||||
if user is not None and user[0] != "#":
|
||||
if user in self.dcc_clients:
|
||||
realname = to.split("!")[1]
|
||||
if realname in self.dcc_clients:
|
||||
self.send_dcc(msg, user)
|
||||
else:
|
||||
self.send_msg_final(user.split('!')[0], msg)
|
||||
|
Loading…
Reference in New Issue
Block a user