mirror of
https://github.com/anope/anope.git
synced 2026-07-09 02:23:13 +02:00
Fix toggling topiclock when the channel setting is changed
This commit is contained in:
@@ -15,12 +15,22 @@ class CommandCSTopic : public Command
|
||||
{
|
||||
void Lock(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
EventReturn MOD_RESULT;
|
||||
FOREACH_RESULT(I_OnSetChannelOption, OnSetChannelOption(source, this, ci, "topiclock on"));
|
||||
if (MOD_RESULT == EVENT_STOP)
|
||||
return;
|
||||
|
||||
ci->ExtendMetadata("TOPICLOCK");
|
||||
source.Reply(_("Topic lock option for %s is now \002on\002."), ci->name.c_str());
|
||||
}
|
||||
|
||||
void Unlock(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
EventReturn MOD_RESULT;
|
||||
FOREACH_RESULT(I_OnSetChannelOption, OnSetChannelOption(source, this, ci, "topiclock off"));
|
||||
if (MOD_RESULT == EVENT_STOP)
|
||||
return;
|
||||
|
||||
ci->Shrink("TOPICLOCK");
|
||||
source.Reply(_("Topic lock option for %s is now \002off\002."), ci->name.c_str());
|
||||
}
|
||||
|
||||
@@ -755,8 +755,14 @@ class ProtoInspIRCd : public Module
|
||||
|
||||
EventReturn OnSetChannelOption(CommandSource &source, Command *cmd, ChannelInfo *ci, const Anope::string &setting) anope_override
|
||||
{
|
||||
if (cmd->name == "chanserv/set/topiclock" && ci->c)
|
||||
SendChannelMetadata(ci->c, "topiclock", setting.equals_ci("ON") ? "1" : "");
|
||||
if (cmd->name == "chanserv/topic" && ci->c)
|
||||
{
|
||||
|
||||
if (setting == "topiclock on")
|
||||
SendChannelMetadata(ci->c, "topiclock", "1");
|
||||
else if (setting == "topiclock off")
|
||||
SendChannelMetadata(ci->c, "topiclock", "0");
|
||||
}
|
||||
|
||||
return EVENT_CONTINUE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user