diff options
Diffstat (limited to 'modules/commands')
-rw-r--r-- | modules/commands/bs_set.cpp | 10 | ||||
-rw-r--r-- | modules/commands/cs_set.cpp | 43 | ||||
-rw-r--r-- | modules/commands/ns_set.cpp | 36 |
3 files changed, 65 insertions, 24 deletions
diff --git a/modules/commands/bs_set.cpp b/modules/commands/bs_set.cpp index 784ea7f8b..b7e43eb9b 100644 --- a/modules/commands/bs_set.cpp +++ b/modules/commands/bs_set.cpp @@ -105,6 +105,10 @@ class CommandBSSetBanExpire : public Command } ci->banexpire = Anope::DoTime(arg); + + bool override = !access.HasPriv("SET"); + Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to change banexpire to " << ci->banexpire; + if (!ci->banexpire) source.Reply(_("Bot bans will no longer automatically expire.")); else @@ -404,8 +408,7 @@ class CommandBSSetNoBot : public Command if (value.equals_ci("ON")) { - bool override = !source.AccessFor(ci).HasPriv("SET"); - Log(override ? LOG_ADMIN : LOG_COMMAND, source, this, ci) << "to enable nobot"; + Log(LOG_ADMIN, source, this, ci) << "to enable nobot"; ci->ExtendMetadata("BS_NOBOT"); if (ci->bi) @@ -414,8 +417,7 @@ class CommandBSSetNoBot : public Command } else if (value.equals_ci("OFF")) { - bool override = !source.AccessFor(ci).HasPriv("SET"); - Log(override ? LOG_ADMIN : LOG_COMMAND, source, this, ci) << "to disable nobot"; + Log(LOG_ADMIN, source, this, ci) << "to disable nobot"; ci->Shrink("BS_NOBOT"); source.Reply(_("No-bot mode is now \002off\002 on channel %s."), ci->name.c_str()); diff --git a/modules/commands/cs_set.cpp b/modules/commands/cs_set.cpp index e3d2493ff..cfc2c4767 100644 --- a/modules/commands/cs_set.cpp +++ b/modules/commands/cs_set.cpp @@ -130,11 +130,13 @@ class CommandCSSetAutoOp : public Command if (params[1].equals_ci("ON")) { + Log(source.permission.empty() ? LOG_COMMAND : LOG_ADMIN, source, this, ci) << "to enable autoop"; ci->Shrink("NOAUTOOP"); source.Reply(_("Services will now automatically give modes to users in \002%s\002."), ci->name.c_str()); } else if (params[1].equals_ci("OFF")) { + Log(source.permission.empty() ? LOG_COMMAND : LOG_ADMIN, source, this, ci) << "to disable autoop"; ci->ExtendMetadata("NOAUTOOP"); source.Reply(_("Services will no longer automatically give modes to users in \002%s\002."), ci->name.c_str()); } @@ -188,6 +190,7 @@ class CommandCSSetBanType : public Command int16_t new_type = convertTo<int16_t>(params[1]); if (new_type < 0 || new_type > 3) throw ConvertException("Invalid range"); + Log(source.permission.empty() ? LOG_COMMAND : LOG_ADMIN, source, this, ci) << "to change the ban type to " << new_type; ci->bantype = new_type; source.Reply(_("Ban type for channel %s is now #%d."), ci->name.c_str(), ci->bantype); } @@ -195,8 +198,6 @@ class CommandCSSetBanType : public Command { source.Reply(_("\002%s\002 is not a valid ban type."), params[1].c_str()); } - - return; } bool OnHelp(CommandSource &source, const Anope::string &) anope_override @@ -249,15 +250,16 @@ class CommandCSSetChanstats : public Command { ci->ExtendMetadata("STATS"); source.Reply(_("Chanstats statistics are now enabled for this channel.")); + Log(source.permission.empty() ? LOG_COMMAND : LOG_ADMIN, source, this, ci) << "to enable chanstats"; } else if (params[1].equals_ci("OFF")) { + Log(source.permission.empty() ? LOG_COMMAND : LOG_ADMIN, source, this, ci) << "to disable chanstats"; ci->Shrink("STATS"); source.Reply(_("Chanstats statistics are now disabled for this channel.")); } else this->OnSyntaxError(source, ""); - return; } bool OnHelp(CommandSource &source, const Anope::string &) anope_override @@ -301,11 +303,13 @@ class CommandCSSetDescription : public Command if (params.size() > 1) { ci->desc = params[1]; + Log(source.permission.empty() ? LOG_COMMAND : LOG_ADMIN, source, this, ci) << "to change the description to " << ci->desc; source.Reply(_("Description of %s changed to \002%s\002."), ci->name.c_str(), ci->desc.c_str()); } else { ci->desc.clear(); + Log(source.permission.empty() ? LOG_COMMAND : LOG_ADMIN, source, this, ci) << "to unset the description"; source.Reply(_("Description of %s unset."), ci->name.c_str()); } @@ -365,7 +369,7 @@ class CommandCSSetFounder : public Command return; } - Log(!source.permission.empty() ? LOG_ADMIN : LOG_COMMAND, source, this, ci) << "to change the founder from " << (ci->GetFounder() ? ci->GetFounder()->display : "(none)") << " to " << nc->display; + Log(source.permission.empty() ? LOG_COMMAND : LOG_ADMIN, source, this, ci) << "to change the founder from " << (ci->GetFounder() ? ci->GetFounder()->display : "(none)") << " to " << nc->display; ci->SetFounder(nc); @@ -415,18 +419,18 @@ class CommandCSSetKeepTopic : public Command if (params[1].equals_ci("ON")) { + Log(source.permission.empty() ? LOG_COMMAND : LOG_ADMIN, source, this, ci) << "to enable keeptopic"; ci->ExtendMetadata("KEEPTOPIC"); source.Reply(_("Topic retention option for %s is now \002on\002."), ci->name.c_str()); } else if (params[1].equals_ci("OFF")) { + Log(source.permission.empty() ? LOG_COMMAND : LOG_ADMIN, source, this, ci) << "to disable keeptopic"; ci->Shrink("KEEPTOPIC"); source.Reply(_("Topic retention option for %s is now \002off\002."), ci->name.c_str()); } else this->OnSyntaxError(source, "KEEPTOPIC"); - - return; } bool OnHelp(CommandSource &source, const Anope::string &) anope_override @@ -472,11 +476,13 @@ class CommandCSSetPeace : public Command if (params[1].equals_ci("ON")) { + Log(source.permission.empty() ? LOG_COMMAND : LOG_ADMIN, source, this, ci) << "to enable peace"; ci->ExtendMetadata("PEACE"); source.Reply(_("Peace option for %s is now \002on\002."), ci->name.c_str()); } else if (params[1].equals_ci("OFF")) { + Log(source.permission.empty() ? LOG_COMMAND : LOG_ADMIN, source, this, ci) << "to disable peace"; ci->Shrink("PEACE"); source.Reply(_("Peace option for %s is now \002off\002."), ci->name.c_str()); } @@ -568,6 +574,7 @@ class CommandCSSetPersist : public Command } } + Log(source.permission.empty() ? LOG_COMMAND : LOG_ADMIN, source, this, ci) << "to enable persist"; source.Reply(_("Channel \002%s\002 is now persistent."), ci->name.c_str()); } else if (params[1].equals_ci("OFF")) @@ -600,6 +607,7 @@ class CommandCSSetPersist : public Command } } + Log(source.permission.empty() ? LOG_COMMAND : LOG_ADMIN, source, this, ci) << "to disable persist"; source.Reply(_("Channel \002%s\002 is no longer persistent."), ci->name.c_str()); } else @@ -666,11 +674,13 @@ class CommandCSSetPrivate : public Command if (params[1].equals_ci("ON")) { + Log(source.permission.empty() ? LOG_COMMAND : LOG_ADMIN, source, this, ci) << "to enable private"; ci->ExtendMetadata("PRIVATE"); source.Reply(_("Private option for %s is now \002on\002."), ci->name.c_str()); } else if (params[1].equals_ci("OFF")) { + Log(source.permission.empty() ? LOG_COMMAND : LOG_ADMIN, source, this, ci) << "to disable private"; ci->Shrink("PRIVATE"); source.Reply(_("Private option for %s is now \002off\002."), ci->name.c_str()); } @@ -723,18 +733,18 @@ class CommandCSSetRestricted : public Command if (params[1].equals_ci("ON")) { + Log(source.permission.empty() ? LOG_COMMAND : LOG_ADMIN, source, this, ci) << "to enable restricted"; ci->ExtendMetadata("RESTRICTED"); source.Reply(_("Restricted access option for %s is now \002on\002."), ci->name.c_str()); } else if (params[1].equals_ci("OFF")) { + Log(source.permission.empty() ? LOG_COMMAND : LOG_ADMIN, source, this, ci) << "to disable restricted"; ci->Shrink("RESTRICTED"); source.Reply(_("Restricted access option for %s is now \002off\002."), ci->name.c_str()); } else this->OnSyntaxError(source, "RESTRICTED"); - - return; } bool OnHelp(CommandSource &source, const Anope::string &) anope_override @@ -779,18 +789,18 @@ class CommandCSSetSecure : public Command if (params[1].equals_ci("ON")) { + Log(source.permission.empty() ? LOG_COMMAND : LOG_ADMIN, source, this, ci) << "to enable secure"; ci->ExtendMetadata("SECURE"); source.Reply(_("Secure option for %s is now \002on\002."), ci->name.c_str()); } else if (params[1].equals_ci("OFF")) { + Log(source.permission.empty() ? LOG_COMMAND : LOG_ADMIN, source, this, ci) << "to disable secure"; ci->Shrink("SECURE"); source.Reply(_("Secure option for %s is now \002off\002."), ci->name.c_str()); } else this->OnSyntaxError(source, "SECURE"); - - return; } bool OnHelp(CommandSource &source, const Anope::string &) anope_override @@ -837,18 +847,18 @@ class CommandCSSetSecureFounder : public Command if (params[1].equals_ci("ON")) { + Log(source.permission.empty() ? LOG_COMMAND : LOG_ADMIN, source, this, ci) << "to enable secure founder"; ci->ExtendMetadata("SECUREFOUNDER"); source.Reply(_("Secure founder option for %s is now \002on\002."), ci->name.c_str()); } else if (params[1].equals_ci("OFF")) { + Log(source.permission.empty() ? LOG_COMMAND : LOG_ADMIN, source, this, ci) << "to disable secure founder"; ci->Shrink("SECUREFOUNDER"); source.Reply(_("Secure founder option for %s is now \002off\002."), ci->name.c_str()); } else this->OnSyntaxError(source, "SECUREFOUNDER"); - - return; } bool OnHelp(CommandSource &source, const Anope::string &) anope_override @@ -895,18 +905,18 @@ class CommandCSSetSecureOps : public Command if (params[1].equals_ci("ON")) { + Log(source.permission.empty() ? LOG_COMMAND : LOG_ADMIN, source, this, ci) << "to enable secure ops"; ci->ExtendMetadata("SECUREOPS"); source.Reply(_("Secure ops option for %s is now \002on\002."), ci->name.c_str()); } else if (params[1].equals_ci("OFF")) { + Log(source.permission.empty() ? LOG_COMMAND : LOG_ADMIN, source, this, ci) << "to disable secure ops"; ci->Shrink("SECUREOPS"); source.Reply(_("Secure ops option for %s is now \002off\002."), ci->name.c_str()); } else this->OnSyntaxError(source, "SECUREOPS"); - - return; } bool OnHelp(CommandSource &source, const Anope::string &) anope_override @@ -954,6 +964,7 @@ class CommandCSSetSignKick : public Command ci->ExtendMetadata("SIGNKICK"); ci->Shrink("SIGNKICK_LEVEL"); source.Reply(_("Signed kick option for %s is now \002on\002."), ci->name.c_str()); + Log(source.permission.empty() ? LOG_COMMAND : LOG_ADMIN, source, this, ci) << "to enable sign kick"; } else if (params[1].equals_ci("LEVEL")) { @@ -961,12 +972,14 @@ class CommandCSSetSignKick : public Command ci->Shrink("SIGNKICK"); source.Reply(_("Signed kick option for %s is now \002on\002, but depends of the\n" "level of the user that is using the command."), ci->name.c_str()); + Log(source.permission.empty() ? LOG_COMMAND : LOG_ADMIN, source, this, ci) << "to enable sign kick level"; } else if (params[1].equals_ci("OFF")) { ci->Shrink("SIGNKICK"); ci->Shrink("SIGNKICK_LEVEL"); source.Reply(_("Signed kick option for %s is now \002off\002."), ci->name.c_str()); + Log(source.permission.empty() ? LOG_COMMAND : LOG_ADMIN, source, this, ci) << "to disable sign kick"; } else this->OnSyntaxError(source, "SIGNKICK"); @@ -1091,11 +1104,13 @@ class CommandCSSASetNoexpire : public Command if (params[1].equals_ci("ON")) { + Log(LOG_ADMIN, source, this, ci) << "to enable noexpire"; ci->ExtendMetadata("NO_EXPIRE"); source.Reply(_("Channel %s \002will not\002 expire."), ci->name.c_str()); } else if (params[1].equals_ci("OFF")) { + Log(LOG_ADMIN, source, this, ci) << "to disable noexpire"; ci->Shrink("NO_EXPIRE"); source.Reply(_("Channel %s \002will\002 expire."), ci->name.c_str()); } diff --git a/modules/commands/ns_set.cpp b/modules/commands/ns_set.cpp index 252a83262..e0b403f01 100644 --- a/modules/commands/ns_set.cpp +++ b/modules/commands/ns_set.cpp @@ -126,6 +126,8 @@ class CommandNSSetPassword : public Command return; } + Log(LOG_COMMAND, source, this) << "to change their password"; + Anope::Encrypt(param, source.nc->pass); Anope::string tmp_pass; if (Anope::Decrypt(source.nc->pass, tmp_pass) == 1) @@ -181,6 +183,8 @@ class CommandNSSASetPassword : public Command return; } + Log(LOG_ADMIN, source, this) << "to change the password of " << nc->display; + Anope::Encrypt(params[1], nc->pass); Anope::string tmp_pass; if (Anope::Decrypt(nc->pass, tmp_pass) == 1) @@ -226,18 +230,18 @@ class CommandNSSetAutoOp : public Command if (param.equals_ci("ON")) { + Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to enable autoop for " << na->nc->display; nc->ExtendMetadata("AUTOOP"); source.Reply(_("Services will from now on set status modes on %s in channels."), nc->display.c_str()); } else if (param.equals_ci("OFF")) { + Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to disable autoop for " << na->nc->display; nc->Shrink("AUTOOP"); source.Reply(_("Services will no longer set status modes on %s in channels."), nc->display.c_str()); } else this->OnSyntaxError(source, "AUTOOP"); - - return; } void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override @@ -308,11 +312,13 @@ class CommandNSSetChanstats : public Command if (param.equals_ci("ON")) { + Log(na->nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to enable chanstats for " << na->nc->display; na->nc->ExtendMetadata("STATS"); source.Reply(_("Chanstat statistics are now enabled for your nick.")); } else if (param.equals_ci("OFF")) { + Log(na->nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to disable chanstats for " << na->nc->display; na->nc->Shrink("STATS"); source.Reply(_("Chanstat statistics are now disabled for your nick.")); } @@ -393,6 +399,8 @@ class CommandNSSetDisplay : public Command if (MOD_RESULT == EVENT_STOP) return; + Log(user_na->nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to change the display of " << user_na->nc->display << " to " << na->nick; + user_na->nc->SetDisplay(na); source.Reply(NICK_SET_DISPLAY_CHANGED, user_na->nc->display.c_str()); } @@ -519,17 +527,17 @@ class CommandNSSetEmail : public Command { if (!param.empty()) { + Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to change the email of " << nc->display << " to " << param; nc->email = param; source.Reply(_("E-mail address for \002%s\002 changed to \002%s\002."), nc->display.c_str(), param.c_str()); } else { + Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to unset the email of " << nc->display; nc->email.clear(); source.Reply(_("E-mail address for \002%s\002 unset."), nc->display.c_str()); } } - - return; } void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override @@ -597,11 +605,13 @@ class CommandNSSetGreet : public Command if (!param.empty()) { + Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to change the greet of " << nc->display; nc->greet = param; source.Reply(_("Greet message for \002%s\002 changed to \002%s\002."), nc->display.c_str(), nc->greet.c_str()); } else { + Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to unset the greet of " << nc->display; nc->greet.clear(); source.Reply(_("Greet message for \002%s\002 unset."), nc->display.c_str()); } @@ -710,11 +720,13 @@ class CommandNSSetHide : public Command if (arg.equals_ci("ON")) { + Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to change hide " << param << " to " << arg << " for " << nc->display; nc->ExtendMetadata(flag); source.Reply(onmsg.c_str(), nc->display.c_str(), Config->NickServ.c_str()); } else if (arg.equals_ci("OFF")) { + Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to change hide " << param << " to " << arg << " for " << nc->display; nc->Shrink(flag); source.Reply(offmsg.c_str(), nc->display.c_str(), Config->NickServ.c_str()); } @@ -808,6 +820,7 @@ class CommandNSSetKill : public Command nc->ExtendMetadata("KILLPROTECT"); nc->Shrink("KILL_QUICK"); nc->Shrink("KILL_IMMED"); + Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to set kill on for " << nc->display; source.Reply(_("Protection is now \002on\002 for \002%s\002."), nc->display.c_str()); } else if (param.equals_ci("QUICK")) @@ -815,6 +828,7 @@ class CommandNSSetKill : public Command nc->ExtendMetadata("KILLPROTECT"); nc->ExtendMetadata("KILL_QUICK"); nc->Shrink("KILL_IMMED"); + Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to set kill quick for " << nc->display; source.Reply(_("Protection is now \002on\002 for \002%s\002, with a reduced delay."), nc->display.c_str()); } else if (param.equals_ci("IMMED")) @@ -824,6 +838,7 @@ class CommandNSSetKill : public Command nc->ExtendMetadata("KILLPROTECT"); nc->ExtendMetadata("KILL_IMMED"); nc->Shrink("KILL_QUICK"); + Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to set kill immed for " << nc->display; source.Reply(_("Protection is now \002on\002 for \002%s\002, with no delay."), nc->display.c_str()); } else @@ -834,6 +849,7 @@ class CommandNSSetKill : public Command nc->Shrink("KILLPROTECT"); nc->Shrink("KILL_QUICK"); nc->Shrink("KILL_IMMED"); + Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to disable kill for " << nc->display; source.Reply(_("Protection is now \002off\002 for \002%s\002."), nc->display.c_str()); } else @@ -936,6 +952,8 @@ class CommandNSSetLanguage : public Command } } + Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to change the langauge of " << nc->display << " to " << param; + nc->language = param != "en" ? param : ""; source.Reply(_("Language changed to \002English\002.")); @@ -1035,11 +1053,13 @@ class CommandNSSetMessage : public Command if (param.equals_ci("ON")) { + Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to enable " << source.command << " for " << nc->display; nc->ExtendMetadata("MSG"); source.Reply(_("Services will now reply to \002%s\002 with \002messages\002."), nc->display.c_str()); } else if (param.equals_ci("OFF")) { + Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to disable " << source.command << " for " << nc->display; nc->Shrink("MSG"); source.Reply(_("Services will now reply to \002%s\002 with \002notices\002."), nc->display.c_str()); } @@ -1122,11 +1142,13 @@ class CommandNSSetPrivate : public Command if (param.equals_ci("ON")) { + Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to enable private for " << nc->display; nc->ExtendMetadata("PRIVATE"); source.Reply(_("Private option is now \002on\002 for \002%s\002."), nc->display.c_str()); } else if (param.equals_ci("OFF")) { + Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to disable private for " << nc->display; nc->Shrink("PRIVATE"); source.Reply(_("Private option is now \002off\002 for \002%s\002."), nc->display.c_str()); } @@ -1209,11 +1231,13 @@ class CommandNSSetSecure : public Command if (param.equals_ci("ON")) { + Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to enable secure for " << nc->display; nc->ExtendMetadata("SECURE"); source.Reply(_("Secure option is now \002on\002 for \002%s\002."), nc->display.c_str()); } else if (param.equals_ci("OFF")) { + Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to disable secure for " << nc->display; nc->Shrink("SECURE"); source.Reply(_("Secure option is now \002off\002 for \002%s\002."), nc->display.c_str()); } @@ -1292,18 +1316,18 @@ class CommandNSSASetNoexpire : public Command if (param.equals_ci("ON")) { + Log(LOG_ADMIN, source, this) << "to enable noexpire " << na->nc->display; na->ExtendMetadata("NO_EXPIRE"); source.Reply(_("Nick %s \002will not\002 expire."), na->nick.c_str()); } else if (param.equals_ci("OFF")) { + Log(LOG_ADMIN, source, this) << "to disable noexpire " << na->nc->display; na->Shrink("NO_EXPIRE"); source.Reply(_("Nick %s \002will\002 expire."), na->nick.c_str()); } else this->OnSyntaxError(source, "NOEXPIRE"); - - return; } bool OnHelp(CommandSource &source, const Anope::string &) anope_override |