summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/commands/cs_akick.cpp38
-rw-r--r--modules/commands/cs_set.cpp13
-rw-r--r--modules/commands/cs_suspend.cpp11
-rw-r--r--modules/commands/ns_resetpass.cpp8
4 files changed, 67 insertions, 3 deletions
diff --git a/modules/commands/cs_akick.cpp b/modules/commands/cs_akick.cpp
index 52d0ecd76..28bc54857 100644
--- a/modules/commands/cs_akick.cpp
+++ b/modules/commands/cs_akick.cpp
@@ -502,6 +502,44 @@ class CSAKick : public Module
{
this->SetAuthor("Anope");
+ Implementation i[] = { I_OnCheckKick };
+ ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation));
+ }
+
+ EventReturn OnCheckKick(User *u, ChannelInfo *ci, Anope::string &mask, Anope::string &reason) anope_override
+ {
+ if (ci->c->MatchesList(u, CMODE_EXCEPT))
+ return EVENT_CONTINUE;
+
+ for (unsigned j = 0, end = ci->GetAkickCount(); j < end; ++j)
+ {
+ AutoKick *autokick = ci->GetAkick(j);
+ bool kick = false;
+
+ if (autokick->HasFlag(AK_ISNICK))
+ {
+ if (autokick->nc == u->Account())
+ kick = true;
+ }
+ else
+ {
+ Entry akick_mask(CMODE_BEGIN, autokick->mask);
+ if (akick_mask.Matches(u))
+ kick = true;
+ }
+
+ if (kick)
+ {
+ Log(LOG_DEBUG_2) << u->nick << " matched akick " << (autokick->HasFlag(AK_ISNICK) ? autokick->nc->display : autokick->mask);
+ autokick->last_used = Anope::CurTime;
+ if (!autokick->HasFlag(AK_ISNICK))
+ mask = autokick->mask;
+ reason = autokick->reason.empty() ? Config->CSAutokickReason : autokick->reason;
+ return EVENT_STOP;
+ }
+ }
+
+ return EVENT_CONTINUE;
}
};
diff --git a/modules/commands/cs_set.cpp b/modules/commands/cs_set.cpp
index 5ac235c8f..48cad51af 100644
--- a/modules/commands/cs_set.cpp
+++ b/modules/commands/cs_set.cpp
@@ -1166,7 +1166,7 @@ class CSSet : public Module
{
this->SetAuthor("Anope");
- Implementation i[] = { I_OnReload, I_OnChanRegistered };
+ Implementation i[] = { I_OnReload, I_OnChanRegistered, I_OnCheckKick };
ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation));
this->OnReload();
@@ -1183,6 +1183,17 @@ class CSSet : public Module
if (CSDefChanstats)
ci->SetFlag(CI_STATS);
}
+
+ EventReturn OnCheckKick(User *u, ChannelInfo *ci, Anope::string &mask, Anope::string &reason) anope_override
+ {
+ if (!ci->HasFlag(CI_RESTRICTED) || ci->c->MatchesList(u, CMODE_EXCEPT))
+ return EVENT_CONTINUE;
+
+ if (ci->AccessFor(u).empty() && (!ci->GetFounder() || u->Account() != ci->GetFounder()))
+ return EVENT_STOP;
+
+ return EVENT_CONTINUE;
+ }
};
MODULE_INIT(CSSet)
diff --git a/modules/commands/cs_suspend.cpp b/modules/commands/cs_suspend.cpp
index 4f840f576..f97f761cb 100644
--- a/modules/commands/cs_suspend.cpp
+++ b/modules/commands/cs_suspend.cpp
@@ -216,7 +216,7 @@ class CSSuspend : public Module
{
this->SetAuthor("Anope");
- Implementation i[] = { I_OnPreChanExpire };
+ Implementation i[] = { I_OnPreChanExpire, I_OnCheckKick };
ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation));
}
@@ -250,6 +250,15 @@ class CSSuspend : public Module
Log(LOG_NORMAL, "expire", ChanServ) << "Expiring suspend for " << ci->name;
}
}
+
+ EventReturn OnCheckKick(User *u, ChannelInfo *ci, Anope::string &mask, Anope::string &reason) anope_override
+ {
+ if (u->HasMode(UMODE_OPER) || !ci->HasFlag(CI_SUSPENDED))
+ return EVENT_CONTINUE;
+
+ reason = Language::Translate(u, _("This channel may not be used."));
+ return EVENT_STOP;
+ }
};
MODULE_INIT(CSSuspend)
diff --git a/modules/commands/ns_resetpass.cpp b/modules/commands/ns_resetpass.cpp
index 39eead56e..fb4fb4ae9 100644
--- a/modules/commands/ns_resetpass.cpp
+++ b/modules/commands/ns_resetpass.cpp
@@ -29,7 +29,7 @@ class CommandNSResetPass : public Command
{
const NickAlias *na;
- if (Config->RestrictMail && source.HasCommand("nickserv/resetpass"))
+ if (Config->RestrictMail && !source.HasCommand("nickserv/resetpass"))
source.Reply(ACCESS_DENIED);
else if (!(na = NickAlias::Find(params[0])))
source.Reply(NICK_X_NOT_REGISTERED, params[0].c_str());
@@ -78,6 +78,12 @@ class NSResetPass : public Module
ModuleManager::Attach(I_OnPreCommand, this);
}
+ ~NSResetPass()
+ {
+ for (nickcore_map::const_iterator it = NickCoreList->begin(), it_end = NickCoreList->end(); it != it_end; ++it)
+ it->second->Shrink("ns_resetpass");
+ }
+
EventReturn OnPreCommand(CommandSource &source, Command *command, std::vector<Anope::string> &params) anope_override
{
if (command->name == "nickserv/confirm" && params.size() > 1)