summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorattilamolnar <attilamolnar@hush.com>2012-06-17 14:44:01 +0200
committerattilamolnar <attilamolnar@hush.com>2012-06-17 15:06:14 +0200
commit6c5978e7d023b8e868d1562ec6b9bcdbaea8dee1 (patch)
tree8d4f4b717ec97a168ca7ddfbff95248d1d145c85 /src/modules
parent485f3332b97c3a266ac5bdef0c5a4be7cdd1d79b (diff)
m_svshold Fix a couple of things, namely
- don't ask the XLine manager to apply SVSHOLD lines to the userlist, as we do nothing on match - remove call to XLineManager::ApplyLines() as it iterates the local userlist and made no sense - return CMD_SUCCESS when SVSHOLD succeeded, CMD_FAILURE otherwise - remove unused exception handler - don't route SVSHOLD commands at all, spanningtree adds and removes the lines automatically
Diffstat (limited to 'src/modules')
-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;
}
};