From 40320969da824c4150134fa5177c02694c6b49bd Mon Sep 17 00:00:00 2001 From: brain Date: Fri, 7 Jul 2006 22:55:47 +0000 Subject: Add support for channelmode +i git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4159 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/mode.cpp | 3 +++ src/modes/cmode_i.cpp | 22 ++++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 src/modes/cmode_i.cpp (limited to 'src') 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 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 ¶meter, bool adding) +{ + if (channel->modes[CM_INVITEONLY] != adding) + { + channel->modes[CM_INVITEONLY] = adding; + return MODEACTION_ALLOW; + } + else + { + return MODEACTION_DENY; + } +} -- cgit v1.2.3