1
0
mirror of https://github.com/anope/anope.git synced 2026-07-09 00:23:13 +02:00

Implement support for the IRCv3 +draft/channel-context tag.

Closes #358.
This commit is contained in:
Sadie Powell
2024-02-26 15:16:01 +00:00
parent 83dd96b9f2
commit e341cac8d6
3 changed files with 26 additions and 3 deletions
+3
View File
@@ -194,6 +194,9 @@ public:
virtual void SendGlobalNotice(BotInfo *bi, const Server *dest, const Anope::string &msg) = 0;
virtual void SendGlobalPrivmsg(BotInfo *bi, const Server *desc, const Anope::string &msg) = 0;
virtual void SendContextNotice(BotInfo *bi, User *target, Channel *context, const Anope::string &msg);
virtual void SendContextPrivmsg(BotInfo *bi, User *target, Channel *context, const Anope::string &msg);
virtual void SendQuit(User *u, const char *fmt, ...) ATTR_FORMAT(3, 4);
virtual void SendPing(const Anope::string &servname, const Anope::string &who);
virtual void SendPong(const Anope::string &servname, const Anope::string &who);
+9 -3
View File
@@ -283,10 +283,16 @@ public:
if (u && c && c->ci && u->server->IsSynced())
{
EntryMessageList *messages = c->ci->GetExt<EntryMessageList>("entrymsg");
if (!messages)
return;
if (messages != NULL)
for (const auto &message : *(*messages))
u->SendMessage(c->ci->WhoSends(), "[%s] %s", c->ci->name.c_str(), message->message.c_str());
for (const auto &message : *(*messages))
{
if (u->ShouldPrivmsg())
IRCD->SendContextPrivmsg(c->ci->WhoSends(), u, c, message->message);
else
IRCD->SendContextNotice(c->ci->WhoSends(), u, c, message->message);
}
}
}
};
+14
View File
@@ -411,6 +411,20 @@ Anope::string IRCDProto::NormalizeMask(const Anope::string &mask)
return Entry("", mask).GetNUHMask();
}
void IRCDProto::SendContextNotice(BotInfo *bi, User *target, Channel *context, const Anope::string &msg)
{
IRCD->SendNoticeInternal(bi, target->GetUID(), Anope::printf("[%s] %s", context->name.c_str(), msg.c_str()), {
{ "+draft/channel-context", context->name },
});
}
void IRCDProto::SendContextPrivmsg(BotInfo *bi, User *target, Channel *context, const Anope::string &msg)
{
IRCD->SendPrivmsgInternal(bi, target->GetUID(), Anope::printf("[%s] %s", context->name.c_str(), msg.c_str()), {
{ "+draft/channel-context", context->name },
});
}
size_t IRCDProto::GetMaxChannel()
{
// We can cache this as its not allowed to change on rehash.