diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mode.cpp | 3 | ||||
-rw-r--r-- | src/modes/cmode_i.cpp | 22 |
2 files changed, 25 insertions, 0 deletions
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 ¶meter, bool adding) +{ + if (channel->modes[CM_INVITEONLY] != adding) + { + channel->modes[CM_INVITEONLY] = adding; + return MODEACTION_ALLOW; + } + else + { + return MODEACTION_DENY; + } +} |