Don't bother looking for +N channels for an op
authorIan Chard <ian@chard.org>
Wed, 24 Jun 2015 19:28:27 +0000 (20:28 +0100)
committerIan Chard <ian@chard.org>
Wed, 24 Jun 2015 19:28:27 +0000 (20:28 +0100)
src/ngircd/irc-login.c

index 79c0dcd42cb3eb108410077fba0e62a25889d724..10885f281ef4ce2b4adc3df97c06356ab074e227 100644 (file)
@@ -262,16 +262,17 @@ IRC_NICK( CLIENT *Client, REQUEST *Req )
                        /* Nickname change */
 
                        /* Check that the user isn't on any channels set +N */
-                       chan = Channel_First();
-                       while (chan) {
-                               if(Channel_IsMemberOf(chan, Client) &&
-                                  Channel_HasMode(chan, 'N') &&
-                                  !Client_HasMode(Client, 'o'))
-                                       return IRC_WriteErrClient(Client,
-                                                                 ERR_NONICKCHANGE_MSG,
-                                                                 Client_ID(Client),
-                                                                 Channel_Name(chan));
-                               chan = Channel_Next(chan);
+                       if(!Client_HasMode(Client, 'o')) {
+                               chan = Channel_First();
+                               while (chan) {
+                                       if(Channel_IsMemberOf(chan, Client) &&
+                                          Channel_HasMode(chan, 'N'))
+                                               return IRC_WriteErrClient(Client,
+                                                                         ERR_NONICKCHANGE_MSG,
+                                                                         Client_ID(Client),
+                                                                         Channel_Name(chan));
+                                       chan = Channel_Next(chan);
+                               }
                        }
 
                        Change_Nick(Client, target, Req->argv[0],