diff options
| author | Sadie Powell <sadie@witchery.services> | 2024-02-27 13:38:20 +0000 |
|---|---|---|
| committer | Sadie Powell <sadie@witchery.services> | 2024-02-27 13:40:47 +0000 |
| commit | 9c80f9e34ef92e9344959ab81d20f2161b1e018c (patch) | |
| tree | dab0cdec39c82b59d437df6758a7480526e5def7 /modules | |
| parent | b5b3c744778ed0cbceb03f2f8dbbec33d2fd0e94 (diff) | |
Replace OnChannelUnban with an IRCDProto function.
This was added for (and is only used for) for unbanning users on
UnrealIRCd which is an IRCd protocol function so it should be in
IRCDProto.
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/chanserv/cs_unban.cpp | 18 | ||||
| -rw-r--r-- | modules/protocol/unrealircd.cpp | 11 |
2 files changed, 20 insertions, 9 deletions
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) |
