diff options
author | lethality <lethality@anope.org> | 2012-10-05 15:15:50 +0100 |
---|---|---|
committer | lethality <lethality@anope.org> | 2012-10-05 15:15:50 +0100 |
commit | 94fc2ba9c927f8950d81e38ef6b962ee5af022df (patch) | |
tree | 0e2ebe2df3ed41e5c7c10aba46bab236d3e11b75 /modules | |
parent | 2f87b8e430f5082708d7229b92c10b20f9e98fdf (diff) | |
parent | eff61c7a9708013f9617282c4f327bbe2b1bfb79 (diff) |
Merge branch '1.9' of ssh://anope.git.sf.net/gitroot/anope/anope into 1.9
Diffstat (limited to 'modules')
29 files changed, 170 insertions, 23 deletions
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<Anope::string>(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); |