]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modes/cmode_s.cpp
Add config <options:disablehmac> to support disabling of HMAC, and tidy up to detect...
[user/henk/code/inspircd.git] / src / modes / cmode_s.cpp
index 16c446eec874525520618dad2de77e0b3ffe06e4..135291592c7bc2cce4dccfbec2b44ec26343aafa 100644 (file)
@@ -1,19 +1,35 @@
+/*       +------------------------------------+
+ *       | 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"
 #include "users.h"
+#include "modes/cmode_s.h"
 
-class ModeChannelSecret : public ModeHandler
+ModeChannelSecret::ModeChannelSecret(InspIRCd* Instance) : ModeHandler(Instance, 's', 0, 0, false, MODETYPE_CHANNEL, false)
 {
- public:
-       ModeChannelSecret() : ModeHandler('s', 0, 0, 0, MODETYPE_CHANNEL, false)
-       {
-       }
+}
 
-       ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string &parameter, bool adding)
+ModeAction ModeChannelSecret::OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string &parameter, bool adding)
+{
+       if (channel->modes[CM_SECRET] != adding)
        {
                channel->modes[CM_SECRET] = adding;
                return MODEACTION_ALLOW;
        }
-};
-
+       else
+       {
+               return MODEACTION_DENY;
+       }
+}