mirror of
https://github.com/anope/anope.git
synced 2026-07-02 16:13:12 +02:00
Allow clearing other list modes using ClearBans.
This commit is contained in:
@@ -268,9 +268,13 @@ public:
|
||||
IRCDProto::SendContextPrivmsg(bi, target, context, msg);
|
||||
}
|
||||
|
||||
void SendClearBans(const MessageSource &user, Channel *c, User* u) override
|
||||
void SendClearModes(const MessageSource &user, Channel *c, User* u, const Anope::string &mode) override
|
||||
{
|
||||
Uplink::Send(user, "SVSCMODE", u->GetUID(), c->name, 'b');
|
||||
auto *cm = ModeManager::FindChannelModeByName(mode);
|
||||
if (!cm || !cm->mchar)
|
||||
return;
|
||||
|
||||
Uplink::Send(user, "SVSCMODE", u->GetUID(), c->name, cm->mchar);
|
||||
}
|
||||
|
||||
void SendQuit(User *u, const Anope::string &buf, const Anope::string &operbuf) override
|
||||
@@ -1194,7 +1198,7 @@ struct IRCDMessageCapab final
|
||||
throw ProtocolException("Protocol mismatch, no or invalid protocol version given in CAPAB START.");
|
||||
|
||||
Servers::Capab.clear();
|
||||
IRCD->CanClearBans = false;
|
||||
IRCD->CanClearModes.clear();
|
||||
IRCD->CanSQLineChannel = false;
|
||||
IRCD->CanSVSHold = false;
|
||||
IRCD->CanTagMessage = false;
|
||||
@@ -1522,7 +1526,6 @@ struct IRCDMessageCapab final
|
||||
|
||||
else if (modname.equals_cs("services"))
|
||||
{
|
||||
IRCD->CanClearBans = true;
|
||||
IRCD->CanSVSHold = true;
|
||||
Servers::Capab.insert("SERVICES");
|
||||
Servers::Capab.insert("TOPICLOCK");
|
||||
@@ -1630,6 +1633,12 @@ struct IRCDMessageCapab final
|
||||
|
||||
if (!Servers::Capab.count("SERVICES"))
|
||||
throw ProtocolException("The services module is not loaded. This is required by Anope.");
|
||||
|
||||
for (auto *cm : ModeManager::GetChannelModes())
|
||||
{
|
||||
if (cm->type == MODE_LIST && cm->mchar)
|
||||
IRCD->CanClearModes.insert(cm->name);
|
||||
}
|
||||
}
|
||||
|
||||
if (!ModeManager::FindUserModeByName("PRIV"))
|
||||
|
||||
@@ -59,7 +59,7 @@ public:
|
||||
CanSQLineChannel = true;
|
||||
CanSZLine = true;
|
||||
CanSVSHold = true;
|
||||
CanClearBans = true;
|
||||
CanClearModes.insert("BAN");
|
||||
CanCertFP = true;
|
||||
CanTagMessage = true;
|
||||
RequiresID = true;
|
||||
@@ -456,9 +456,13 @@ private:
|
||||
return true;
|
||||
}
|
||||
|
||||
void SendClearBans(const MessageSource &user, Channel *c, User* u) override
|
||||
void SendClearModes(const MessageSource &user, Channel *c, User* u, const Anope::string &mode) override
|
||||
{
|
||||
Uplink::Send(user, "SVS2MODE", c->name, "-b", u->GetUID());
|
||||
auto *cm = ModeManager::FindChannelModeByName(mode);
|
||||
if (!cm || !cm->mchar)
|
||||
return;
|
||||
|
||||
Uplink::Send(user, "SVS2MODE", c->name, Anope::printf("-%c", cm->mchar), u->GetUID());
|
||||
}
|
||||
|
||||
bool IsTagValid(const Anope::string &tname, const Anope::string &tvalue) override
|
||||
|
||||
Reference in New Issue
Block a user