summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/anope.h4
-rw-r--r--modules/commands/os_forbid.cpp29
-rw-r--r--modules/pseudoclients/operserv.cpp6
3 files changed, 35 insertions, 4 deletions
diff --git a/include/anope.h b/include/anope.h
index 03bb2418d..972e49b7f 100644
--- a/include/anope.h
+++ b/include/anope.h
@@ -225,7 +225,7 @@ namespace Anope
inline string replace(iterator first, iterator last, const string &_str) { return string(this->_string.replace(first, last, _str._string)); }
inline string replace(iterator first, iterator last, size_type n, char chr) { return string(this->_string.replace(first, last, n, chr)); }
template <class InputIterator> inline string replace(iterator first, iterator last, InputIterator f, InputIterator l) { return string(this->_string.replace(first, last, f, l)); }
- inline string replace_all_cs(const string &_orig, const string &_repl)
+ inline string replace_all_cs(const string &_orig, const string &_repl) const
{
Anope::string new_string = *this;
size_type pos = new_string.find(_orig), orig_length = _orig.length(), repl_length = _repl.length();
@@ -236,7 +236,7 @@ namespace Anope
}
return new_string;
}
- inline string replace_all_ci(const string &_orig, const string &_repl)
+ inline string replace_all_ci(const string &_orig, const string &_repl) const
{
Anope::string new_string = *this;
size_type pos = new_string.find_ci(_orig), orig_length = _orig.length(), repl_length = _repl.length();
diff --git a/modules/commands/os_forbid.cpp b/modules/commands/os_forbid.cpp
index 866b2248a..0099348b0 100644
--- a/modules/commands/os_forbid.cpp
+++ b/modules/commands/os_forbid.cpp
@@ -126,6 +126,12 @@ class CommandOSForbid : public Command
reason += params[4];
reason.trim();
+ if (entry.replace_all_cs("?*", "").empty())
+ {
+ source.Reply(_("The mask must contain at least one non wildcard character."));
+ return;
+ }
+
time_t expiryt = 0;
if (!expiry.empty())
@@ -170,6 +176,9 @@ class CommandOSForbid : public Command
module->OnUserNickChange(it->second, "");
break;
case FT_CHAN:
+ {
+ int chan_matches = 0, ci_matches = 0;
+
for (channel_map::const_iterator it = ChannelList.begin(), it_end = ChannelList.end(); it != it_end;)
{
Channel *c = it->second;
@@ -192,6 +201,8 @@ class CommandOSForbid : public Command
chanserv->Hold(c);
}
+ ++chan_matches;
+
for (Channel::ChanUserList::const_iterator cit = c->users.begin(), cit_end = c->users.end(); cit != cit_end;)
{
User *u = cit->first;
@@ -208,7 +219,25 @@ class CommandOSForbid : public Command
c->Kick(source.service, u, "%s", reason.c_str());
}
}
+
+ for (registered_channel_map::const_iterator it = RegisteredChannelList->begin(); it != RegisteredChannelList->end();)
+ {
+ ChannelInfo *ci = it->second;
+ ++it;
+
+ d = this->fs->FindForbid(ci->name, FT_CHAN);
+ if (d == NULL)
+ continue;
+
+ ++ci_matches;
+
+ delete ci;
+ }
+
+ source.Reply(_("\2%d\2 channels cleared, and \2%d\2 channels dropped."), chan_matches, ci_matches);
+
break;
+ }
default:
break;
}
diff --git a/modules/pseudoclients/operserv.cpp b/modules/pseudoclients/operserv.cpp
index ddd585841..cdc74c470 100644
--- a/modules/pseudoclients/operserv.cpp
+++ b/modules/pseudoclients/operserv.cpp
@@ -68,8 +68,10 @@ class SGLineManager : public XLineManager
class SQLineManager : public XLineManager
{
+ ServiceReference<NickServService> nickserv;
+
public:
- SQLineManager(Module *creator) : XLineManager(creator, "xlinemanager/sqline", 'Q') { }
+ SQLineManager(Module *creator) : XLineManager(creator, "xlinemanager/sqline", 'Q'), nickserv("NickServService", "NickServ") { }
void OnMatch(User *u, XLine *x) anope_override
{
@@ -248,7 +250,7 @@ class OperServCore : public Module
void OnUserNickChange(User *u, const Anope::string &oldnick) anope_override
{
- if (IRCD->CanSQLine && !u->HasMode("OPER"))
+ if (!u->HasMode("OPER"))
this->sqlines.CheckAllXLines(u);
}