summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorattilamolnar <attilamolnar@hush.com>2012-10-07 01:35:14 +0200
committerattilamolnar <attilamolnar@hush.com>2012-10-07 01:35:14 +0200
commit3dd21e4dcd2946a2bdeb75dbcecb8d8d0695e35e (patch)
treec80961bd44a62ce2086fa9cfd01bf33fbeeb2c70
parent682d76835e0713ba00fee1a6013903f5ce99b801 (diff)
InspIRCd: Add support for server side topic locks using METADATA topiclock
-rw-r--r--modules/protocol/inspircd20.cpp25
1 files 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