From 1eefcc4331fb40b0232c81e8fabbc8c8a0e97e6d Mon Sep 17 00:00:00 2001 From: brain Date: Mon, 2 May 2005 23:21:56 +0000 Subject: Fix to prevent empty umodes git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@1283 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/mode.cpp | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/mode.cpp b/src/mode.cpp index 65e42e875..610ea21e4 100644 --- a/src/mode.cpp +++ b/src/mode.cpp @@ -1444,12 +1444,14 @@ void handle_mode(char **parameters, int pcnt, userrec *user) if ((!b[0]) || (!strcmp(b,"+")) || (!strcmp(b,"-"))) return; - WriteTo(user, dest, "MODE %s :%s", dest->nick, b); - - // M token for a usermode must go to all servers - char buffer[MAXBUF]; - snprintf(buffer,MAXBUF,"m %s %s %s",user->nick, dest->nick, b); - NetSendToAll(buffer); + if (strcmp(b,"")) + { + WriteTo(user, dest, "MODE %s :%s", dest->nick, b); + // M token for a usermode must go to all servers + char buffer[MAXBUF]; + snprintf(buffer,MAXBUF,"m %s %s %s",user->nick, dest->nick, b); + NetSendToAll(buffer); + } if (strlen(dmodes)>MAXMODES) { @@ -1696,15 +1698,17 @@ void server_mode(char **parameters, int pcnt, userrec *user) if ((b[z] == '-') || (b[z] == '+')) b[z] = '\0'; - if ((!strcmp(b,"+")) || (!strcmp(b,"-"))) + if ((!b[0]) || (!strcmp(b,"+")) || (!strcmp(b,"-"))) return; - WriteTo(user, dest, "MODE %s :%s", dest->nick, b); - - // M token for a usermode must go to all servers - char buffer[MAXBUF]; - snprintf(buffer,MAXBUF,"m %s %s %s",user->nick, dest->nick, b); - NetSendToAll(buffer); + if (strcmp(b,"")) + { + WriteTo(user, dest, "MODE %s :%s", dest->nick, b); + // M token for a usermode must go to all servers + char buffer[MAXBUF]; + snprintf(buffer,MAXBUF,"m %s %s %s",user->nick, dest->nick, b); + NetSendToAll(buffer); + } if (strlen(dmodes)>MAXMODES) { -- cgit v1.2.3