]> arthur.barton.de Git - ngircd-alex.git/commitdiff
Channel_Mode: change order of if (set) and if (client) check.
authorFlorian Westphal <fw@strlen.de>
Sat, 19 Apr 2008 14:51:42 +0000 (16:51 +0200)
committerFlorian Westphal <fw@strlen.de>
Sat, 19 Apr 2008 14:51:42 +0000 (16:51 +0200)
src/ngircd/irc-mode.c

index 51eeed7b753673f2af7021e52382498b2590480c..d711bf34678c212152b26dd3d49df6b58ddfe0e5 100644 (file)
@@ -517,10 +517,9 @@ Channel_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel )
                        continue;
                }
 
                        continue;
                }
 
-               if (set) {
-                       /* Set mode */
-                       if (client) {
-                               /* Channel-User-Mode */
+               if (client) {
+                       /* Channel-User-Mode */
+                       if (set) {
                                if (Channel_UserModeAdd(Channel, client, x[0])) {
                                        strlcat(the_args, " ", sizeof(the_args));
                                        strlcat(the_args, Client_ID(client), sizeof(the_args));
                                if (Channel_UserModeAdd(Channel, client, x[0])) {
                                        strlcat(the_args, " ", sizeof(the_args));
                                        strlcat(the_args, Client_ID(client), sizeof(the_args));
@@ -529,16 +528,6 @@ Channel_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel )
                                                Client_Mask(client), Channel_Name(Channel), Channel_UserModes(Channel, client));
                                }
                        } else {
                                                Client_Mask(client), Channel_Name(Channel), Channel_UserModes(Channel, client));
                                }
                        } else {
-                               /* Channel-Mode */
-                               if (Channel_ModeAdd( Channel, x[0])) {
-                                       strlcat(the_modes, x, sizeof(the_modes));
-                                       Log(LOG_DEBUG, "Channel %s: Mode change, now \"%s\".", Channel_Name(Channel), Channel_Modes(Channel));
-                               }
-                       }
-               } else {
-                       /* Unset mode */
-                       if (client) {
-                               /* Channel-User-Mode */
                                if (Channel_UserModeDel(Channel, client, x[0])) {
                                        strlcat(the_args, " ", sizeof(the_args));
                                        strlcat(the_args, Client_ID(client), sizeof(the_args));
                                if (Channel_UserModeDel(Channel, client, x[0])) {
                                        strlcat(the_args, " ", sizeof(the_args));
                                        strlcat(the_args, Client_ID(client), sizeof(the_args));
@@ -546,6 +535,14 @@ Channel_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel )
                                        Log(LOG_DEBUG, "User \"%s\": Mode change on %s, now \"%s\"",
                                                Client_Mask(client), Channel_Name(Channel), Channel_UserModes(Channel, client));
                                }
                                        Log(LOG_DEBUG, "User \"%s\": Mode change on %s, now \"%s\"",
                                                Client_Mask(client), Channel_Name(Channel), Channel_UserModes(Channel, client));
                                }
+                       }
+               } else {
+                       /* Channel-Mode */
+                       if (set) {
+                               if (Channel_ModeAdd( Channel, x[0])) {
+                                       strlcat(the_modes, x, sizeof(the_modes));
+                                       Log(LOG_DEBUG, "Channel %s: Mode change, now \"%s\".", Channel_Name(Channel), Channel_Modes(Channel));
+                               }
                        } else {
                                /* Channel-Mode */
                                if (Channel_ModeDel(Channel, x[0])) {
                        } else {
                                /* Channel-Mode */
                                if (Channel_ModeDel(Channel, x[0])) {