diff options
author | Adam <Adam@anope.org> | 2011-03-07 19:54:51 -0500 |
---|---|---|
committer | Adam <Adam@anope.org> | 2011-03-07 19:54:51 -0500 |
commit | 8eb23e7d489239e8af79c2d6da587cd1c3a81b5d (patch) | |
tree | 04bf54ceb46a4b18345cf4e01d8aeb11ccd52c07 /modules/protocol/bahamut.cpp | |
parent | 093b3d258e7b14d2aa057ca6113de034b5063efe (diff) |
Added support for extbans
Diffstat (limited to 'modules/protocol/bahamut.cpp')
-rw-r--r-- | modules/protocol/bahamut.cpp | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/modules/protocol/bahamut.cpp b/modules/protocol/bahamut.cpp index aabe2c904..fa714d7b1 100644 --- a/modules/protocol/bahamut.cpp +++ b/modules/protocol/bahamut.cpp @@ -410,7 +410,7 @@ class BahamutIRCdMessage : public IRCdMessage ChannelMode *cm = ModeManager::FindChannelModeByChar(ch); if (!cm) { - Log() << "Receeved unknown mode prefix " << buf[0] << " in SJOIN string"; + Log() << "Receeved unknown mode prefix " << cm << " in SJOIN string"; continue; } @@ -528,18 +528,24 @@ bool event_burst(const Anope::string &source, const std::vector<Anope::string> & return true; } -bool ChannelModeFlood::IsValid(const Anope::string &value) const +class ChannelModeFlood : public ChannelModeParam { - try + public: + ChannelModeFlood(char modeChar, bool minusNoArg) : ChannelModeParam(CMODE_FLOOD, modeChar, minusNoArg) { } + + bool IsValid(const Anope::string &value) const { - Anope::string rest; - if (!value.empty() && value[0] != ':' && convertTo<int>(value[0] == '*' ? value.substr(1) : value, rest, false) > 0 && rest[0] == ':' && rest.length() > 1 && convertTo<int>(rest.substr(1), rest, false) > 0 && rest.empty()) - return true; - } - catch (const ConvertException &) { } + try + { + Anope::string rest; + if (!value.empty() && value[0] != ':' && convertTo<int>(value[0] == '*' ? value.substr(1) : value, rest, false) > 0 && rest[0] == ':' && rest.length() > 1 && convertTo<int>(rest.substr(1), rest, false) > 0 && rest.empty()) + return true; + } + catch (const ConvertException &) { } - return false; -} + return false; + } +}; class ProtoBahamut : public Module { @@ -562,7 +568,7 @@ class ProtoBahamut : public Module ModeManager::AddUserMode(new UserMode(UMODE_DEAF, 'd')); /* b/e/I */ - ModeManager::AddChannelMode(new ChannelModeBan('b')); + ModeManager::AddChannelMode(new ChannelModeBan(CMODE_BAN, 'b')); /* v/h/o/a/q */ ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_VOICE, 'v', '+')); @@ -571,7 +577,7 @@ class ProtoBahamut : public Module /* Add channel modes */ ModeManager::AddChannelMode(new ChannelMode(CMODE_BLOCKCOLOR, 'c')); ModeManager::AddChannelMode(new ChannelMode(CMODE_INVITE, 'i')); - ModeManager::AddChannelMode(new ChannelModeFlood('f')); + ModeManager::AddChannelMode(new ChannelModeFlood('f', false)); ModeManager::AddChannelMode(new ChannelModeKey('k')); ModeManager::AddChannelMode(new ChannelModeParam(CMODE_LIMIT, 'l')); ModeManager::AddChannelMode(new ChannelMode(CMODE_MODERATED, 'm')); |