summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/modes/cmode_p.h8
-rw-r--r--src/modes/cmode_p.cpp22
2 files changed, 30 insertions, 0 deletions
diff --git a/include/modes/cmode_p.h b/include/modes/cmode_p.h
new file mode 100644
index 000000000..87ffca4cb
--- /dev/null
+++ b/include/modes/cmode_p.h
@@ -0,0 +1,8 @@
+#include "mode.h"
+
+class ModeChannelPrivate : public ModeHandler
+{
+ public:
+ ModeChannelPrivate();
+ ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string &parameter, bool adding);
+};
diff --git a/src/modes/cmode_p.cpp b/src/modes/cmode_p.cpp
new file mode 100644
index 000000000..7ebdbf499
--- /dev/null
+++ b/src/modes/cmode_p.cpp
@@ -0,0 +1,22 @@
+#include "inspircd.h"
+#include "mode.h"
+#include "channels.h"
+#include "users.h"
+#include "modes/cmode_p.h"
+
+ModeChannelPrivate::ModeChannelPrivate() : ModeHandler('s', 0, 0, 0, MODETYPE_CHANNEL, false)
+{
+}
+
+ModeAction ModeChannelPrivate::OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string &parameter, bool adding)
+{
+ if (channel->modes[CM_PRIVATE] != adding)
+ {
+ channel->modes[CM_PRIVATE] = adding;
+ return MODEACTION_ALLOW;
+ }
+ else
+ {
+ return MODEACTION_DENY;
+ }
+}