diff options
author | Sadie Powell <sadie@witchery.services> | 2024-02-26 15:44:36 +0000 |
---|---|---|
committer | Sadie Powell <sadie@witchery.services> | 2024-02-26 15:50:35 +0000 |
commit | 57674f5869a216e0ffc8a7c9cb59f86d1bae1f88 (patch) | |
tree | e83abffe6aa40a091fdd7e2cb1f170731e1c9d71 /src | |
parent | c6cb4ba159a8916243d7ac5a5c4e8d13942baf99 (diff) |
Replace IRCDProto::CanSendTags with IsTagValid.
Not every IRC server accepts arbitrary tags so this is a better
way to handle tag filtering.
Diffstat (limited to 'src')
-rw-r--r-- | src/process.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/process.cpp b/src/process.cpp index a81340250..4ba0e23f0 100644 --- a/src/process.cpp +++ b/src/process.cpp @@ -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()) |