summaryrefslogtreecommitdiff
path: root/modules/commands/os_session.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/commands/os_session.cpp')
-rw-r--r--modules/commands/os_session.cpp52
1 files changed, 4 insertions, 48 deletions
diff --git a/modules/commands/os_session.cpp b/modules/commands/os_session.cpp
index e78d3fd9e..997914360 100644
--- a/modules/commands/os_session.cpp
+++ b/modules/commands/os_session.cpp
@@ -473,45 +473,6 @@ class CommandOSException : public Command
source.Reply(_("Services are in read-only mode. Any changes made may not persist."));
}
- void DoMove(CommandSource &source, const std::vector<Anope::string> &params)
- {
- // XXX
-#if 0
- const Anope::string &n1str = params.size() > 1 ? params[1] : ""; /* From position */
- const Anope::string &n2str = params.size() > 2 ? params[2] : ""; /* To position */
- int n1, n2;
-
- if (n2str.empty())
- {
- this->OnSyntaxError(source, "MOVE");
- return;
- }
-
- n1 = n2 = -1;
- try
- {
- n1 = convertTo<int>(n1str);
- n2 = convertTo<int>(n2str);
- }
- catch (const ConvertException &) { }
-
- if (n1 >= 0 && static_cast<unsigned>(n1) < session_service->GetExceptions().size() && n2 >= 0 && static_cast<unsigned>(n2) < session_service->GetExceptions().size() && n1 != n2)
- {
- Exception *temp = session_service->GetExceptions()[n1];
- session_service->GetExceptions()[n1] = session_service->GetExceptions()[n2];
- session_service->GetExceptions()[n2] = temp;
-
- Log(LOG_ADMIN, source, this) << "to move exception " << session_service->GetExceptions()[n1]->mask << " from position " << n1 + 1 << " to position " << n2 + 1;
- source.Reply(_("Exception for \002{0}\002 (#{1}) moved to position \002{2}\002."), session_service->GetExceptions()[n1]->mask, n1 + 1, n2 + 1);
-
- if (Anope::ReadOnly)
- source.Reply(_("Services are in read-only mode. Any changes made may not persist."));
- }
- else
- this->OnSyntaxError(source, "MOVE");
-#endif
- }
-
void ProcessList(CommandSource &source, const std::vector<Anope::string> &params, ListFormatter &list)
{
const Anope::string &mask = params.size() > 1 ? params[1] : "";
@@ -602,7 +563,6 @@ class CommandOSException : public Command
this->SetDesc(_("Modify the session-limit exception list"));
this->SetSyntax(_("ADD [\037+expiry\037] \037mask\037 \037limit\037 \037reason\037"));
this->SetSyntax(_("DEL {\037mask\037 | \037entry-num\037 | \037list\037}"));
- this->SetSyntax(_("MOVE \037num\037 \037position\037"));
this->SetSyntax(_("LIST [\037mask\037 | \037list\037]"));
this->SetSyntax(_("VIEW [\037mask\037 | \037list\037]"));
}
@@ -617,8 +577,6 @@ class CommandOSException : public Command
return this->DoAdd(source, params);
else if (cmd.equals_ci("DEL"))
return this->DoDel(source, params);
- else if (cmd.equals_ci("MOVE"))
- return this->DoMove(source, params);
else if (cmd.equals_ci("LIST"))
return this->DoList(source, params);
else if (cmd.equals_ci("VIEW"))
@@ -648,9 +606,6 @@ class CommandOSException : public Command
"\n"
"\002{0} DEL\002 removes the given mask from the exception list.\n"
"\n"
- "\002{0} MOVE\002 moves exception \037num\037 to \037position\037."
- " The sessions inbetween will be shifted up or down to fill the gap.\n"
- "\n"
"\002{0} LIST\002 and \002{0} VIEW\002 show all current sessions if the optional mask is given, the list is limited to those sessions matching the mask."
" The difference is that \002{0} VIEW\002 is more verbose, displaying the name of the person who added the exception, its session limit, reason, host mask and the expiry date and time.\n"));
return true;
@@ -749,9 +704,10 @@ class OSSession : public Module
}
++session->hits;
- if (max_session_kill && session->hits >= max_session_kill && akills)
+
+ const Anope::string &akillmask = "*@" + session->addr.mask();
+ if (max_session_kill && session->hits >= max_session_kill && akills && !akills->HasEntry(akillmask))
{
- const Anope::string &akillmask = "*@" + session->addr.mask();
XLine *x = new XLine(akillmask, OperServ ? OperServ->nick : "", Anope::CurTime + session_autokill_expiry, "Session limit exceeded", XLineManager::GenerateUID());
akills->AddXLine(x);
akills->Send(NULL, x);
@@ -759,7 +715,7 @@ class OSSession : public Module
}
else
{
- u->Kill(OperServ ? OperServ->nick : "", "Session limit exceeded");
+ u->Kill(OperServ, "Session limit exceeded");
}
}
}