1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2007 InspIRCd Development Team
6 * See: http://www.inspircd.org/wiki/index.php/Credits
8 * This program is free but copyrighted software; see
9 * the file COPYING for details.
11 * ---------------------------------------------------
18 #include "modes/umode_n.h"
20 ModeUserServerNoticeMask::ModeUserServerNoticeMask(InspIRCd* Instance) : ModeHandler(Instance, 'n', 1, 0, false, MODETYPE_USER, true)
24 ModeAction ModeUserServerNoticeMask::OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding)
26 /* Only opers can change other users modes */
27 if ((source != dest) && (!*source->oper))
28 return MODEACTION_DENY;
30 /* Set the bitfields */
33 /* Fix for bug #310 reported by Smartys */
34 if (!dest->modes[UM_SNOMASK])
35 memset(dest->snomasks, 0, sizeof(dest->snomasks));
37 parameter = dest->ProcessNoticeMasks(parameter.c_str());
38 dest->modes[UM_SNOMASK] = true;
39 if (!dest->modes[UM_SERVERNOTICE])
41 const char* newmodes[] = { dest->nick, "+s" };
42 ServerInstance->Modes->Process(newmodes, 2, source, true);
44 return MODEACTION_ALLOW;
48 if (dest->modes[UM_SNOMASK] != false)
50 dest->modes[UM_SNOMASK] = false;
51 return MODEACTION_ALLOW;
55 /* Allow the change */
56 return MODEACTION_DENY;