From 3dd21e4dcd2946a2bdeb75dbcecb8d8d0695e35e Mon Sep 17 00:00:00 2001 From: attilamolnar Date: Sun, 7 Oct 2012 01:35:14 +0200 Subject: [PATCH] InspIRCd: Add support for server side topic locks using METADATA topiclock --- modules/protocol/inspircd20.cpp | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/modules/protocol/inspircd20.cpp b/modules/protocol/inspircd20.cpp index baacb5c64..04a23c104 100644 --- a/modules/protocol/inspircd20.cpp +++ b/modules/protocol/inspircd20.cpp @@ -570,23 +570,32 @@ class ProtoInspIRCd : public Module void OnChannelCreate(Channel *c) anope_override { - if (c->ci && Config->UseServerSideMLock) + if (c->ci && (Config->UseServerSideMLock || Config->UseServerSideTopicLock)) this->OnChanRegistered(c->ci); } void OnChanRegistered(ChannelInfo *ci) anope_override { - if (!Config->UseServerSideMLock) - return; - Anope::string modes = ci->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", ""); - SendChannelMetadata(ci->c, "mlock", modes); + if (Config->UseServerSideMLock) + { + Anope::string modes = ci->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", ""); + SendChannelMetadata(ci->c, "mlock", modes); + } + + if (Config->UseServerSideTopicLock && has_svstopic_topiclock) + { + Anope::string on = ci->HasFlag(CI_TOPICLOCK) ? "1" : ""; + SendChannelMetadata(ci->c, "topiclock", on); + } } void OnDelChan(ChannelInfo *ci) anope_override { - if (!Config->UseServerSideMLock) - return; - SendChannelMetadata(ci->c, "mlock", ""); + if (Config->UseServerSideMLock) + SendChannelMetadata(ci->c, "mlock", ""); + + if (Config->UseServerSideTopicLock && has_svstopic_topiclock) + SendChannelMetadata(ci->c, "topiclock", ""); } EventReturn OnMLock(ChannelInfo *ci, ModeLock *lock) anope_override