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