]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modes/umode_n.cpp
Debug to try figure this out ..
[user/henk/code/inspircd.git] / src / modes / umode_n.cpp
index f2c83845466861aa144901d27039f22212690b7e..c9c9e312ef309f0b52beb62cab292df33db3354e 100644 (file)
@@ -1,3 +1,16 @@
+/*       +------------------------------------+
+ *       | Inspire Internet Relay Chat Daemon |
+ *       +------------------------------------+
+ *
+ *  InspIRCd: (C) 2002-2007 InspIRCd Development Team
+ * See: http://www.inspircd.org/wiki/index.php/Credits
+ *
+ * This program is free but copyrighted software; see
+ *            the file COPYING for details.
+ *
+ * ---------------------------------------------------
+ */
+
 #include "inspircd.h"
 #include "mode.h"
 #include "channels.h"
@@ -17,6 +30,10 @@ ModeAction ModeUserServerNoticeMask::OnModeChange(userrec* source, userrec* dest
        /* Set the bitfields */
        if (adding)
        {
+               /* Fix for bug #310 reported by Smartys */
+               if (!dest->modes[UM_SNOMASK])
+                       memset(dest->snomasks, 0, sizeof(dest->snomasks));
+
                parameter = dest->ProcessNoticeMasks(parameter.c_str());
                dest->modes[UM_SNOMASK] = true;
                if (!dest->modes[UM_SERVERNOTICE])
@@ -26,10 +43,13 @@ ModeAction ModeUserServerNoticeMask::OnModeChange(userrec* source, userrec* dest
                }
                return MODEACTION_ALLOW;
        }
-       else if (dest->modes[UM_SNOMASK] != false)
+       else
        {
-               dest->modes[UM_SNOMASK] = false;
-               return MODEACTION_ALLOW;
+               if (dest->modes[UM_SNOMASK] != false)
+               {
+                       dest->modes[UM_SNOMASK] = false;
+                       return MODEACTION_ALLOW;
+               }
        }
 
        /* Allow the change */