Only allow specifying a nick when the nick is not yet in use

master
Sven Slootweg 13 years ago
parent 75c4f573e1
commit d9d23ce2c0

@ -174,9 +174,12 @@ class user:
self.client.send_numeric("461", "%s USER :Not enough parameters." % self.nickname) self.client.send_numeric("461", "%s USER :Not enough parameters." % self.nickname)
elif data[0] == "NICK": elif data[0] == "NICK":
if len(data) >= 2: if len(data) >= 2:
self.nickname = data[1] if data[1] not in self.server.users:
self.registered_nick = True self.nickname = data[1]
self.verify_registration() self.registered_nick = True
self.verify_registration()
else:
self.client.send_numeric("433", "%s %s :Nickname is already in use." % (self.nickname, data[1]))
else: else:
self.client.send_numeric("461", "%s NICK :Not enough parameters." % self.nickname) self.client.send_numeric("461", "%s NICK :Not enough parameters." % self.nickname)
elif self.registered == 2 and data[0] == "PONG": elif self.registered == 2 and data[0] == "PONG":

Loading…
Cancel
Save