mirror of
https://github.com/anope/anope.git
synced 2026-06-12 19:14:47 +02:00
Replace IRCDProto::CanSendTags with IsTagValid.
Not every IRC server accepts arbitrary tags so this is a better way to handle tag filtering.
This commit is contained in:
+1
-3
@@ -92,9 +92,6 @@ public:
|
||||
/* See ns_cert */
|
||||
bool CanCertFP = false;
|
||||
|
||||
/* Can we send arbitrary message tags? */
|
||||
bool CanSendTags = false;
|
||||
|
||||
/* Can users log out before being fully connected? */
|
||||
bool CanSVSLogout = false;
|
||||
|
||||
@@ -288,6 +285,7 @@ public:
|
||||
virtual bool IsIdentValid(const Anope::string &);
|
||||
virtual bool IsHostValid(const Anope::string &);
|
||||
virtual bool IsExtbanValid(const Anope::string &) { return false; }
|
||||
virtual bool IsTagValid(const Anope::string &, const Anope::string &) { return false; }
|
||||
|
||||
/** Retrieve the maximum number of list modes settable on this channel
|
||||
* Defaults to Config->ListSize
|
||||
|
||||
@@ -117,7 +117,6 @@ public:
|
||||
CanSVSHold = true;
|
||||
CanSVSLogout = true;
|
||||
CanCertFP = true;
|
||||
CanSendTags = true;
|
||||
RequiresID = true;
|
||||
MaxModes = 20;
|
||||
MaxLine = 4096;
|
||||
@@ -583,6 +582,12 @@ public:
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool IsTagValid(const Anope::string &name, const Anope::string &tvalue)
|
||||
{
|
||||
// InspIRCd accepts arbitrary message tags.
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
class InspIRCdAutoOpMode final
|
||||
|
||||
+10
-6
@@ -126,17 +126,21 @@ bool IRCDProto::Parse(const Anope::string &buffer, Anope::map<Anope::string> &ta
|
||||
bool IRCDProto::Format(Anope::string &message, const Anope::map<Anope::string> &tags, const MessageSource &source, const Anope::string &command, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
std::stringstream buffer;
|
||||
if (CanSendTags && !tags.empty())
|
||||
if (!tags.empty())
|
||||
{
|
||||
char separator = '@';
|
||||
for (const auto &[tname, tvalue] : tags)
|
||||
{
|
||||
buffer << separator << tname;
|
||||
if (!tvalue.empty())
|
||||
buffer << '=' << tvalue;
|
||||
separator = ';';
|
||||
if (IRCD->IsTagValid(tname, tvalue))
|
||||
{
|
||||
buffer << separator << tname;
|
||||
if (!tvalue.empty())
|
||||
buffer << '=' << tvalue;
|
||||
separator = ';';
|
||||
}
|
||||
}
|
||||
buffer << ' ';
|
||||
if (separator != '@')
|
||||
buffer << ' ';
|
||||
}
|
||||
|
||||
if (source.GetServer())
|
||||
|
||||
Reference in New Issue
Block a user