diff options
author | Matt Schatz <genius3000@g3k.solutions> | 2019-11-12 08:07:17 -0700 |
---|---|---|
committer | P. Powell <petpow@saberuk.com> | 2019-11-27 18:21:01 +0000 |
commit | f75c5011e2ec417f53892af643c4f7ffd00dcc7f (patch) | |
tree | 9a7d8439a58e4e525f411797c81a8323d538898c /modules/protocol/inspircd3.cpp | |
parent | 2832c736dd87060498af8298cb1037f2d4fd2797 (diff) |
Update IRCDMessageMetadata for channel metadata.
- InspIRCd 3 now includes the channel TS in any channel metadata.
This pushes the type and value by one.
- Update the messages sent from this function accordingly.
- Fix retrieval of TopicLock status.
Diffstat (limited to 'modules/protocol/inspircd3.cpp')
-rw-r--r-- | modules/protocol/inspircd3.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/modules/protocol/inspircd3.cpp b/modules/protocol/inspircd3.cpp index 2faaece99..49c26f505 100644 --- a/modules/protocol/inspircd3.cpp +++ b/modules/protocol/inspircd3.cpp @@ -1306,17 +1306,19 @@ class IRCDMessageMetadata : IRCDMessage const bool &do_mlock; public: - IRCDMessageMetadata(Module *creator, const bool &handle_topiclock, const bool &handle_mlock) : IRCDMessage(creator, "METADATA", 3), do_topiclock(handle_topiclock), do_mlock(handle_mlock) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } + IRCDMessageMetadata(Module *creator, const bool &handle_topiclock, const bool &handle_mlock) : IRCDMessage(creator, "METADATA", 3), do_topiclock(handle_topiclock), do_mlock(handle_mlock) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override { // We deliberately ignore non-bursting servers to avoid pseudoserver fights - if ((params[0][0] == '#') && (!source.GetServer()->IsSynced())) + // Channel METADATA has an additional parameter: the channel TS + // Received: :715 METADATA #chan 1572026333 mlock :nt + if ((params[0][0] == '#') && (params.size() > 3) && (!source.GetServer()->IsSynced())) { Channel *c = Channel::Find(params[0]); if (c && c->ci) { - if ((do_mlock) && (params[1] == "mlock")) + if ((do_mlock) && (params[2] == "mlock")) { ModeLocks *modelocks = c->ci->GetExt<ModeLocks>("modelocks"); Anope::string modes; @@ -1324,15 +1326,15 @@ class IRCDMessageMetadata : IRCDMessage modes = modelocks->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", ""); // Mode lock string is not what we say it is? - if (modes != params[2]) - UplinkSocket::Message(Me) << "METADATA " << c->name << " mlock :" << modes; + if (modes != params[3]) + UplinkSocket::Message(Me) << "METADATA " << c->name << " " << c->creation_time << " mlock :" << modes; } - else if ((do_topiclock) && (params[1] == "topiclock")) + else if ((do_topiclock) && (params[2] == "topiclock")) { - bool mystate = c->ci->GetExt<bool>("TOPICLOCK"); - bool serverstate = (params[2] == "1"); + bool mystate = c->ci->HasExt("TOPICLOCK"); + bool serverstate = (params[3] == "1"); if (mystate != serverstate) - UplinkSocket::Message(Me) << "METADATA " << c->name << " topiclock :" << (mystate ? "1" : ""); + UplinkSocket::Message(Me) << "METADATA " << c->name << " " << c->creation_time << " topiclock :" << (mystate ? "1" : ""); } } } |