Commit Diff


commit - 5538115537e82bec69ca8b3d1f33377d3ba592a0
commit + 11af32466fc7c7314e898443de60068549d16724
blob - 51eeed7b753673f2af7021e52382498b2590480c
blob + d711bf34678c212152b26dd3d49df6b58ddfe0e5
--- src/ngircd/irc-mode.c
+++ src/ngircd/irc-mode.c
@@ -517,10 +517,9 @@ Channel_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Or
 			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));
@@ -529,16 +528,6 @@ Channel_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Or
 						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));
@@ -546,6 +535,14 @@ Channel_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Or
 					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])) {