Anonymous committed 683a68f

Minor improvements to the nick channge routine. Works a little better now, but still not correctly.


Comments (0)

Files changed (1)

 # Known missing features which might be implemented one day:
 # - No user list on joining a channel.
-# - Proper nick name support is lacking (changing nick, duplicate nicks).
+# - Proper nick name support is lacking (changing nick party working).
 # - No part support.
 # - starting server when already started doesn't work properly. PID file is not changed, no error messsage is displayed.
 				raise IRCError(ERR_NICKNAMEINUSE, 'NICK :%s' % (nick))
 				# Nick is available. Change the nick.
+				message = ':%s NICK :%s' % (self.client_ident(), nick)
+				prev_nick = self.nick
 				self.nick = nick
 				self.server.clients[self.nick] = self
-				message = ':%s NICK :%s' % (self.client_ident(), self.nick) # FIXME: something wrong with this.
-				# FIXME Send a message to the client specificly, he may not be on a channel.
+				# Send a notification of the nick change to all the clients in
+				# the channels the client is in.
 				for channel in self.channels:
 					for client in channel.clients:
-						client.send_queue.append(message)
+						if client != self: # do not send to client itself.
+							client.send_queue.append(message)
+				# Send a notification of the nick change to the client itself
+				return(message)
 	def handle_user(self, params):