summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/modules.h9
-rw-r--r--include/protocol.h5
-rw-r--r--modules/chanserv/cs_unban.cpp18
-rw-r--r--modules/protocol/unrealircd.cpp11
4 files changed, 26 insertions, 17 deletions
diff --git a/include/modules.h b/include/modules.h
index 048e28f9f..c1fd8d5a9 100644
--- a/include/modules.h
+++ b/include/modules.h
@@ -1079,13 +1079,6 @@ public:
* @return EVENT_STOP to force the user off of the nick
*/
virtual EventReturn OnNickValidate(User *u, NickAlias *na) { throw NotImplementedException(); }
-
- /** Called when a certain user has to be unbanned on a certain channel.
- * May be used to send protocol-specific messages.
- * @param u The user to be unbanned
- * @param c The channel that user has to be unbanned on
- */
- virtual void OnChannelUnban(User *u, ChannelInfo *ci) { throw NotImplementedException(); }
};
enum Implementation
@@ -1111,7 +1104,7 @@ enum Implementation
I_OnPrivmsg, I_OnLog, I_OnLogMessage, I_OnDnsRequest, I_OnCheckModes, I_OnChannelSync, I_OnSetCorrectModes,
I_OnSerializeCheck, I_OnSerializableConstruct, I_OnSerializableDestruct, I_OnSerializableUpdate,
I_OnSerializeTypeCreate, I_OnSetChannelOption, I_OnSetNickOption, I_OnMessage, I_OnCanSet, I_OnCheckDelete,
- I_OnExpireTick, I_OnNickValidate, I_OnChannelUnban,
+ I_OnExpireTick, I_OnNickValidate,
I_SIZE
};
diff --git a/include/protocol.h b/include/protocol.h
index 728988195..88bb94bfc 100644
--- a/include/protocol.h
+++ b/include/protocol.h
@@ -96,6 +96,9 @@ public:
/* If this IRCd has unique ids, whether the IDs and nicknames are ambiguous */
bool AmbiguousID = false;
+ /** Can we ask the server to unban a user? */
+ bool CanClearBans = false;
+
/* The maximum number of modes we are allowed to set with one MODE command */
unsigned MaxModes = 3;
@@ -271,6 +274,8 @@ public:
*/
virtual void SendOper(User *u);
+ virtual void SendClearBans(const MessageSource &user, Channel *c, User* u) { }
+
virtual void SendSASLMechanisms(std::vector<Anope::string> &) { }
virtual void SendSASLMessage(const SASL::Message &) { }
virtual void SendSVSLogin(const Anope::string &uid, NickAlias *na) { }
diff --git a/modules/chanserv/cs_unban.cpp b/modules/chanserv/cs_unban.cpp
index 5b08511b3..49495829b 100644
--- a/modules/chanserv/cs_unban.cpp
+++ b/modules/chanserv/cs_unban.cpp
@@ -44,7 +44,12 @@ public:
if (!ci->c || !(source.AccessFor(ci).HasPriv("UNBAN") || source.AccessFor(ci).HasPriv("UNBANME")))
continue;
- FOREACH_MOD(OnChannelUnban, (source.GetUser(), ci));
+ if (IRCD->CanClearBans)
+ {
+ IRCD->SendClearBans(ci->WhoSends(), ci->c, source.GetUser());
+ count++;
+ continue;
+ }
for (const auto *mode : modes)
if (ci->c->Unban(source.GetUser(), mode->name, true))
@@ -91,10 +96,15 @@ public:
bool override = !source.AccessFor(ci).HasPriv("UNBAN") && source.HasPriv("chanserv/kick");
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to unban " << u2->nick;
- FOREACH_MOD(OnChannelUnban, (u2, ci));
- for (const auto *mode : modes)
- ci->c->Unban(u2, mode->name, source.GetUser() == u2);
+ if (IRCD->CanClearBans)
+ IRCD->SendClearBans(ci->WhoSends(), ci->c, source.GetUser());
+ else
+ {
+ for (const auto *mode : modes)
+ ci->c->Unban(u2, mode->name, source.GetUser() == u2);
+ }
+
if (u2 == source.GetUser())
source.Reply(_("You have been unbanned from \002%s\002."), ci->c->name.c_str());
else
diff --git a/modules/protocol/unrealircd.cpp b/modules/protocol/unrealircd.cpp
index b8160d1b7..c218ded8a 100644
--- a/modules/protocol/unrealircd.cpp
+++ b/modules/protocol/unrealircd.cpp
@@ -35,6 +35,7 @@ public:
CanSQLineChannel = true;
CanSZLine = true;
CanSVSHold = true;
+ CanClearBans = true;
CanSVSLogout = true;
CanCertFP = true;
RequiresID = true;
@@ -438,6 +439,11 @@ private:
return true;
}
+
+ void SendClearBans(const MessageSource &user, Channel *c, User* u) override
+ {
+ Uplink::Send(user, "SVS2MODE", c->name, "-b", u->GetUID());
+ }
};
class UnrealExtBan
@@ -1805,11 +1811,6 @@ public:
return EVENT_CONTINUE;
}
-
- void OnChannelUnban(User *u, ChannelInfo *ci) override
- {
- Uplink::Send(ci->WhoSends(), "SVS2MODE", ci->c->name, "-b", u->GetUID());
- }
};
MODULE_INIT(ProtoUnreal)