summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-07-07 22:55:47 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-07-07 22:55:47 +0000
commit40320969da824c4150134fa5177c02694c6b49bd (patch)
treeb16bb2badaec5ae20dc4d6b3bf717561560a0ab0
parent65d52bb76385f0a3f49acc4217cc6212008d3b3e (diff)
Add support for channelmode +i
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4159 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--include/modes/cmode_i.h8
-rw-r--r--src/mode.cpp3
-rw-r--r--src/modes/cmode_i.cpp22
3 files changed, 33 insertions, 0 deletions
diff --git a/include/modes/cmode_i.h b/include/modes/cmode_i.h
new file mode 100644
index 000000000..7320cb169
--- /dev/null
+++ b/include/modes/cmode_i.h
@@ -0,0 +1,8 @@
+#include "mode.h"
+
+class ModeChannelInviteOnly : public ModeHandler
+{
+ public:
+ ModeChannelInviteOnly();
+ ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string &parameter, bool adding);
+};
diff --git a/src/mode.cpp b/src/mode.cpp
index 3c6f9d7f0..6da0dbcb6 100644
--- a/src/mode.cpp
+++ b/src/mode.cpp
@@ -54,6 +54,8 @@ using namespace std;
#include "modes/cmode_t.h"
/* +n (no external messages) */
#include "modes/cmode_n.h"
+/* +i (invite only) */
+#include "modes/cmode_i.h"
extern int MODCOUNT;
extern std::vector<Module*> modules;
@@ -652,5 +654,6 @@ ModeParser::ModeParser()
this->AddMode(new ModeChannelModerated, 'm');
this->AddMode(new ModeChannelTopicOps, 't');
this->AddMode(new ModeChannelNoExternal, 'n');
+ this->AddMode(new ModeChannelInviteOnly, 'i');
}
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;
+ }
+}