summaryrefslogtreecommitdiff
path: root/src/modes/cmode_i.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/modes/cmode_i.cpp')
-rw-r--r--src/modes/cmode_i.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/modes/cmode_i.cpp b/src/modes/cmode_i.cpp
new file mode 100644
index 000000000..d74ac86e7
--- /dev/null
+++ b/src/modes/cmode_i.cpp
@@ -0,0 +1,22 @@
+#include "inspircd.h"
+#include "mode.h"
+#include "channels.h"
+#include "users.h"
+#include "modes/cmode_i.h"
+
+ModeChannelInviteOnly::ModeChannelInviteOnly() : ModeHandler('i', 0, 0, false, MODETYPE_CHANNEL, false)
+{
+}
+
+ModeAction ModeChannelInviteOnly::OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string &parameter, bool adding)
+{
+ if (channel->modes[CM_INVITEONLY] != adding)
+ {
+ channel->modes[CM_INVITEONLY] = adding;
+ return MODEACTION_ALLOW;
+ }
+ else
+ {
+ return MODEACTION_DENY;
+ }
+}