summaryrefslogtreecommitdiff
path: root/src/modules/m_svshold.cpp
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2012-06-26 14:16:44 -0700
committerAttila Molnar <attilamolnar@hush.com>2012-06-26 14:16:44 -0700
commit9539fa9d7bcb19100bd5b7f67d6f792e48fff909 (patch)
tree998a501a9d176eb9f3bebe484ebeaaaf6f67e3b8 /src/modules/m_svshold.cpp
parentf293861ab70eab76ae0715a5f2c2769de332c779 (diff)
parent14b7e4c1ab7fd7d9cf71344bb08b211a0aa1ca15 (diff)
Merge pull request #215 from attilamolnar/insp20+modfixes
[2.0] Bugfixes/improvements in m_rline, m_svshold, m_shun, m_cban
Diffstat (limited to 'src/modules/m_svshold.cpp')
-rw-r--r--src/modules/m_svshold.cpp46
1 files changed, 18 insertions, 28 deletions
diff --git a/src/modules/m_svshold.cpp b/src/modules/m_svshold.cpp
index a38776d8d..37288a322 100644
--- a/src/modules/m_svshold.cpp
+++ b/src/modules/m_svshold.cpp
@@ -81,6 +81,11 @@ class SVSHoldFactory : public XLineFactory
{
return new SVSHold(set_time, duration, source, reason, xline_specific_mask);
}
+
+ bool AutoApplyToUserList(XLine *x)
+ {
+ return false;
+ }
};
/** Handle /SVSHold
@@ -115,45 +120,30 @@ class CommandSvshold : public Command
{
user->WriteServ("NOTICE %s :*** SVSHOLD %s not found in list, try /stats S.",user->nick.c_str(),parameters[0].c_str());
}
-
- return CMD_SUCCESS;
}
- else if (parameters.size() >= 2)
+ else
{
// Adding - XXX todo make this respect <insane> tag perhaps..
long duration = ServerInstance->Duration(parameters[1]);
- SVSHold *r = NULL;
+ SVSHold* r = new SVSHold(ServerInstance->Time(), duration, user->nick.c_str(), parameters[2].c_str(), parameters[0].c_str());
- try
- {
- r = new SVSHold(ServerInstance->Time(), duration, user->nick.c_str(), parameters[2].c_str(), parameters[0].c_str());
- }
- catch (...)
+ if (ServerInstance->XLines->AddLine(r, user))
{
- ; // Do nothing.
- }
-
- if (r)
- {
- if (ServerInstance->XLines->AddLine(r, user))
+ if (!duration)
{
- if (!duration)
- {
- ServerInstance->SNO->WriteGlobalSno('x', "%s added permanent SVSHOLD for %s: %s", user->nick.c_str(), parameters[0].c_str(), parameters[2].c_str());
- }
- else
- {
- time_t c_requires_crap = duration + ServerInstance->Time();
- ServerInstance->SNO->WriteGlobalSno('x', "%s added timed SVSHOLD for %s, expires on %s: %s", user->nick.c_str(), parameters[0].c_str(), ServerInstance->TimeString(c_requires_crap).c_str(), parameters[2].c_str());
- }
-
- ServerInstance->XLines->ApplyLines();
+ ServerInstance->SNO->WriteGlobalSno('x', "%s added permanent SVSHOLD for %s: %s", user->nick.c_str(), parameters[0].c_str(), parameters[2].c_str());
}
else
{
- delete r;
+ time_t c_requires_crap = duration + ServerInstance->Time();
+ ServerInstance->SNO->WriteGlobalSno('x', "%s added timed SVSHOLD for %s, expires on %s: %s", user->nick.c_str(), parameters[0].c_str(), ServerInstance->TimeString(c_requires_crap).c_str(), parameters[2].c_str());
}
}
+ else
+ {
+ delete r;
+ return CMD_FAILURE;
+ }
}
return CMD_SUCCESS;
@@ -161,7 +151,7 @@ class CommandSvshold : public Command
RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters)
{
- return ROUTE_BROADCAST;
+ return ROUTE_LOCALONLY;
}
};