Jason R. Coombs avatar Jason R. Coombs committed 60a295d

Removed null logic branches

Comments (0)

Files changed (1)

             if nick in self.server.clients:
                 # Someone else is using the nick
                 raise IRCError(events.codes['nicknameinuse'], 'NICK :%s' % (nick))
-            else:
-                # Nick is available, register, send welcome and MOTD.
-                self.nick = nick
-                self.server.clients[nick] = self
-                response = ':%s %s %s :%s' % (self.server.servername,
-                    events.codes['welcome'], self.nick, SRV_WELCOME)
-                self.send_queue.append(response)
-                response = ':%s 376 %s :End of MOTD command.' % (self.server.servername, self.nick)
-                self.send_queue.append(response)
-                return
-        else:
-            if self.server.clients.get(nick, None) == self:
-                # Already registered to user
-                return
-            elif nick in self.server.clients:
-                # Someone else is using the nick
-                raise IRCError(events.codes['nicknameinuse'], 'NICK :%s' % (nick))
-            else:
-                # Nick is available. Change the nick.
-                message = ':%s NICK :%s' % (self.client_ident(), nick)
+            # Nick is available, register, send welcome and MOTD.
+            self.nick = nick
+            self.server.clients[nick] = self
+            response = ':%s %s %s :%s' % (self.server.servername,
+                events.codes['welcome'], self.nick, SRV_WELCOME)
+            self.send_queue.append(response)
+            response = ':%s 376 %s :End of MOTD command.' % (self.server.servername, self.nick)
+            self.send_queue.append(response)
+            return
 
-                self.server.clients.pop(self.nick)
-                self.nick = nick
-                self.server.clients[self.nick] = self
+        if self.server.clients.get(nick, None) == self:
+            # Already registered to user
+            return
+        elif nick in self.server.clients:
+            # Someone else is using the nick
+            raise IRCError(events.codes['nicknameinuse'], 'NICK :%s' % (nick))
+        # Nick is available. Change the nick.
+        message = ':%s NICK :%s' % (self.client_ident(), nick)
 
-                # Send a notification of the nick change to all the clients in
-                # the channels the client is in.
-                for channel in self.channels.values():
-                    for client in channel.clients:
-                        if client != self: # do not send to client itself.
-                            client.send_queue.append(message)
+        self.server.clients.pop(self.nick)
+        self.nick = nick
+        self.server.clients[self.nick] = self
 
-                # Send a notification of the nick change to the client itself
-                return message
+        # Send a notification of the nick change to all the clients in
+        # the channels the client is in.
+        for channel in self.channels.values():
+            for client in channel.clients:
+                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):
         """
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.