From eff61c7a9708013f9617282c4f327bbe2b1bfb79 Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 5 Oct 2012 05:03:55 -0400 Subject: [PATCH] Add an event for when nick or channel options are set --- include/modules.h | 29 +++++++++++++++++------ modules/commands/cs_set_autoop.cpp | 7 +++++- modules/commands/cs_set_bantype.cpp | 7 +++++- modules/commands/cs_set_chanstats.cpp | 7 +++++- modules/commands/cs_set_description.cpp | 7 +++++- modules/commands/cs_set_founder.cpp | 7 +++++- modules/commands/cs_set_keeptopic.cpp | 7 +++++- modules/commands/cs_set_misc.cpp | 8 ++++++- modules/commands/cs_set_peace.cpp | 6 ++++- modules/commands/cs_set_persist.cpp | 7 +++++- modules/commands/cs_set_private.cpp | 7 +++++- modules/commands/cs_set_restricted.cpp | 7 +++++- modules/commands/cs_set_secure.cpp | 7 +++++- modules/commands/cs_set_securefounder.cpp | 6 ++++- modules/commands/cs_set_secureops.cpp | 7 +++++- modules/commands/cs_set_signkick.cpp | 7 +++++- modules/commands/cs_set_successor.cpp | 22 +++++++++++------ modules/commands/cs_set_topiclock.cpp | 7 +++++- modules/commands/ns_set_autoop.cpp | 5 ++++ modules/commands/ns_set_chanstats.cpp | 5 ++++ modules/commands/ns_set_display.cpp | 5 ++++ modules/commands/ns_set_email.cpp | 5 ++++ modules/commands/ns_set_greet.cpp | 5 ++++ modules/commands/ns_set_hide.cpp | 5 ++++ modules/commands/ns_set_kill.cpp | 5 ++++ modules/commands/ns_set_language.cpp | 5 ++++ modules/commands/ns_set_message.cpp | 5 ++++ modules/commands/ns_set_misc.cpp | 5 ++++ modules/commands/ns_set_private.cpp | 5 ++++ modules/commands/ns_set_secure.cpp | 5 ++++ 30 files changed, 192 insertions(+), 30 deletions(-) diff --git a/include/modules.h b/include/modules.h index 9d3d701e3..4b992a15d 100644 --- a/include/modules.h +++ b/include/modules.h @@ -931,6 +931,24 @@ class CoreExport Module : public Extensible virtual void OnSerializableDestruct(Serializable *) { } virtual void OnSerializePtrAssign(Serializable *) { } virtual void OnSerializableUpdate(Serializable *) { } + + /** Called when a chanserv/set command is used + * @param source The source of the command + * @param cmd The command + * @param ci The channel the command was used on + * @param setting The setting passed to the command. Probably ON/OFF. + * @return EVENT_ALLOW to bypass access checks, EVENT_STOP to halt immediately. + */ + virtual EventReturn OnSetChannelOption(CommandSource &source, Command *cmd, ChannelInfo *ci, const Anope::string &setting) { return EVENT_CONTINUE; } + + /** Called when a nickserv/set command is used. + * @param source The source of the command + * @param cmd The command + * @param nc The nickcore being modifed + * @param setting The setting passed to the command. Probably ON/OFF. + * @return EVENT_STOP to halt immediately + */ + virtual EventReturn OnSetNickOption(CommandSource &source, Command *cmd, NickCore *nc, const Anope::string &setting) { return EVENT_CONTINUE; } }; /** Implementation-specific flags which may be set in ModuleManager::Attach() @@ -940,18 +958,15 @@ enum Implementation I_BEGIN, /* NickServ */ I_OnPreNickExpire, I_OnNickExpire, I_OnNickForbidden, I_OnNickGroup, I_OnNickLogout, I_OnNickIdentify, I_OnNickDrop, - I_OnNickRegister, I_OnNickSuspended, I_OnNickUnsuspended, - I_OnDelNick, I_OnDelCore, I_OnChangeCoreDisplay, - I_OnNickClearAccess, I_OnNickAddAccess, I_OnNickEraseAccess, - I_OnNickClearCert, I_OnNickAddCert, I_OnNickEraseCert, - I_OnNickInfo, I_OnCheckAuthentication, - I_OnNickUpdate, + I_OnNickRegister, I_OnNickSuspended, I_OnNickUnsuspended, I_OnDelNick, I_OnDelCore, I_OnChangeCoreDisplay, + I_OnNickClearAccess, I_OnNickAddAccess, I_OnNickEraseAccess, I_OnNickClearCert, I_OnNickAddCert, I_OnNickEraseCert, + I_OnNickInfo, I_OnCheckAuthentication, I_OnNickUpdate, I_OnSetNickOption, /* ChanServ */ I_OnChanSuspend, I_OnChanDrop, I_OnPreChanExpire, I_OnChanExpire, I_OnAccessAdd, I_OnAccessDel, I_OnAccessClear, I_OnLevelChange, I_OnChanRegistered, I_OnChanUnsuspend, I_OnCreateChan, I_OnDelChan, I_OnChannelCreate, I_OnChannelDelete, I_OnAkickAdd, I_OnAkickDel, I_OnCheckKick, I_OnCheckModes, - I_OnChanInfo, I_OnCheckPriv, I_OnGroupCheckPriv, + I_OnChanInfo, I_OnCheckPriv, I_OnGroupCheckPriv, I_OnSetChannelOption, /* BotServ */ I_OnBotJoin, I_OnBotKick, I_OnBotCreate, I_OnBotChange, I_OnBotDelete, I_OnBotAssign, I_OnBotUnAssign, diff --git a/modules/commands/cs_set_autoop.cpp b/modules/commands/cs_set_autoop.cpp index ee0b0433e..8e576be3d 100644 --- a/modules/commands/cs_set_autoop.cpp +++ b/modules/commands/cs_set_autoop.cpp @@ -31,7 +31,12 @@ class CommandCSSetAutoOp : public Command return; } - if (source.permission.empty() && !source.AccessFor(ci).HasPriv("SET")) + EventReturn MOD_RESULT; + FOREACH_RESULT(I_OnSetChannelOption, OnSetChannelOption(source, this, ci, params[1])); + if (MOD_RESULT == EVENT_STOP) + return; + + if (MOD_RESULT != EVENT_ALLOW && source.permission.empty() && !source.AccessFor(ci).HasPriv("SET")) { source.Reply(ACCESS_DENIED); return; diff --git a/modules/commands/cs_set_bantype.cpp b/modules/commands/cs_set_bantype.cpp index 8335a0e83..a963720ff 100644 --- a/modules/commands/cs_set_bantype.cpp +++ b/modules/commands/cs_set_bantype.cpp @@ -31,7 +31,12 @@ class CommandCSSetBanType : public Command return; } - if (source.permission.empty() && !source.AccessFor(ci).HasPriv("SET")) + EventReturn MOD_RESULT; + FOREACH_RESULT(I_OnSetChannelOption, OnSetChannelOption(source, this, ci, params[1])); + if (MOD_RESULT == EVENT_STOP) + return; + + if (MOD_RESULT != EVENT_ALLOW && source.permission.empty() && !source.AccessFor(ci).HasPriv("SET")) { source.Reply(ACCESS_DENIED); return; diff --git a/modules/commands/cs_set_chanstats.cpp b/modules/commands/cs_set_chanstats.cpp index 02fa9dad9..904d7fb22 100644 --- a/modules/commands/cs_set_chanstats.cpp +++ b/modules/commands/cs_set_chanstats.cpp @@ -31,7 +31,12 @@ class CommandCSSetChanstats : public Command return; } - if (source.permission.empty() && !source.AccessFor(ci).HasPriv("SET")) + EventReturn MOD_RESULT; + FOREACH_RESULT(I_OnSetChannelOption, OnSetChannelOption(source, this, ci, params[1])); + if (MOD_RESULT == EVENT_STOP) + return; + + if (MOD_RESULT != EVENT_ALLOW && source.permission.empty() && !source.AccessFor(ci).HasPriv("SET")) { source.Reply(ACCESS_DENIED); return; diff --git a/modules/commands/cs_set_description.cpp b/modules/commands/cs_set_description.cpp index 5ada5e036..b72c2cf8e 100644 --- a/modules/commands/cs_set_description.cpp +++ b/modules/commands/cs_set_description.cpp @@ -31,7 +31,12 @@ class CommandCSSetDescription : public Command return; } - if (source.permission.empty() && !source.AccessFor(ci).HasPriv("SET")) + EventReturn MOD_RESULT; + FOREACH_RESULT(I_OnSetChannelOption, OnSetChannelOption(source, this, ci, params[1])); + if (MOD_RESULT == EVENT_STOP) + return; + + if (MOD_RESULT != EVENT_ALLOW && source.permission.empty() && !source.AccessFor(ci).HasPriv("SET")) { source.Reply(ACCESS_DENIED); return; diff --git a/modules/commands/cs_set_founder.cpp b/modules/commands/cs_set_founder.cpp index 8c9b5ba0c..a1be1ba91 100644 --- a/modules/commands/cs_set_founder.cpp +++ b/modules/commands/cs_set_founder.cpp @@ -31,7 +31,12 @@ class CommandCSSetFounder : public Command return; } - if (source.permission.empty() && !source.AccessFor(ci).HasPriv("SET")) + EventReturn MOD_RESULT; + FOREACH_RESULT(I_OnSetChannelOption, OnSetChannelOption(source, this, ci, params[1])); + if (MOD_RESULT == EVENT_STOP) + return; + + if (MOD_RESULT != EVENT_ALLOW && source.permission.empty() && !source.AccessFor(ci).HasPriv("SET")) { source.Reply(ACCESS_DENIED); return; diff --git a/modules/commands/cs_set_keeptopic.cpp b/modules/commands/cs_set_keeptopic.cpp index a3d746301..1aeedfa0a 100644 --- a/modules/commands/cs_set_keeptopic.cpp +++ b/modules/commands/cs_set_keeptopic.cpp @@ -31,7 +31,12 @@ class CommandCSSetKeepTopic : public Command return; } - if (source.permission.empty() && !source.AccessFor(ci).HasPriv("SET")) + EventReturn MOD_RESULT; + FOREACH_RESULT(I_OnSetChannelOption, OnSetChannelOption(source, this, ci, params[1])); + if (MOD_RESULT == EVENT_STOP) + return; + + if (MOD_RESULT != EVENT_ALLOW && source.permission.empty() && !source.AccessFor(ci).HasPriv("SET")) { source.Reply(ACCESS_DENIED); return; diff --git a/modules/commands/cs_set_misc.cpp b/modules/commands/cs_set_misc.cpp index 251a2b480..b5a01174e 100644 --- a/modules/commands/cs_set_misc.cpp +++ b/modules/commands/cs_set_misc.cpp @@ -81,7 +81,13 @@ class CommandCSSetMisc : public Command source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); return; } - else if (source.permission.empty() && !source.AccessFor(ci).HasPriv("SET")) + + EventReturn MOD_RESULT; + FOREACH_RESULT(I_OnSetChannelOption, OnSetChannelOption(source, this, ci, params[1])); + if (MOD_RESULT == EVENT_STOP) + return; + + if (MOD_RESULT != EVENT_ALLOW && source.permission.empty() && !source.AccessFor(ci).HasPriv("SET")) { source.Reply(ACCESS_DENIED); return; diff --git a/modules/commands/cs_set_peace.cpp b/modules/commands/cs_set_peace.cpp index 977c3a095..889a0c6ae 100644 --- a/modules/commands/cs_set_peace.cpp +++ b/modules/commands/cs_set_peace.cpp @@ -30,8 +30,12 @@ class CommandCSSetPeace : public Command source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); return; } + EventReturn MOD_RESULT; + FOREACH_RESULT(I_OnSetChannelOption, OnSetChannelOption(source, this, ci, params[1])); + if (MOD_RESULT == EVENT_STOP) + return; - if (source.permission.empty() && !source.AccessFor(ci).HasPriv("SET")) + if (MOD_RESULT != EVENT_ALLOW && source.permission.empty() && !source.AccessFor(ci).HasPriv("SET")) { source.Reply(ACCESS_DENIED); return; diff --git a/modules/commands/cs_set_persist.cpp b/modules/commands/cs_set_persist.cpp index 81b5611d8..bdd3b9004 100644 --- a/modules/commands/cs_set_persist.cpp +++ b/modules/commands/cs_set_persist.cpp @@ -31,7 +31,12 @@ class CommandCSSetPersist : public Command return; } - if (source.permission.empty() && !source.AccessFor(ci).HasPriv("SET")) + EventReturn MOD_RESULT; + FOREACH_RESULT(I_OnSetChannelOption, OnSetChannelOption(source, this, ci, params[1])); + if (MOD_RESULT == EVENT_STOP) + return; + + if (MOD_RESULT != EVENT_ALLOW && source.permission.empty() && !source.AccessFor(ci).HasPriv("SET")) { source.Reply(ACCESS_DENIED); return; diff --git a/modules/commands/cs_set_private.cpp b/modules/commands/cs_set_private.cpp index b912779ff..37a5dbbc9 100644 --- a/modules/commands/cs_set_private.cpp +++ b/modules/commands/cs_set_private.cpp @@ -31,7 +31,12 @@ class CommandCSSetPrivate : public Command return; } - if (source.permission.empty() && !source.AccessFor(ci).HasPriv("SET")) + EventReturn MOD_RESULT; + FOREACH_RESULT(I_OnSetChannelOption, OnSetChannelOption(source, this, ci, params[1])); + if (MOD_RESULT == EVENT_STOP) + return; + + if (MOD_RESULT != EVENT_ALLOW && source.permission.empty() && !source.AccessFor(ci).HasPriv("SET")) { source.Reply(ACCESS_DENIED); return; diff --git a/modules/commands/cs_set_restricted.cpp b/modules/commands/cs_set_restricted.cpp index 736f29683..8b520006a 100644 --- a/modules/commands/cs_set_restricted.cpp +++ b/modules/commands/cs_set_restricted.cpp @@ -30,7 +30,12 @@ class CommandCSSetRestricted : public Command return; } - if (source.permission.empty() && !source.AccessFor(ci).HasPriv("SET")) + EventReturn MOD_RESULT; + FOREACH_RESULT(I_OnSetChannelOption, OnSetChannelOption(source, this, ci, params[1])); + if (MOD_RESULT == EVENT_STOP) + return; + + if (MOD_RESULT != EVENT_ALLOW && source.permission.empty() && !source.AccessFor(ci).HasPriv("SET")) { source.Reply(ACCESS_DENIED); return; diff --git a/modules/commands/cs_set_secure.cpp b/modules/commands/cs_set_secure.cpp index 9a8f96939..84ea75121 100644 --- a/modules/commands/cs_set_secure.cpp +++ b/modules/commands/cs_set_secure.cpp @@ -31,7 +31,12 @@ class CommandCSSetSecure : public Command return; } - if (source.permission.empty() && !source.AccessFor(ci).HasPriv("SET")) + EventReturn MOD_RESULT; + FOREACH_RESULT(I_OnSetChannelOption, OnSetChannelOption(source, this, ci, params[1])); + if (MOD_RESULT == EVENT_STOP) + return; + + if (MOD_RESULT != EVENT_ALLOW && source.permission.empty() && !source.AccessFor(ci).HasPriv("SET")) { source.Reply(ACCESS_DENIED); return; diff --git a/modules/commands/cs_set_securefounder.cpp b/modules/commands/cs_set_securefounder.cpp index b1c6e5b52..b8d7ac14f 100644 --- a/modules/commands/cs_set_securefounder.cpp +++ b/modules/commands/cs_set_securefounder.cpp @@ -31,8 +31,12 @@ class CommandCSSetSecureFounder : public Command return; } + EventReturn MOD_RESULT; + FOREACH_RESULT(I_OnSetChannelOption, OnSetChannelOption(source, this, ci, params[1])); + if (MOD_RESULT == EVENT_STOP) + return; - if (source.permission.empty() && ci->HasFlag(CI_SECUREFOUNDER) ? !source.IsFounder(ci) : !source.AccessFor(ci).HasPriv("FOUNDER")) + if (MOD_RESULT != EVENT_ALLOW && source.permission.empty() && !source.AccessFor(ci).HasPriv("SET")) { source.Reply(ACCESS_DENIED); return; diff --git a/modules/commands/cs_set_secureops.cpp b/modules/commands/cs_set_secureops.cpp index 2ffca4b68..c92401e59 100644 --- a/modules/commands/cs_set_secureops.cpp +++ b/modules/commands/cs_set_secureops.cpp @@ -31,7 +31,12 @@ class CommandCSSetSecureOps : public Command return; } - if (source.permission.empty() && !source.AccessFor(ci).HasPriv("SET")) + EventReturn MOD_RESULT; + FOREACH_RESULT(I_OnSetChannelOption, OnSetChannelOption(source, this, ci, params[1])); + if (MOD_RESULT == EVENT_STOP) + return; + + if (MOD_RESULT != EVENT_ALLOW && source.permission.empty() && !source.AccessFor(ci).HasPriv("SET")) { source.Reply(ACCESS_DENIED); return; diff --git a/modules/commands/cs_set_signkick.cpp b/modules/commands/cs_set_signkick.cpp index 0ee322b24..52d3934af 100644 --- a/modules/commands/cs_set_signkick.cpp +++ b/modules/commands/cs_set_signkick.cpp @@ -31,7 +31,12 @@ class CommandCSSetSignKick : public Command return; } - if (source.permission.empty() && !source.AccessFor(ci).HasPriv("SET")) + EventReturn MOD_RESULT; + FOREACH_RESULT(I_OnSetChannelOption, OnSetChannelOption(source, this, ci, params[1])); + if (MOD_RESULT == EVENT_STOP) + return; + + if (MOD_RESULT != EVENT_ALLOW && source.permission.empty() && !source.AccessFor(ci).HasPriv("SET")) { source.Reply(ACCESS_DENIED); return; diff --git a/modules/commands/cs_set_successor.cpp b/modules/commands/cs_set_successor.cpp index 5d3da40f1..64f875dce 100644 --- a/modules/commands/cs_set_successor.cpp +++ b/modules/commands/cs_set_successor.cpp @@ -31,16 +31,24 @@ class CommandCSSetSuccessor : public Command return; } - if (source.permission.empty() && !source.AccessFor(ci).HasPriv("SET")) - { - source.Reply(ACCESS_DENIED); + EventReturn MOD_RESULT; + FOREACH_RESULT(I_OnSetChannelOption, OnSetChannelOption(source, this, ci, params[1])); + if (MOD_RESULT == EVENT_STOP) return; - } - if (source.permission.empty() && ci->HasFlag(CI_SECUREFOUNDER) ? !source.IsFounder(ci) : !source.AccessFor(ci).HasPriv("FOUNDER")) + if (MOD_RESULT != EVENT_ALLOW && source.permission.empty()) { - source.Reply(ACCESS_DENIED); - return; + if (!source.AccessFor(ci).HasPriv("SET")) + { + source.Reply(ACCESS_DENIED); + return; + } + + if (ci->HasFlag(CI_SECUREFOUNDER) ? !source.IsFounder(ci) : !source.AccessFor(ci).HasPriv("FOUNDER")) + { + source.Reply(ACCESS_DENIED); + return; + } } NickCore *nc; diff --git a/modules/commands/cs_set_topiclock.cpp b/modules/commands/cs_set_topiclock.cpp index 80d016a8e..eb0d75e2a 100644 --- a/modules/commands/cs_set_topiclock.cpp +++ b/modules/commands/cs_set_topiclock.cpp @@ -31,7 +31,12 @@ class CommandCSSetTopicLock : public Command return; } - if (source.permission.empty() && !source.AccessFor(ci).HasPriv("SET")) + EventReturn MOD_RESULT; + FOREACH_RESULT(I_OnSetChannelOption, OnSetChannelOption(source, this, ci, params[1])); + if (MOD_RESULT == EVENT_STOP) + return; + + if (MOD_RESULT != EVENT_ALLOW && source.permission.empty() && !source.AccessFor(ci).HasPriv("SET")) { source.Reply(ACCESS_DENIED); return; diff --git a/modules/commands/ns_set_autoop.cpp b/modules/commands/ns_set_autoop.cpp index f69264add..7e3864420 100644 --- a/modules/commands/ns_set_autoop.cpp +++ b/modules/commands/ns_set_autoop.cpp @@ -31,6 +31,11 @@ class CommandNSSetAutoOp : public Command return; } NickCore *nc = na->nc; + + EventReturn MOD_RESULT; + FOREACH_RESULT(I_OnSetNickOption, OnSetNickOption(source, this, nc, param)); + if (MOD_RESULT == EVENT_STOP) + return; if (param.equals_ci("ON")) { diff --git a/modules/commands/ns_set_chanstats.cpp b/modules/commands/ns_set_chanstats.cpp index d624e52c6..5bf23907b 100644 --- a/modules/commands/ns_set_chanstats.cpp +++ b/modules/commands/ns_set_chanstats.cpp @@ -30,6 +30,11 @@ class CommandNSSetChanstats : public Command return; } + EventReturn MOD_RESULT; + FOREACH_RESULT(I_OnSetNickOption, OnSetNickOption(source, this, na->nc, param)); + if (MOD_RESULT == EVENT_STOP) + return; + if (param.equals_ci("ON")) { na->nc->SetFlag(NI_STATS); diff --git a/modules/commands/ns_set_display.cpp b/modules/commands/ns_set_display.cpp index 9c70cfa07..1980ba116 100644 --- a/modules/commands/ns_set_display.cpp +++ b/modules/commands/ns_set_display.cpp @@ -37,6 +37,11 @@ class CommandNSSetDisplay : public Command return; } + EventReturn MOD_RESULT; + FOREACH_RESULT(I_OnSetNickOption, OnSetNickOption(source, this, user_na->nc, param)); + if (MOD_RESULT == EVENT_STOP) + return; + change_core_display(user_na->nc, na->nick); source.Reply(NICK_SET_DISPLAY_CHANGED, user_na->nc->display.c_str()); } diff --git a/modules/commands/ns_set_email.cpp b/modules/commands/ns_set_email.cpp index 46aec504c..34aa68c5c 100644 --- a/modules/commands/ns_set_email.cpp +++ b/modules/commands/ns_set_email.cpp @@ -78,6 +78,11 @@ class CommandNSSetEmail : public Command return; } + EventReturn MOD_RESULT; + FOREACH_RESULT(I_OnSetNickOption, OnSetNickOption(source, this, nc, param)); + if (MOD_RESULT == EVENT_STOP) + return; + if (!param.empty() && Config->NSConfirmEmailChanges && !source.IsServicesOper()) { source.nc->Extend("ns_set_email", new ExtensibleItemClass(param)); diff --git a/modules/commands/ns_set_greet.cpp b/modules/commands/ns_set_greet.cpp index 65e8ffd7f..87ac7d1ee 100644 --- a/modules/commands/ns_set_greet.cpp +++ b/modules/commands/ns_set_greet.cpp @@ -32,6 +32,11 @@ class CommandNSSetGreet : public Command } NickCore *nc = na->nc; + EventReturn MOD_RESULT; + FOREACH_RESULT(I_OnSetNickOption, OnSetNickOption(source, this, nc, param)); + if (MOD_RESULT == EVENT_STOP) + return; + if (!param.empty()) { nc->greet = param; diff --git a/modules/commands/ns_set_hide.cpp b/modules/commands/ns_set_hide.cpp index 063200d15..4770653f2 100644 --- a/modules/commands/ns_set_hide.cpp +++ b/modules/commands/ns_set_hide.cpp @@ -32,6 +32,11 @@ class CommandNSSetHide : public Command } NickCore *nc = na->nc; + EventReturn MOD_RESULT; + FOREACH_RESULT(I_OnSetNickOption, OnSetNickOption(source, this, nc, param)); + if (MOD_RESULT == EVENT_STOP) + return; + Anope::string onmsg, offmsg; NickCoreFlag flag; diff --git a/modules/commands/ns_set_kill.cpp b/modules/commands/ns_set_kill.cpp index 8d0ea08cf..ca0f804d3 100644 --- a/modules/commands/ns_set_kill.cpp +++ b/modules/commands/ns_set_kill.cpp @@ -32,6 +32,11 @@ class CommandNSSetKill : public Command } NickCore *nc = na->nc; + EventReturn MOD_RESULT; + FOREACH_RESULT(I_OnSetNickOption, OnSetNickOption(source, this, nc, param)); + if (MOD_RESULT == EVENT_STOP) + return; + if (param.equals_ci("ON")) { nc->SetFlag(NI_KILLPROTECT); diff --git a/modules/commands/ns_set_language.cpp b/modules/commands/ns_set_language.cpp index a4b7d5aef..43162d6fd 100644 --- a/modules/commands/ns_set_language.cpp +++ b/modules/commands/ns_set_language.cpp @@ -32,6 +32,11 @@ class CommandNSSetLanguage : public Command } NickCore *nc = na->nc; + EventReturn MOD_RESULT; + FOREACH_RESULT(I_OnSetNickOption, OnSetNickOption(source, this, nc, param)); + if (MOD_RESULT == EVENT_STOP) + return; + for (unsigned j = 0; j < languages.size(); ++j) { if (param == "en" || languages[j] == param) diff --git a/modules/commands/ns_set_message.cpp b/modules/commands/ns_set_message.cpp index ccc204189..fa0ad7ec3 100644 --- a/modules/commands/ns_set_message.cpp +++ b/modules/commands/ns_set_message.cpp @@ -38,6 +38,11 @@ class CommandNSSetMessage : public Command return; } + EventReturn MOD_RESULT; + FOREACH_RESULT(I_OnSetNickOption, OnSetNickOption(source, this, nc, param)); + if (MOD_RESULT == EVENT_STOP) + return; + if (param.equals_ci("ON")) { nc->SetFlag(NI_MSG); diff --git a/modules/commands/ns_set_misc.cpp b/modules/commands/ns_set_misc.cpp index 0b7011892..9c805b3ea 100644 --- a/modules/commands/ns_set_misc.cpp +++ b/modules/commands/ns_set_misc.cpp @@ -84,6 +84,11 @@ class CommandNSSetMisc : public Command } NickCore *nc = na->nc; + EventReturn MOD_RESULT; + FOREACH_RESULT(I_OnSetNickOption, OnSetNickOption(source, this, nc, param)); + if (MOD_RESULT == EVENT_STOP) + return; + Anope::string scommand = GetAttribute(source.command); Anope::string key = "ns_set_misc:" + scommand; nc->Shrink(key); diff --git a/modules/commands/ns_set_private.cpp b/modules/commands/ns_set_private.cpp index ae9b6a473..358035567 100644 --- a/modules/commands/ns_set_private.cpp +++ b/modules/commands/ns_set_private.cpp @@ -32,6 +32,11 @@ class CommandNSSetPrivate : public Command } NickCore *nc = na->nc; + EventReturn MOD_RESULT; + FOREACH_RESULT(I_OnSetNickOption, OnSetNickOption(source, this, nc, param)); + if (MOD_RESULT == EVENT_STOP) + return; + if (param.equals_ci("ON")) { nc->SetFlag(NI_PRIVATE); diff --git a/modules/commands/ns_set_secure.cpp b/modules/commands/ns_set_secure.cpp index 9b94451cc..52eea8e5b 100644 --- a/modules/commands/ns_set_secure.cpp +++ b/modules/commands/ns_set_secure.cpp @@ -32,6 +32,11 @@ class CommandNSSetSecure : public Command } NickCore *nc = na->nc; + EventReturn MOD_RESULT; + FOREACH_RESULT(I_OnSetNickOption, OnSetNickOption(source, this, nc, param)); + if (MOD_RESULT == EVENT_STOP) + return; + if (param.equals_ci("ON")) { nc->SetFlag(NI_SECURE);