summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/commands/os_sxline.cpp18
-rw-r--r--modules/pseudoclients/operserv.cpp25
2 files changed, 26 insertions, 17 deletions
diff --git a/modules/commands/os_sxline.cpp b/modules/commands/os_sxline.cpp
index 55ba83455..dcf7863fe 100644
--- a/modules/commands/os_sxline.cpp
+++ b/modules/commands/os_sxline.cpp
@@ -250,11 +250,8 @@ class CommandOSSNLine : public CommandOSSXLineBase
void OnAdd(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
- if (!this->xlm() || !IRCD->CanSNLine)
- {
- source.Reply(_("Your IRCd does not support SNLINE."));
+ if (!this->xlm())
return;
- }
unsigned last_param = 2;
Anope::string param, expiry;
@@ -386,17 +383,17 @@ class CommandOSSNLine : public CommandOSSXLineBase
if (Config->GetModule("operserv")->Get<bool>("killonsnline", "yes"))
{
- this->xlm()->Send(source.GetUser(), x);
-
Anope::string rreason = "G-Lined: " + reason;
for (user_map::const_iterator it = UserListByNick.begin(); it != UserListByNick.end(); ++it)
{
User *user = it->second;
- if (!user->HasMode("OPER") && user->server != Me && Anope::Match(user->realname, x->mask, false, true))
+ if (!user->HasMode("OPER") && user->server != Me && this->xlm()->Check(user, x))
user->Kill(Me->GetName(), rreason);
}
+
+ this->xlm()->Send(source.GetUser(), x);
}
source.Reply(_("\002%s\002 added to the %s list."), mask.c_str(), source.command.c_str());
@@ -477,11 +474,8 @@ class CommandOSSQLine : public CommandOSSXLineBase
void OnAdd(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
- if (!this->xlm() || !IRCD->CanSQLine)
- {
- source.Reply(_("Your IRCd does not support SQLINE."));
+ if (!this->xlm())
return;
- }
unsigned last_param = 2;
Anope::string expiry, mask;
@@ -626,7 +620,7 @@ class CommandOSSQLine : public CommandOSSXLineBase
{
User *user = it->second;
- if (!user->HasMode("OPER") && user->server != Me && Anope::Match(user->nick, x->mask, false, true))
+ if (!user->HasMode("OPER") && user->server != Me && this->xlm()->Check(user, x))
user->Kill(Me->GetName(), rreason);
}
}
diff --git a/modules/pseudoclients/operserv.cpp b/modules/pseudoclients/operserv.cpp
index a451813ef..c514536fa 100644
--- a/modules/pseudoclients/operserv.cpp
+++ b/modules/pseudoclients/operserv.cpp
@@ -100,12 +100,20 @@ class SQLineManager : public XLineManager
return Anope::Match(u->nick, x->mask);
}
- bool CheckChannel(Channel *c)
+ XLine *CheckChannel(Channel *c)
{
for (std::vector<XLine *>::const_iterator it = this->GetList().begin(), it_end = this->GetList().end(); it != it_end; ++it)
- if (Anope::Match(c->name, (*it)->mask, false, true))
- return true;
- return false;
+ {
+ XLine *x = *it;
+ if (x->regex)
+ {
+ if (x->regex->Matches(c->name))
+ return x;
+ }
+ else if (Anope::Match(c->name, x->mask, false, true))
+ return x;
+ }
+ return NULL;
}
};
@@ -238,7 +246,14 @@ class OperServCore : public Module
EventReturn OnCheckKick(User *u, ChannelInfo *ci, Anope::string &mask, Anope::string &reason) anope_override
{
- return this->sqlines.CheckChannel(ci->c) ? EVENT_STOP : EVENT_CONTINUE;
+ XLine *x = this->sqlines.CheckChannel(ci->c);
+ if (x)
+ {
+ this->sqlines.OnMatch(u, x);
+ return EVENT_STOP;
+ }
+
+ return EVENT_CONTINUE;
}
EventReturn OnPreHelp(CommandSource &source, const std::vector<Anope::string> &params) anope_override