summaryrefslogtreecommitdiff
path: root/src/modules/m_timedbans.cpp
diff options
context:
space:
mode:
authorShutterQuick <shutter@canternet.org>2013-03-07 11:23:47 -0800
committerattilamolnar <attilamolnar@hush.com>2013-03-15 00:41:16 +0100
commitb71f1affeaa2dbc1d4e5fdf799ab1527a190b0e1 (patch)
treec665a8d20a5d8bb7c8c6dadb505a100e9f826474 /src/modules/m_timedbans.cpp
parentb17ba83e9c5da3620277ff317b5f82dc397813d7 (diff)
Modified m_timedbans to behave more like setting mode +b manually.
It now accepts extbans. If one enters something not an extban, or valid banmask, it'll add "!*@*", making it a nick-ban instead of borking.
Diffstat (limited to 'src/modules/m_timedbans.cpp')
-rw-r--r--src/modules/m_timedbans.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/modules/m_timedbans.cpp b/src/modules/m_timedbans.cpp
index 90e814a18..a622fd4e2 100644
--- a/src/modules/m_timedbans.cpp
+++ b/src/modules/m_timedbans.cpp
@@ -62,12 +62,8 @@ class CommandTban : public Command
user->WriteNumeric(482, "%s %s :You do not have permission to set bans on this channel",
user->nick.c_str(), channel->name.c_str());
return CMD_FAILURE;
- }
- if (!ServerInstance->IsValidMask(parameters[2]))
- {
- user->WriteServ("NOTICE "+user->nick+" :Invalid ban mask");
- return CMD_FAILURE;
- }
+ }
+
TimedBan T;
std::string channelname = parameters[0];
long duration = ServerInstance->Duration(parameters[1]);
@@ -81,7 +77,15 @@ class CommandTban : public Command
std::vector<std::string> setban;
setban.push_back(parameters[0]);
setban.push_back("+b");
- setban.push_back(parameters[2]);
+ bool isextban = ((mask.size() > 2) && (mask[1] == ':'));
+ if (!isextban && !ServerInstance->IsValidMask(mask))
+ mask.append("!*@*");
+ if ((mask.length() > 250) || (!ServerInstance->IsValidMask(mask) && !isextban))
+ {
+ user->WriteServ("NOTICE "+user->nick+" :Invalid ban mask");
+ return CMD_FAILURE;
+ }
+ setban.push_back(mask);
// use CallHandler to make it so that the user sets the mode
// themselves
ServerInstance->Parser->CallHandler("MODE",setban,user);