From 6c5978e7d023b8e868d1562ec6b9bcdbaea8dee1 Mon Sep 17 00:00:00 2001 From: attilamolnar Date: Sun, 17 Jun 2012 14:44:01 +0200 Subject: 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 --- src/modules/m_svshold.cpp | 46 ++++++++++++++++++---------------------------- 1 file 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 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& parameters) { - return ROUTE_BROADCAST; + return ROUTE_LOCALONLY; } }; -- cgit v1.2.3