Commit Diff


commit - 634ef8c13164321abeee37e9516cbfb71e0d0f2e
commit + 1784180bf346b6cbea86dabb0e4fdf592b19b012
blob - af9d14ca7b5ffbe960939d9950f527a6ca88df04
blob + e73d4c9ad6d2538c29f7e96e90c7afa25e80f0a9
--- ChangeLog
+++ ChangeLog
@@ -11,6 +11,8 @@
 
 
 ngIRCd HEAD
+  - Under some circumstances ngIRCd issued
+  channel MODE messages with a trailing space. (Dana Dahlstrom)
   - IRC_WHO now supports search patterns and will test this
     against user nickname/servername/hostname, etc. as required by
     RFC 2812, Section 3.6.1. (reported by Dana Dahlstrom)
@@ -744,4 +746,4 @@ ngIRCd 0.0.1, 31.12.2001
 
 
 -- 
-$Id: ChangeLog,v 1.337 2008/02/11 11:06:33 fw Exp $
+$Id: ChangeLog,v 1.338 2008/02/16 11:27:48 fw Exp $
blob - c26984d8208ec5eb0e4201bd2bebe694dd0b6097
blob + 5370a844e452b5475e1cf5e23a0546c8139752ac
--- src/ngircd/irc-mode.c
+++ src/ngircd/irc-mode.c
@@ -14,7 +14,7 @@
 
 #include "portab.h"
 
-static char UNUSED id[] = "$Id: irc-mode.c,v 1.50 2007/10/14 12:08:57 alex Exp $";
+static char UNUSED id[] = "$Id: irc-mode.c,v 1.51 2008/02/16 11:27:49 fw Exp $";
 
 #include "imp.h"
 #include <assert.h>
@@ -317,7 +317,7 @@ Channel_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Or
 	/* Prepare reply string */
 	if( set ) strcpy( the_modes, "+" );
 	else strcpy( the_modes, "-" );
-	strcpy( the_args, " " );
+	the_args[0] = '\0';
 
 	x[1] = '\0';
 	ok = CONNECTED;
@@ -528,8 +528,8 @@ Channel_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Or
 				/* Channel-User-Mode */
 				if( Channel_UserModeAdd( Channel, client, x[0] ))
 				{
-					strlcat( the_args, Client_ID( client ), sizeof( the_args ));
 					strlcat( the_args, " ", sizeof( the_args ));
+					strlcat( the_args, Client_ID( client ), sizeof( the_args ));
 					strlcat( the_modes, x, sizeof( the_modes ));
 					Log( LOG_DEBUG, "User \"%s\": Mode change on %s, now \"%s\"", Client_Mask( client ), Channel_Name( Channel ), Channel_UserModes( Channel, client ));
 				}
@@ -552,8 +552,8 @@ Channel_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Or
 				/* Channel-User-Mode */
 				if( Channel_UserModeDel( Channel, client, x[0] ))
 				{
-					strlcat( the_args, Client_ID( client ), sizeof( the_args ));
 					strlcat( the_args, " ", sizeof( the_args ));
+					strlcat( the_args, Client_ID( client ), sizeof( the_args ));
 					strlcat( the_modes, x, sizeof( the_modes ));
 					Log( LOG_DEBUG, "User \"%s\": Mode change on %s, now \"%s\"", Client_Mask( client ), Channel_Name( Channel ), Channel_UserModes( Channel, client ));
 				}
@@ -572,8 +572,7 @@ Channel_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Or
 		/* Are there additional arguments to add? */
 		if( argadd[0] )
 		{
-			len = strlen( the_args ) - 1;
-			if( the_args[len] != ' ' ) strlcat( the_args, " ", sizeof( the_args ));
+			strlcat( the_args, " ", sizeof( the_args ));
 			strlcat( the_args, argadd, sizeof( the_args ));
 		}
 	}
@@ -586,9 +585,6 @@ chan_exit:
 		len = strlen( the_modes ) - 1;
 		if(( the_modes[len] == '+' ) || ( the_modes[len] == '-' )) the_modes[len] = '\0';
 
-		/* Clean up argument string if there are none */
-		if( ! the_args[1] ) the_args[0] = '\0';
-
 		if( Client_Type( Client ) == CLIENT_SERVER )
 		{
 			/* Forward mode changes to channel users and other servers */
blob - 05dffc5cb2989a8899bd2b4ab976752dc1eda5c8
blob + 260cd03c12898ae46c5e9d58b1f5f4fb4bcf74ff
--- src/testsuite/mode-test.e
+++ src/testsuite/mode-test.e
@@ -1,4 +1,4 @@
-# $Id: mode-test.e,v 1.6 2004/03/10 20:40:06 alex Exp $
+# $Id: mode-test.e,v 1.7 2008/02/16 11:27:49 fw Exp $
 
 spawn telnet localhost 6789
 expect {
@@ -72,7 +72,7 @@ expect {
 send "mode #channel +v nick\r"
 expect {
 	timeout { exit 1 }
-	"@* MODE #channel +v nick"
+	"@* MODE #channel +v nick\r"
 }
 
 send "mode #channel +I nick1\r"
@@ -96,7 +96,7 @@ expect {
 send "mode #channel -vo nick nick\r"
 expect {
 	timeout { exit 1 }
-	"@* MODE #channel -vo nick nick"
+	"@* MODE #channel -vo nick nick\r"
 }
 
 send "quit\r"