summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2016-10-22 16:43:18 -0400
committerAdam <Adam@anope.org>2016-10-22 16:52:29 -0400
commitfce6169f4e134a99dbb19997337b1bb250889147 (patch)
treeb6f2f6c1bc7094a32b5dc6bb1df97fc4b675e9e0
parent06f40cabcb167e2764c03092f6ec3f7383983f95 (diff)
Various codestyle cleanup in most of the core modules
-rw-r--r--modules/botserv/assign.cpp2
-rw-r--r--modules/botserv/bot.cpp3
-rw-r--r--modules/botserv/info.cpp5
-rw-r--r--modules/botserv/kick.cpp28
-rw-r--r--modules/botserv/set.cpp2
-rw-r--r--modules/chanserv/access.cpp39
-rw-r--r--modules/chanserv/akick.cpp2
-rw-r--r--modules/chanserv/clone.cpp2
-rw-r--r--modules/chanserv/entrymsg.cpp37
-rw-r--r--modules/chanserv/flags.cpp4
-rw-r--r--modules/chanserv/kick.cpp2
-rw-r--r--modules/chanserv/list.cpp2
-rw-r--r--modules/chanserv/log.cpp4
-rw-r--r--modules/chanserv/main/chanserv.cpp2
-rw-r--r--modules/chanserv/mode.cpp86
-rw-r--r--modules/chanserv/register.cpp2
-rw-r--r--modules/chanserv/set.cpp24
-rw-r--r--modules/chanserv/status.cpp8
-rw-r--r--modules/chanserv/statusupdate.cpp63
-rw-r--r--modules/chanserv/topic.cpp25
-rw-r--r--modules/chanserv/unban.cpp1
-rw-r--r--modules/chanserv/updown.cpp201
-rw-r--r--modules/chanserv/xop.cpp2
-rw-r--r--modules/hostserv/add.cpp2
-rw-r--r--modules/hostserv/list.cpp2
-rw-r--r--modules/hostserv/request.cpp2
-rw-r--r--modules/memoserv/del.cpp2
-rw-r--r--modules/memoserv/ignore.cpp2
-rw-r--r--modules/memoserv/info.cpp8
-rw-r--r--modules/memoserv/list.cpp2
-rw-r--r--modules/memoserv/main/memoserv.cpp10
-rw-r--r--modules/memoserv/read.cpp3
-rw-r--r--modules/memoserv/send.cpp6
-rw-r--r--modules/memoserv/set.cpp12
-rw-r--r--modules/nickserv/access.cpp6
-rw-r--r--modules/nickserv/cert.cpp2
-rw-r--r--modules/nickserv/main/nickserv.cpp5
-rw-r--r--modules/nickserv/recover.cpp2
-rw-r--r--modules/nickserv/register.cpp4
-rw-r--r--modules/nickserv/resetpass.cpp2
-rw-r--r--modules/nickserv/set.cpp13
-rw-r--r--modules/nickserv/status.cpp2
-rw-r--r--modules/operserv/akill.cpp7
-rw-r--r--modules/operserv/config.cpp2
-rw-r--r--modules/operserv/dns.cpp2
-rw-r--r--modules/operserv/ignore.cpp4
-rw-r--r--modules/operserv/jupe.cpp39
-rw-r--r--modules/operserv/kill.cpp23
-rw-r--r--modules/operserv/logsearch.cpp6
-rw-r--r--modules/operserv/mode.cpp14
-rw-r--r--modules/operserv/modinfo.cpp51
-rw-r--r--modules/operserv/module.cpp10
-rw-r--r--modules/operserv/noop.cpp14
-rw-r--r--modules/operserv/oline.cpp4
-rw-r--r--modules/operserv/oper.cpp8
-rw-r--r--modules/operserv/set.cpp31
-rw-r--r--modules/operserv/shutdown.cpp3
-rw-r--r--modules/operserv/svs.cpp92
-rw-r--r--modules/operserv/sxline.cpp14
-rw-r--r--modules/operserv/update.cpp1
60 files changed, 636 insertions, 322 deletions
diff --git a/modules/botserv/assign.cpp b/modules/botserv/assign.cpp
index a26b869fe..95691b6a9 100644
--- a/modules/botserv/assign.cpp
+++ b/modules/botserv/assign.cpp
@@ -207,7 +207,9 @@ class CommandBSSetNoBot : public Command
source.Reply(_("No-bot mode is now \002off\002 for \002{0}\002."), ci->GetName());
}
else
+ {
this->OnSyntaxError(source, source.command);
+ }
}
bool OnHelp(CommandSource &source, const Anope::string &) override
diff --git a/modules/botserv/bot.cpp b/modules/botserv/bot.cpp
index 2e33b7ccb..30550df56 100644
--- a/modules/botserv/bot.cpp
+++ b/modules/botserv/bot.cpp
@@ -216,6 +216,7 @@ class CommandBSBot : public Command
return;
}
+#warning "xline on the stack"
/* The new nick is really different, so we remove the Q line for the old nick. */
//XLine x_del(bi->nick);
//IRCD->SendSQLineDel(&x_del);
@@ -373,7 +374,9 @@ class CommandBSBot : public Command
this->DoDel(source, params);
}
else
+ {
this->OnSyntaxError(source, "");
+ }
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand) override
diff --git a/modules/botserv/info.cpp b/modules/botserv/info.cpp
index 4de86643f..bc4db8b0f 100644
--- a/modules/botserv/info.cpp
+++ b/modules/botserv/info.cpp
@@ -76,9 +76,6 @@ class CommandBSInfo : public Command
source.Reply(_("Information for channel \002{0}\002:"), ci->GetName());
info[_("Bot nick")] = ci->GetBot() ? ci->GetBot()->nick : _("not assigned yet");
- Anope::string enabled = Language::Translate(source.nc, _("Enabled"));
- Anope::string disabled = Language::Translate(source.nc, _("Disabled"));
-
EventManager::Get()->Dispatch(&Event::ServiceBotEvent::OnServiceBot, source, bi, ci, info);
std::vector<Anope::string> replies;
@@ -88,7 +85,9 @@ class CommandBSInfo : public Command
source.Reply(replies[i]);
}
else
+ {
source.Reply(_("\002{0}\002 is not a valid bot or registered channel."), query);
+ }
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand) override
diff --git a/modules/botserv/kick.cpp b/modules/botserv/kick.cpp
index 1b9d67fc7..4411ee4ed 100644
--- a/modules/botserv/kick.cpp
+++ b/modules/botserv/kick.cpp
@@ -898,7 +898,9 @@ class CommandBSKickFlood : public CommandBSKickBase
source.Reply(_("Bot won't kick for \002flood\002 anymore."));
}
else
+ {
this->OnSyntaxError(source, params[1]);
+ }
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand) override
@@ -998,7 +1000,9 @@ class CommandBSKickRepeat : public CommandBSKickBase
source.Reply(_("Bot won't kick for \002repeats\002 anymore."));
}
else
+ {
this->OnSyntaxError(source, params[1]);
+ }
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand) override
@@ -1110,7 +1114,9 @@ class CommandBSSetDontKickOps : public Command
source.Reply(_("Bot \002will kick ops\002 on channel \002{0}\002."), ci->GetName());
}
else
+ {
this->OnSyntaxError(source, source.command);
+ }
}
bool OnHelp(CommandSource &source, const Anope::string &) override
@@ -1174,7 +1180,9 @@ class CommandBSSetDontKickVoices : public Command
source.Reply(_("Bot \002will kick voices\002 on channel %s."), ci->GetName().c_str());
}
else
+ {
this->OnSyntaxError(source, source.command);
+ }
}
bool OnHelp(CommandSource &source, const Anope::string &) override
@@ -1402,7 +1410,9 @@ class BSKick : public Module
info[_("Bad words kicker")] = enabled;
}
else
+ {
info[_("Bad words kicker")] = disabled;
+ }
if (kd && kd->GetBolds())
{
@@ -1412,7 +1422,9 @@ class BSKick : public Module
info[_("Bolds kicker")] = enabled;
}
else
+ {
info[_("Bolds kicker")] = disabled;
+ }
if (kd && kd->GetCaps())
{
@@ -1422,7 +1434,9 @@ class BSKick : public Module
info[_("Caps kicker")] = Anope::printf(_("%s (minimum %d/%d%%)"), enabled.c_str(), kd->GetCapsMin(), kd->GetCapsPercent());
}
else
+ {
info[_("Caps kicker")] = disabled;
+ }
if (kd && kd->GetColors())
{
@@ -1432,7 +1446,9 @@ class BSKick : public Module
info[_("Colors kicker")] = enabled;
}
else
+ {
info[_("Colors kicker")] = disabled;
+ }
if (kd && kd->GetFlood())
{
@@ -1442,7 +1458,9 @@ class BSKick : public Module
info[_("Flood kicker")] = Anope::printf(_("%s (%d lines in %ds)"), enabled.c_str(), kd->GetFloodLines(), kd->GetFloodSecs());
}
else
+ {
info[_("Flood kicker")] = disabled;
+ }
if (kd && kd->GetRepeat())
{
@@ -1452,7 +1470,9 @@ class BSKick : public Module
info[_("Repeat kicker")] = Anope::printf(_("%s (%d times)"), enabled.c_str(), kd->GetRepeatTimes());
}
else
+ {
info[_("Repeat kicker")] = disabled;
+ }
if (kd && kd->GetReverses())
{
@@ -1462,7 +1482,9 @@ class BSKick : public Module
info[_("Reverses kicker")] = enabled;
}
else
+ {
info[_("Reverses kicker")] = disabled;
+ }
if (kd && kd->GetUnderlines())
{
@@ -1472,7 +1494,9 @@ class BSKick : public Module
info[_("Underlines kicker")] = enabled;
}
else
+ {
info[_("Underlines kicker")] = disabled;
+ }
if (kd && kd->GetItalics())
{
@@ -1482,7 +1506,9 @@ class BSKick : public Module
info[_("Italics kicker")] = enabled;
}
else
+ {
info[_("Italics kicker")] = disabled;
+ }
if (kd && kd->GetAmsgs())
{
@@ -1492,7 +1518,9 @@ class BSKick : public Module
info[_("AMSG kicker")] = enabled;
}
else
+ {
info[_("AMSG kicker")] = disabled;
+ }
if (kd && kd->GetDontKickOps())
info.AddOption(_("Ops protection"));
diff --git a/modules/botserv/set.cpp b/modules/botserv/set.cpp
index bb432e3f0..6ab429d97 100644
--- a/modules/botserv/set.cpp
+++ b/modules/botserv/set.cpp
@@ -191,7 +191,9 @@ class CommandBSSetPrivate : public Command
source.Reply(_("Private mode of bot \002{0}\002 is now \002off\002."), bi->nick);
}
else
+ {
this->OnSyntaxError(source, source.command);
+ }
}
bool OnHelp(CommandSource &source, const Anope::string &) override
diff --git a/modules/chanserv/access.cpp b/modules/chanserv/access.cpp
index ba9f2b5fb..82a11831f 100644
--- a/modules/chanserv/access.cpp
+++ b/modules/chanserv/access.cpp
@@ -656,30 +656,31 @@ class CommandCSLevels : public Command
}
if (level <= ChanServ::ACCESS_INVALID || level > ChanServ::ACCESS_FOUNDER)
+ {
source.Reply(_("Level must be between \002{0}\002 and \002{1}\002 inclusive."), ChanServ::ACCESS_INVALID + 1, ChanServ::ACCESS_FOUNDER - 1);
+ return;
+ }
+
+ ChanServ::Privilege *p = ChanServ::service ? ChanServ::service->FindPrivilege(what) : nullptr;
+ if (p == NULL)
+ {
+ CommandInfo *help = source.service->FindCommand("generic/help");
+ if (help)
+ source.Reply(_("There is no such privilege \002{0}\002. See \002{0}{1} {2} {3}\002 for a list of valid settings."),
+ what, Config->StrictPrivmsg, source.service->nick, help->cname, source.command);
+ }
else
{
- ChanServ::Privilege *p = ChanServ::service ? ChanServ::service->FindPrivilege(what) : nullptr;
- if (p == NULL)
- {
- CommandInfo *help = source.service->FindCommand("generic/help");
- if (help)
- source.Reply(_("There is no such privilege \002{0}\002. See \002{0}{1} {2} {3}\002 for a list of valid settings."),
- what, Config->StrictPrivmsg, source.service->nick, help->cname, source.command);
- }
- else
- {
- bool override = !source.AccessFor(ci).HasPriv("FOUNDER");
- Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to set " << p->name << " to level " << level;
+ bool override = !source.AccessFor(ci).HasPriv("FOUNDER");
+ Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to set " << p->name << " to level " << level;
- ci->SetLevel(p->name, level);
- EventManager::Get()->Dispatch(&Event::LevelChange::OnLevelChange, source, ci, p->name, level);
+ ci->SetLevel(p->name, level);
+ EventManager::Get()->Dispatch(&Event::LevelChange::OnLevelChange, source, ci, p->name, level);
- if (level == ChanServ::ACCESS_FOUNDER)
- source.Reply(_("Level for privilege \002{0}\002 on channel \002{1}\002 changed to \002founder only\002."), p->name, ci->GetName());
- else
- source.Reply(_("Level for privilege \002{0}\002 on channel \002{1}\002 changed to \002{3}\002."), p->name, ci->GetName(), level);
- }
+ if (level == ChanServ::ACCESS_FOUNDER)
+ source.Reply(_("Level for privilege \002{0}\002 on channel \002{1}\002 changed to \002founder only\002."), p->name, ci->GetName());
+ else
+ source.Reply(_("Level for privilege \002{0}\002 on channel \002{1}\002 changed to \002{3}\002."), p->name, ci->GetName(), level);
}
}
diff --git a/modules/chanserv/akick.cpp b/modules/chanserv/akick.cpp
index ff7fb5b69..d253d6fb5 100644
--- a/modules/chanserv/akick.cpp
+++ b/modules/chanserv/akick.cpp
@@ -205,7 +205,9 @@ class CommandCSAKick : public Command
mask += "#" + e.real;
}
else
+ {
nc = na->GetAccount();
+ }
/* Check excepts BEFORE we get this far */
if (ci->c)
diff --git a/modules/chanserv/clone.cpp b/modules/chanserv/clone.cpp
index 96aa89bf4..8d0c1ce3a 100644
--- a/modules/chanserv/clone.cpp
+++ b/modules/chanserv/clone.cpp
@@ -90,7 +90,9 @@ public:
return;
}
else
+ {
override = true;
+ }
}
if (what.equals_ci("ALL"))
diff --git a/modules/chanserv/entrymsg.cpp b/modules/chanserv/entrymsg.cpp
index b607ba399..4f74834bd 100644
--- a/modules/chanserv/entrymsg.cpp
+++ b/modules/chanserv/entrymsg.cpp
@@ -161,27 +161,32 @@ class CommandEntryMessage : public Command
std::vector<EntryMsg *> messages = ci->GetRefs<EntryMsg *>();
if (!message.is_pos_number_only())
+ {
source.Reply(("Entry message \002{0}\002 not found on channel \002{1}\002."), message, ci->GetName());
- else if (messages.empty())
+ return;
+ }
+
+ if (messages.empty())
+ {
source.Reply(_("Entry message list for \002{0}\002 is empty."), ci->GetName());
- else
+ return;
+ }
+
+ try
{
- try
+ unsigned i = convertTo<unsigned>(message);
+ if (i > 0 && i <= messages.size())
{
- unsigned i = convertTo<unsigned>(message);
- if (i > 0 && i <= messages.size())
- {
- messages[i - 1]->Delete();
- Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to remove a message";
- source.Reply(_("Entry message \002{0}\002 for \002{1]\002 deleted."), i, ci->GetName());
- }
- else
- throw ConvertException();
- }
- catch (const ConvertException &)
- {
- source.Reply(_("Entry message \002{0}\002 not found on channel \002{1}\002."), message, ci->GetName());
+ messages[i - 1]->Delete();
+ Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to remove a message";
+ source.Reply(_("Entry message \002{0}\002 for \002{1]\002 deleted."), i, ci->GetName());
}
+ else
+ throw ConvertException();
+ }
+ catch (const ConvertException &)
+ {
+ source.Reply(_("Entry message \002{0}\002 not found on channel \002{1}\002."), message, ci->GetName());
}
}
diff --git a/modules/chanserv/flags.cpp b/modules/chanserv/flags.cpp
index 732e3aa8a..446eeddd0 100644
--- a/modules/chanserv/flags.cpp
+++ b/modules/chanserv/flags.cpp
@@ -431,9 +431,13 @@ class CommandCSFlags : public Command
}
if (is_list)
+ {
this->DoList(source, ci, params);
+ }
else if (cmd.equals_ci("CLEAR"))
+ {
this->DoClear(source, ci);
+ }
else
{
Anope::string mask, flags;
diff --git a/modules/chanserv/kick.cpp b/modules/chanserv/kick.cpp
index 0fd8979d4..4752d5940 100644
--- a/modules/chanserv/kick.cpp
+++ b/modules/chanserv/kick.cpp
@@ -132,7 +132,9 @@ class CommandCSKick : public Command
source.Reply(_("No users on\002{0}\002 match \002{1}\002."), c->name, mask);
}
else
+ {
source.Reply(_("\002{0}\002 isn't currently in use."), target);
+ }
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand) override
diff --git a/modules/chanserv/list.cpp b/modules/chanserv/list.cpp
index 75ffdb67c..c76d8661c 100644
--- a/modules/chanserv/list.cpp
+++ b/modules/chanserv/list.cpp
@@ -227,7 +227,9 @@ class CommandCSSetPrivate : public Command
source.Reply(_("Private option for \002{0}\002 is now \002off\002."), ci->GetName());
}
else
+ {
this->OnSyntaxError(source, "PRIVATE");
+ }
}
bool OnHelp(CommandSource &source, const Anope::string &) override
diff --git a/modules/chanserv/log.cpp b/modules/chanserv/log.cpp
index b20427bc0..32025e6b0 100644
--- a/modules/chanserv/log.cpp
+++ b/modules/chanserv/log.cpp
@@ -316,7 +316,9 @@ public:
source.Reply(_("Logging is now active for command \002{0}\002 on \002{1}\002, using log method \002{2}{3}{4}\002."), !command_name.empty() ? command_name : service_name, bi ? bi->nick : "any service", method, extra.empty() ? "" : " ", extra);
}
else
+ {
this->OnSyntaxError(source, "");
+ }
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand) override
@@ -406,7 +408,9 @@ class CSLog : public Module
log->SetCommandName(d.command);
}
else
+ {
log->SetServiceName(d.command);
+ }
spacesepstream sep(d.method);
Anope::string method, extra;
diff --git a/modules/chanserv/main/chanserv.cpp b/modules/chanserv/main/chanserv.cpp
index dc44173a0..59181e806 100644
--- a/modules/chanserv/main/chanserv.cpp
+++ b/modules/chanserv/main/chanserv.cpp
@@ -256,7 +256,9 @@ class ChanServCore : public Module
defaults.push_back("SIGNKICK");
}
else if (defaults[0].equals_ci("none"))
+ {
defaults.clear();
+ }
always_lower = conf->GetModule(this)->Get<bool>("always_lower_ts");
}
diff --git a/modules/chanserv/mode.cpp b/modules/chanserv/mode.cpp
index 4ff1ce1d3..7a9fd38d6 100644
--- a/modules/chanserv/mode.cpp
+++ b/modules/chanserv/mode.cpp
@@ -323,7 +323,8 @@ class CommandCSMode : public Command
source.Reply(_("Unknown mode character \002{0}\002 ignored."), modes[i]);
break;
}
- else if (u && !cm->CanSet(u))
+
+ if (u && !cm->CanSet(u))
{
source.Reply(_("You may not (un)lock mode \002{0}\002."), modes[i]);
break;
@@ -331,27 +332,36 @@ class CommandCSMode : public Command
Anope::string mode_param;
if (((cm->type == MODE_STATUS || cm->type == MODE_LIST) && !sep.GetToken(mode_param)) || (cm->type == MODE_PARAM && adding && !sep.GetToken(mode_param)))
+ {
source.Reply(_("Missing parameter for mode \002{0}\002."), cm->mchar);
- else if (cm->type == MODE_LIST && ci->c && IRCD->GetMaxListFor(ci->c) && ci->c->HasMode(cm->name) >= IRCD->GetMaxListFor(ci->c))
+ break;
+ }
+
+ if (cm->type == MODE_LIST && ci->c && IRCD->GetMaxListFor(ci->c) && ci->c->HasMode(cm->name) >= IRCD->GetMaxListFor(ci->c))
+ {
source.Reply(_("List for mode \002{0}\002 is full."), cm->mchar);
- else if (ci->GetRefs<ModeLock *>().size() >= Config->GetModule(this->GetOwner())->Get<unsigned>("max", "32"))
+ break;
+ }
+
+ if (ci->GetRefs<ModeLock *>().size() >= Config->GetModule(this->GetOwner())->Get<unsigned>("max", "32"))
+ {
source.Reply(_("The mode lock list of \002{0}\002 is full."), ci->GetName());
+ break;
+ }
+
+ mlocks->SetMLock(ci, cm, adding, mode_param, source.GetNick());
+
+ if (adding)
+ {
+ pos += cm->mchar;
+ if (!mode_param.empty())
+ pos_params += " " + mode_param;
+ }
else
{
- mlocks->SetMLock(ci, cm, adding, mode_param, source.GetNick());
-
- if (adding)
- {
- pos += cm->mchar;
- if (!mode_param.empty())
- pos_params += " " + mode_param;
- }
- else
- {
- neg += cm->mchar;
- if (!mode_param.empty())
- neg_params += " " + mode_param;
- }
+ neg += cm->mchar;
+ if (!mode_param.empty())
+ neg_params += " " + mode_param;
}
}
}
@@ -368,7 +378,9 @@ class CommandCSMode : public Command
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to lock " << reply;
}
else if (needreply)
+ {
source.Reply(_("Nothing to do."));
+ }
if (ci->c)
ci->c->CheckModes();
@@ -400,7 +412,8 @@ class CommandCSMode : public Command
source.Reply(_("Unknown mode character \002{0}\002 ignored."), modes[i]);
break;
}
- else if (u && !cm->CanSet(u))
+
+ if (u && !cm->CanSet(u))
{
source.Reply(_("You may not (un)lock mode \002{0}\002."), modes[i]);
break;
@@ -408,18 +421,21 @@ class CommandCSMode : public Command
Anope::string mode_param;
if (cm->type != MODE_REGULAR && !sep.GetToken(mode_param))
+ {
source.Reply(_("Missing parameter for mode \002{0}\002."), cm->mchar);
+ break;
+ }
+
+ if (mlocks->RemoveMLock(ci, cm, adding, mode_param))
+ {
+ if (!mode_param.empty())
+ mode_param = " " + mode_param;
+ source.Reply(_("\002{0}{1}{2}\002 has been unlocked from \002{3}\002."), adding == 1 ? '+' : '-', cm->mchar, mode_param, ci->GetName());
+ Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to unlock " << (adding ? '+' : '-') << cm->mchar << mode_param;
+ }
else
{
- if (mlocks->RemoveMLock(ci, cm, adding, mode_param))
- {
- if (!mode_param.empty())
- mode_param = " " + mode_param;
- source.Reply(_("\002{0}{1}{2}\002 has been unlocked from \002{3}\002."), adding == 1 ? '+' : '-', cm->mchar, mode_param, ci->GetName());
- Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to unlock " << (adding ? '+' : '-') << cm->mchar << mode_param;
- }
- else
- source.Reply(_("\002{0}{1}\002 is not locked on \002{2}\002."), adding == 1 ? '+' : '-', cm->mchar, ci->GetName());
+ source.Reply(_("\002{0}{1}\002 is not locked on \002{2}\002."), adding == 1 ? '+' : '-', cm->mchar, ci->GetName());
}
}
}
@@ -462,7 +478,9 @@ class CommandCSMode : public Command
source.Reply(replies[i]);
}
else
+ {
this->OnSyntaxError(source, subcommand);
+ }
}
void DoSet(CommandSource &source, ChanServ::Channel *ci, const std::vector<Anope::string> &params)
@@ -646,7 +664,9 @@ class CommandCSMode : public Command
ChannelMode *cm;
if (param.length() == 1)
+ {
cm = ModeManager::FindChannelModeByChar(param[0]);
+ }
else
{
cm = ModeManager::FindChannelModeByName(param.upper());
@@ -703,9 +723,13 @@ class CommandCSMode : public Command
this->DoLock(source, ci, params);
}
else if (!ci->c)
+ {
source.Reply(_("Channel \002{0}\002 doesn't exist."), ci->GetName());
+ }
else if (subcommand.equals_ci("SET") && params.size() > 2)
+ {
this->DoSet(source, ci, params);
+ }
else if (subcommand.equals_ci("CLEAR"))
{
if (!source.AccessFor(ci).HasPriv("MODE") && !source.HasPriv("chanserv/administration"))
@@ -714,7 +738,9 @@ class CommandCSMode : public Command
this->DoClear(source, ci, params);
}
else
+ {
this->OnSyntaxError(source, "");
+ }
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand) override
@@ -796,7 +822,9 @@ class CommandCSModes : public Command
return;
}
else
+ {
override = true;
+ }
}
if (!override && !m.first && u != targ && (targ->IsProtected() || (ci->HasFieldS("PEACE") && targ_access >= u_access)))
@@ -807,7 +835,9 @@ class CommandCSModes : public Command
return;
}
else
+ {
override = true;
+ }
}
if (!ci->c->FindUser(targ))
@@ -835,7 +865,9 @@ class CommandCSModes : public Command
return Anope::printf(Language::Translate(source.GetAccount(), _("Removes %s status from you or the specified nick on a channel")), m.second.c_str());
}
else
+ {
return "";
+ }
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand) override
diff --git a/modules/chanserv/register.cpp b/modules/chanserv/register.cpp
index 3affb8b43..0c7d77a8f 100644
--- a/modules/chanserv/register.cpp
+++ b/modules/chanserv/register.cpp
@@ -107,7 +107,7 @@ class CommandCSRegister : public Command
ci->SetLastUsed(Anope::CurTime);
ci->SetBanType(2);
- ci->c = c; // XXX? this isnt set on reconstrubted objects?
+ ci->c = c;
c->ci = ci;
if (c && !c->topic.empty())
diff --git a/modules/chanserv/set.cpp b/modules/chanserv/set.cpp
index 27ad49fa6..1d49629db 100644
--- a/modules/chanserv/set.cpp
+++ b/modules/chanserv/set.cpp
@@ -128,7 +128,9 @@ class CommandCSSetAutoOp : public Command
source.Reply(_("Services will no longer automatically give modes to users in \002{0}\002."), ci->GetName());
}
else
+ {
this->OnSyntaxError(source, "AUTOOP");
+ }
}
bool OnHelp(CommandSource &source, const Anope::string &) override
@@ -392,7 +394,9 @@ class CommandCSSetKeepModes : public Command
m->Delete();
}
else
+ {
this->OnSyntaxError(source, "KEEPMODES");
+ }
}
bool OnHelp(CommandSource &source, const Anope::string &) override
@@ -453,7 +457,9 @@ class CommandCSSetPeace : public Command
source.Reply(_("Peace option for \002{0}\002 is now \002off\002."), ci->GetName());
}
else
+ {
this->OnSyntaxError(source, "PEACE");
+ }
}
bool OnHelp(CommandSource &source, const Anope::string &) override
@@ -605,7 +611,9 @@ class CommandCSSetPersist : public Command
source.Reply(_("Channel \002{0}\002 is no longer persistent."), ci->GetName());
}
else
+ {
this->OnSyntaxError(source, "PERSIST");
+ }
}
bool OnHelp(CommandSource &source, const Anope::string &) override
@@ -667,7 +675,9 @@ class CommandCSSetRestricted : public Command
source.Reply(_("Restricted access option for \002{0}\002 is now \002off\002."), ci->GetName());
}
else
+ {
this->OnSyntaxError(source, "RESTRICTED");
+ }
}
bool OnHelp(CommandSource &source, const Anope::string &) override
@@ -728,7 +738,9 @@ class CommandCSSetSecure : public Command
source.Reply(_("Secure option for \002{0}\002 is now \002off\002."), ci->GetName());
}
else
+ {
this->OnSyntaxError(source, "SECURE");
+ }
}
bool OnHelp(CommandSource &source, const Anope::string &) override
@@ -791,7 +803,9 @@ class CommandCSSetSecureFounder : public Command
source.Reply(_("Secure founder option for \002{0}\002 is now \002off\002."), ci->GetName());
}
else
+ {
this->OnSyntaxError(source, "SECUREFOUNDER");
+ }
}
bool OnHelp(CommandSource &source, const Anope::string &) override
@@ -857,7 +871,9 @@ class CommandCSSetSecureOps : public Command
source.Reply(_("Secure ops option for \002{0}\002 is now \002off\002."), ci->GetName());
}
else
+ {
this->OnSyntaxError(source, "SECUREOPS");
+ }
}
bool OnHelp(CommandSource &source, const Anope::string &) override
@@ -928,7 +944,9 @@ class CommandCSSetSignKick : public Command
Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to disable sign kick";
}
else
+ {
this->OnSyntaxError(source, "SIGNKICK");
+ }
}
bool OnHelp(CommandSource &source, const Anope::string &) override
@@ -979,7 +997,7 @@ class CommandCSSetSuccessor : public Command
return;
}
- NickServ::Account *nc;
+ NickServ::Account *nc = nullptr;
if (!param.empty())
{
@@ -999,8 +1017,6 @@ class CommandCSSetSuccessor : public Command
nc = na->GetAccount();
}
- else
- nc = NULL;
Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to change the successor from " << (ci->GetSuccessor() ? ci->GetSuccessor()->GetDisplay() : "(none)") << " to " << (nc ? nc->GetDisplay() : "(none)");
@@ -1067,7 +1083,9 @@ class CommandCSSetNoexpire : public Command
source.Reply(_("Channel \002{0} will\002 expire."), ci->GetName());
}
else
+ {
this->OnSyntaxError(source, "NOEXPIRE");
+ }
}
bool OnHelp(CommandSource &source, const Anope::string &) override
diff --git a/modules/chanserv/status.cpp b/modules/chanserv/status.cpp
index 3e4b669d3..81834a3e6 100644
--- a/modules/chanserv/status.cpp
+++ b/modules/chanserv/status.cpp
@@ -54,7 +54,9 @@ public:
User *u = User::Find(nick, true);
NickServ::Nick *na = NULL;
if (u != NULL)
+ {
ag = ci->AccessFor(u);
+ }
else
{
na = NickServ::FindNick(nick);
@@ -63,11 +65,17 @@ public:
}
if (ag.super_admin)
+ {
source.Reply(_("\002{0}\002 is a super administrator."), nick);
+ }
else if (ag.founder)
+ {
source.Reply(_("\002{0}\002 is the founder of \002{1}\002."), nick, ci->GetName());
+ }
else if (ag.empty())
+ {
source.Reply(_("\002{0}\002 has no access on \002{1}\002."), nick, ci->GetName());
+ }
else
{
source.Reply(_("Access for \002{0}\002 on \002{1}\002:"), nick, ci->GetName());
diff --git a/modules/chanserv/statusupdate.cpp b/modules/chanserv/statusupdate.cpp
index 0d3a25d0f..bc9ef833c 100644
--- a/modules/chanserv/statusupdate.cpp
+++ b/modules/chanserv/statusupdate.cpp
@@ -23,6 +23,32 @@ class StatusUpdate : public Module
, public EventHook<Event::AccessAdd>
, public EventHook<Event::AccessDel>
{
+ void ApplyModes(ChanServ::Channel *ci, ChanServ::ChanAccess *access, bool set)
+ {
+ if (ci->c == nullptr)
+ return;
+
+ for (Channel::ChanUserList::iterator it = ci->c->users.begin(), it_end = ci->c->users.end(); it != it_end; ++it)
+ {
+ User *user = it->second->user;
+
+ if (user->server != Me && access->Matches(user, user->Account()))
+ {
+ ChanServ::AccessGroup ag = ci->AccessFor(user);
+
+ for (unsigned i = 0; i < ModeManager::GetStatusChannelModesByRank().size(); ++i)
+ {
+ ChannelModeStatus *cms = ModeManager::GetStatusChannelModesByRank()[i];
+ if (!ag.HasPriv("AUTO" + cms->name))
+ ci->c->RemoveMode(NULL, cms, user->GetUID());
+ }
+
+ if (set)
+ ci->c->SetCorrectModes(user, true);
+ }
+ }
+ }
+
public:
StatusUpdate(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR)
, EventHook<Event::AccessAdd>(this)
@@ -33,46 +59,13 @@ class StatusUpdate : public Module
void OnAccessAdd(ChanServ::Channel *ci, CommandSource &, ChanServ::ChanAccess *access) override
{
- if (ci->c)
- for (Channel::ChanUserList::iterator it = ci->c->users.begin(), it_end = ci->c->users.end(); it != it_end; ++it)
- {
- User *user = it->second->user;
-
- if (user->server != Me && access->Matches(user, user->Account()))
- {
- ChanServ::AccessGroup ag = ci->AccessFor(user);
-
- for (unsigned i = 0; i < ModeManager::GetStatusChannelModesByRank().size(); ++i)
- {
- ChannelModeStatus *cms = ModeManager::GetStatusChannelModesByRank()[i];
- if (!ag.HasPriv("AUTO" + cms->name))
- ci->c->RemoveMode(NULL, cms, user->GetUID());
- }
- ci->c->SetCorrectModes(user, true);
- }
- }
+ ApplyModes(ci, access, true);
}
// XXX this relies on the access entry already being removed from the list?
void OnAccessDel(ChanServ::Channel *ci, CommandSource &, ChanServ::ChanAccess *access) override
{
- if (ci->c)
- for (Channel::ChanUserList::iterator it = ci->c->users.begin(), it_end = ci->c->users.end(); it != it_end; ++it)
- {
- User *user = it->second->user;
-
- if (user->server != Me && access->Matches(user, user->Account()))
- {
- ChanServ::AccessGroup ag = ci->AccessFor(user);
-
- for (unsigned i = 0; i < ModeManager::GetStatusChannelModesByRank().size(); ++i)
- {
- ChannelModeStatus *cms = ModeManager::GetStatusChannelModesByRank()[i];
- if (!ag.HasPriv("AUTO" + cms->name))
- ci->c->RemoveMode(NULL, cms, user->GetUID());
- }
- }
- }
+ ApplyModes(ci, access, false);
}
};
diff --git a/modules/chanserv/topic.cpp b/modules/chanserv/topic.cpp
index fe9d2a80f..76a816c13 100644
--- a/modules/chanserv/topic.cpp
+++ b/modules/chanserv/topic.cpp
@@ -73,7 +73,9 @@ class CommandCSSetKeepTopic : public Command
source.Reply(_("Topic retention option for \002{0}\002 is now \002off\002."), ci->GetName());
}
else
+ {
this->OnSyntaxError(source, "KEEPTOPIC");
+ }
}
bool OnHelp(CommandSource &source, const Anope::string &) override
@@ -146,7 +148,9 @@ class CommandCSTopic : public Command
ci->SetLastTopic("");
}
else
+ {
new_topic = topic;
+ }
this->Set(source, ci, new_topic);
}
@@ -168,17 +172,33 @@ class CommandCSTopic : public Command
ChanServ::Channel *ci = ChanServ::Find(channel);
if (ci == NULL)
+ {
source.Reply(_("Channel \002{0}\002 isn't registered."), channel);
- else if (!source.AccessFor(ci).HasPriv("TOPIC") && !source.HasCommand("chanserv/topic"))
+ return;
+ }
+
+ if (!source.AccessFor(ci).HasPriv("TOPIC") && !source.HasCommand("chanserv/topic"))
+ {
source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "TOPIC", ci->GetName());
- else if (subcmd.equals_ci("LOCK"))
+ return;
+ }
+
+ if (subcmd.equals_ci("LOCK"))
+ {
this->Lock(source, ci, params);
+ }
else if (subcmd.equals_ci("UNLOCK"))
+ {
this->Unlock(source, ci, params);
+ }
else if (!ci->c)
+ {
source.Reply(_("Channel \002{0}\002 doesn't exist."), ci->GetName());
+ }
else if (subcmd.equals_ci("APPEND") && params.size() > 2)
+ {
this->Append(source, ci, params);
+ }
else
{
Anope::string topic;
@@ -192,6 +212,7 @@ class CommandCSTopic : public Command
if (params.size() > 2)
topic += " " + params[2];
}
+
this->Set(source, ci, topic);
}
}
diff --git a/modules/chanserv/unban.cpp b/modules/chanserv/unban.cpp
index c4ee62e21..035819ff2 100644
--- a/modules/chanserv/unban.cpp
+++ b/modules/chanserv/unban.cpp
@@ -96,6 +96,7 @@ class CommandCSUnban : public Command
for (unsigned i = 0; i < modes.size(); ++i)
ci->c->Unban(u2, modes[i]->name, source.GetUser() == u2);
+
if (u2 == source.GetUser())
source.Reply(_("You have been unbanned from \002{0}\002."), ci->c->name);
else
diff --git a/modules/chanserv/updown.cpp b/modules/chanserv/updown.cpp
index baa540163..8df6be26b 100644
--- a/modules/chanserv/updown.cpp
+++ b/modules/chanserv/updown.cpp
@@ -69,72 +69,70 @@ class CommandCSUp : public Command
SetModes(source.GetUser(), c);
}
Log(LOG_COMMAND, source, this, NULL) << "on all channels to update their status modes";
+ return;
}
- else
- {
- const Anope::string &chan = params[0];
- const Anope::string &nick = params.size() > 1 ? params[1] : source.GetNick();
- ChanServ::Channel *ci = ChanServ::Find(chan);
- if (ci == NULL)
- {
- source.Reply(_("Channel \002{0}\002 isn't registered."), chan);
- return;
- }
+ const Anope::string &chan = params[0];
+ const Anope::string &nick = params.size() > 1 ? params[1] : source.GetNick();
- if (ci->c == NULL)
- {
- source.Reply(_("Channel \002{0}\002 doesn't exist."), ci->GetName());
- return;
- }
+ ChanServ::Channel *ci = ChanServ::Find(chan);
+ if (ci == NULL)
+ {
+ source.Reply(_("Channel \002{0}\002 isn't registered."), chan);
+ return;
+ }
- User *u = User::Find(nick, true);
- User *srcu = source.GetUser();
- Channel *c = ci->c;
- bool override = false;
+ if (ci->c == NULL)
+ {
+ source.Reply(_("Channel \002{0}\002 doesn't exist."), ci->GetName());
+ return;
+ }
- if (u == NULL)
- {
- source.Reply(_("User \002{0}\002 isn't currently online."), nick);
- return;
- }
+ User *u = User::Find(nick, true);
+ User *srcu = source.GetUser();
+ Channel *c = ci->c;
+ bool override = false;
- if (srcu && !srcu->FindChannel(c))
- {
- source.Reply(_("You must be in \002%s\002 to use this command."), c->name.c_str());
- return;
- }
+ if (u == NULL)
+ {
+ source.Reply(_("User \002{0}\002 isn't currently online."), nick);
+ return;
+ }
- if (!u->FindChannel(c))
- {
- source.Reply(_("You must be on channel \002{0}\002 to use this command."), c->name);
- return;
- }
+ if (srcu && !srcu->FindChannel(c))
+ {
+ source.Reply(_("You must be in \002%s\002 to use this command."), c->name.c_str());
+ return;
+ }
- if (!u->FindChannel(c))
- {
- source.Reply(_("\002{0}\002 is not on channel \002{1}\002."), u->nick, c->name);
- return;
- }
+ if (!u->FindChannel(c))
+ {
+ source.Reply(_("You must be on channel \002{0}\002 to use this command."), c->name);
+ return;
+ }
+
+ if (!u->FindChannel(c))
+ {
+ source.Reply(_("\002{0}\002 is not on channel \002{1}\002."), u->nick, c->name);
+ return;
+ }
- if (source.GetUser() && u != source.GetUser() && c->ci->HasFieldS("PEACE"))
+ if (source.GetUser() && u != source.GetUser() && c->ci->HasFieldS("PEACE"))
+ {
+ if (c->ci->AccessFor(u) >= c->ci->AccessFor(source.GetUser()))
{
- if (c->ci->AccessFor(u) >= c->ci->AccessFor(source.GetUser()))
+ if (source.HasPriv("chanserv/administration"))
+ override = true;
+ else
{
- if (source.HasPriv("chanserv/administration"))
- override = true;
- else
- {
- source.Reply(_("Access denied. \002{0}\002 has more privileges than you on \002{1}\002."), u->nick, ci->GetName());
- return;
- }
+ source.Reply(_("Access denied. \002{0}\002 has more privileges than you on \002{1}\002."), u->nick, ci->GetName());
+ return;
}
}
-
- Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, c->ci) << "to update the status modes of " << u->nick;
- SetModes(u, c);
}
+ Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, c->ci) << "to update the status modes of " << u->nick;
+ SetModes(u, c);
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand) override
@@ -175,72 +173,71 @@ class CommandCSDown : public Command
RemoveAll(source.GetUser(), c);
}
Log(LOG_COMMAND, source, this, NULL) << "on all channels to remove their status modes";
+ return;
}
- else
- {
- const Anope::string &channel = params[0];
- const Anope::string &nick = params.size() > 1 ? params[1] : source.GetNick();
- ChanServ::Channel *ci = ChanServ::Find(channel);
- if (ci == NULL)
- {
- source.Reply(_("Channel \002{0}\002 isn't registered."), channel);
- return;
- }
+ const Anope::string &channel = params[0];
+ const Anope::string &nick = params.size() > 1 ? params[1] : source.GetNick();
- if (ci->c == NULL)
- {
- source.Reply(_("Channel \002{0}\002 doesn't exist."), ci->GetName());
- return;
- }
+ ChanServ::Channel *ci = ChanServ::Find(channel);
+ if (ci == NULL)
+ {
+ source.Reply(_("Channel \002{0}\002 isn't registered."), channel);
+ return;
+ }
- User *u = User::Find(nick, true);
- Channel *c = ci->c;
+ if (ci->c == NULL)
+ {
+ source.Reply(_("Channel \002{0}\002 doesn't exist."), ci->GetName());
+ return;
+ }
- User *srcu = source.GetUser();
- bool override = false;
+ User *u = User::Find(nick, true);
+ Channel *c = ci->c;
- if (u == NULL)
- {
- source.Reply(_("User \002{0}\002 isn't currently online."), nick);
- return;
- }
+ User *srcu = source.GetUser();
+ bool override = false;
- if (srcu && !srcu->FindChannel(c))
- {
- source.Reply(_("You must be on channel \002{0}\002 to use this command."), c->name);
- return;
- }
+ if (u == NULL)
+ {
+ source.Reply(_("User \002{0}\002 isn't currently online."), nick);
+ return;
+ }
- if (srcu && !srcu->FindChannel(c))
- {
- source.Reply(_("You must be in \002%s\002 to use this command."), c->name.c_str());
- return;
- }
+ if (srcu && !srcu->FindChannel(c))
+ {
+ source.Reply(_("You must be on channel \002{0}\002 to use this command."), c->name);
+ return;
+ }
- if (!u->FindChannel(c))
- {
- source.Reply(_("\002%s\002 is not on channel %s."), u->nick, c->name);
- return;
- }
+ if (srcu && !srcu->FindChannel(c))
+ {
+ source.Reply(_("You must be in \002%s\002 to use this command."), c->name.c_str());
+ return;
+ }
+
+ if (!u->FindChannel(c))
+ {
+ source.Reply(_("\002%s\002 is not on channel %s."), u->nick, c->name);
+ return;
+ }
- if (source.GetUser() && u != source.GetUser() && c->ci->HasFieldS("PEACE"))
+ if (source.GetUser() && u != source.GetUser() && c->ci->HasFieldS("PEACE"))
+ {
+ if (c->ci->AccessFor(u) >= c->ci->AccessFor(source.GetUser()))
{
- if (c->ci->AccessFor(u) >= c->ci->AccessFor(source.GetUser()))
+ if (source.HasPriv("chanserv/administration"))
+ override = true;
+ else
{
- if (source.HasPriv("chanserv/administration"))
- override = true;
- else
- {
- source.Reply(_("Access denied. \002{0}\002 has more privileges than you on \002{1}\002."), u->nick, ci->GetName());
- return;
- }
+ source.Reply(_("Access denied. \002{0}\002 has more privileges than you on \002{1}\002."), u->nick, ci->GetName());
+ return;
}
}
-
- Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, c->ci) << "to remove the status modes from " << u->nick;
- RemoveAll(u, c);
}
+
+ Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, c->ci) << "to remove the status modes from " << u->nick;
+ RemoveAll(u, c);
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand) override
diff --git a/modules/chanserv/xop.cpp b/modules/chanserv/xop.cpp
index 5ccf389dc..4e113f25e 100644
--- a/modules/chanserv/xop.cpp
+++ b/modules/chanserv/xop.cpp
@@ -431,7 +431,9 @@ class CommandCSXOP : public Command
}
if (list.IsEmpty())
+ {
source.Reply(_("No matching entries on %s access list."), ci->GetName().c_str());
+ }
else
{
std::vector<Anope::string> replies;
diff --git a/modules/hostserv/add.cpp b/modules/hostserv/add.cpp
index 240324470..f9388c975 100644
--- a/modules/hostserv/add.cpp
+++ b/modules/hostserv/add.cpp
@@ -51,7 +51,9 @@ class CommandHSAdd : public Command
size_t a = rawhostmask.find('@');
if (a == Anope::string::npos)
+ {
host = rawhostmask;
+ }
else
{
user = rawhostmask.substr(0, a);
diff --git a/modules/hostserv/list.cpp b/modules/hostserv/list.cpp
index cbb69aa85..8659675d4 100644
--- a/modules/hostserv/list.cpp
+++ b/modules/hostserv/list.cpp
@@ -120,7 +120,9 @@ class CommandHSList : public Command
}
if (!key.empty())
+ {
source.Reply(_("Displayed records matching key \002{0}\002 (count: \002{1}\002)."), key, display_counter);
+ }
else
{
if (from)
diff --git a/modules/hostserv/request.cpp b/modules/hostserv/request.cpp
index 47914ee0e..3cae04b8a 100644
--- a/modules/hostserv/request.cpp
+++ b/modules/hostserv/request.cpp
@@ -158,7 +158,9 @@ class CommandHSRequest : public Command
size_t a = rawhostmask.find('@');
if (a == Anope::string::npos)
+ {
host = rawhostmask;
+ }
else
{
user = rawhostmask.substr(0, a);
diff --git a/modules/memoserv/del.cpp b/modules/memoserv/del.cpp
index 17ef2a39f..fbefe180e 100644
--- a/modules/memoserv/del.cpp
+++ b/modules/memoserv/del.cpp
@@ -62,7 +62,9 @@ class CommandMSDel : public Command
mi = ci->GetMemos();
}
else
+ {
mi = source.nc->GetMemos();
+ }
if (numstr.empty() || (!isdigit(numstr[0]) && !numstr.equals_ci("ALL") && !numstr.equals_ci("LAST")))
{
diff --git a/modules/memoserv/ignore.cpp b/modules/memoserv/ignore.cpp
index 42e94a609..520aeaf7f 100644
--- a/modules/memoserv/ignore.cpp
+++ b/modules/memoserv/ignore.cpp
@@ -130,7 +130,9 @@ class CommandMSIgnore : public Command
source.Reply(replies[i]);
}
else
+ {
this->OnSyntaxError(source, "");
+ }
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand) override
diff --git a/modules/memoserv/info.cpp b/modules/memoserv/info.cpp
index aff622b21..05ca0c213 100644
--- a/modules/memoserv/info.cpp
+++ b/modules/memoserv/info.cpp
@@ -45,6 +45,7 @@ class CommandMSInfo : public Command
source.Reply(_("\002{0}\002 isn't registered."), nname);
return;
}
+
mi = na->GetAccount()->GetMemos();
hardmax = na->GetAccount()->HasFieldS("MEMO_HARDMAX");
}
@@ -76,6 +77,7 @@ class CommandMSInfo : public Command
mi = nc->GetMemos();
hardmax = nc->HasFieldS("MEMO_HARDMAX");
}
+
if (!mi)
return;
@@ -115,7 +117,9 @@ class CommandMSInfo : public Command
source.Reply(_("The memo limit of \002{0}\002 is \002{1}\002."), nname, mi->GetMemoMax());
}
else
+ {
source.Reply(_("\002{0}\002 has no memo limit."), nname);
+ }
if (na)
{
@@ -132,7 +136,9 @@ class CommandMSInfo : public Command
else
{
if (memos.empty())
+ {
source.Reply(_("You currently have no memos."));
+ }
else if (memos.size() == 1)
{
if (mi->GetMemo(0)->GetUnread())
@@ -196,7 +202,9 @@ class CommandMSInfo : public Command
source.Reply(_("You will be notified of new memos at logon."));
}
else
+ {
source.Reply(_("You will not be notified of new memos."));
+ }
}
}
diff --git a/modules/memoserv/list.cpp b/modules/memoserv/list.cpp
index 0fd169cc2..4b8a4bff6 100644
--- a/modules/memoserv/list.cpp
+++ b/modules/memoserv/list.cpp
@@ -56,7 +56,9 @@ class CommandMSList : public Command
mi = ci->GetMemos();
}
else
+ {
mi = source.nc->GetMemos();
+ }
if (!param.empty() && !isdigit(param[0]) && !param.equals_ci("NEW"))
{
diff --git a/modules/memoserv/main/memoserv.cpp b/modules/memoserv/main/memoserv.cpp
index 364a22534..4fe747472 100644
--- a/modules/memoserv/main/memoserv.cpp
+++ b/modules/memoserv/main/memoserv.cpp
@@ -101,11 +101,11 @@ class MemoServCore : public Module, public MemoServ::MemoServService
time_t send_delay = Config->GetModule("memoserv/main")->Get<time_t>("senddelay");
if (send_delay > 0 && sender->lastmemosend + send_delay > Anope::CurTime)
return MEMO_TOO_FAST;
- else if (!mi->GetMemoMax())
+ if (!mi->GetMemoMax())
return MEMO_TARGET_FULL;
- else if (mi->GetMemoMax() > 0 && mi->GetMemos().size() >= static_cast<unsigned>(mi->GetMemoMax()))
+ if (mi->GetMemoMax() > 0 && mi->GetMemos().size() >= static_cast<unsigned>(mi->GetMemoMax()))
return MEMO_TARGET_FULL;
- else if (mi->HasIgnore(sender))
+ if (mi->HasIgnore(sender))
return MEMO_SUCCESS;
}
@@ -194,7 +194,9 @@ class MemoServCore : public Module, public MemoServ::MemoServService
return ci->GetMemos();
}
else
+ {
is_registered = false;
+ }
}
else
{
@@ -211,7 +213,9 @@ class MemoServCore : public Module, public MemoServ::MemoServService
return na->GetAccount()->GetMemos();
}
else
+ {
is_registered = false;
+ }
}
return NULL;
diff --git a/modules/memoserv/read.cpp b/modules/memoserv/read.cpp
index 62d6cd4d2..c875c8db9 100644
--- a/modules/memoserv/read.cpp
+++ b/modules/memoserv/read.cpp
@@ -93,7 +93,6 @@ class CommandMSRead : public Command
void Execute(CommandSource &source, const std::vector<Anope::string> &params) override
{
-
MemoServ::MemoInfo *mi;
ChanServ::Channel *ci = NULL;
Anope::string numstr = params[0], chan;
@@ -119,7 +118,9 @@ class CommandMSRead : public Command
mi = ci->GetMemos();
}
else
+ {
mi = source.nc->GetMemos();
+ }
if (numstr.empty() || (!numstr.equals_ci("LAST") && !numstr.equals_ci("NEW") && numstr.find_first_not_of("0123456789.,-") != Anope::string::npos))
{
diff --git a/modules/memoserv/send.cpp b/modules/memoserv/send.cpp
index 98567c3e2..418a82c21 100644
--- a/modules/memoserv/send.cpp
+++ b/modules/memoserv/send.cpp
@@ -56,11 +56,17 @@ class CommandMSSend : public Command
Log(LOG_COMMAND, source, this) << "to send a memo to " << nick;
}
else if (result == MemoServ::MemoServService::MEMO_INVALID_TARGET)
+ {
source.Reply(_("\002{0}\002 is not a registered unforbidden nick or channel."), nick);
+ }
else if (result == MemoServ::MemoServService::MEMO_TOO_FAST)
+ {
source.Reply(_("Please wait \002{0}\002 seconds before using the \002{1}\002 command again."), Config->GetModule("memoserv/main")->Get<time_t>("senddelay"), source.command);
+ }
else if (result == MemoServ::MemoServService::MEMO_TARGET_FULL)
+ {
source.Reply(_("Sorry, \002{0}\002 currently has too many memos and cannot receive more."), nick);
+ }
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand) override
diff --git a/modules/memoserv/set.cpp b/modules/memoserv/set.cpp
index acb575084..13d24bd98 100644
--- a/modules/memoserv/set.cpp
+++ b/modules/memoserv/set.cpp
@@ -57,7 +57,9 @@ class CommandMSSet : public Command
source.Reply(_("You will now be informed about new memos via email."));
}
else
+ {
source.Reply(_("There's no email address set for your nick."));
+ }
}
else if (param.equals_ci("NOMAIL"))
{
@@ -72,7 +74,9 @@ class CommandMSSet : public Command
source.Reply(_("\002{0}\002 will not send you any notification of memos."), MemoServ->nick);
}
else
+ {
this->OnSyntaxError(source, "");
+ }
}
void DoLimit(CommandSource &source, const std::vector<Anope::string> &params, MemoServ::MemoInfo *mi)
@@ -106,8 +110,10 @@ class CommandMSSet : public Command
source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "MEMO", ci->GetName());
return;
}
+
mi = ci->GetMemos();
}
+
if (is_servadmin)
{
if (!p2.empty() && !p2.equals_ci("HARD") && chan.empty())
@@ -185,7 +191,9 @@ class CommandMSSet : public Command
return;
}
}
+
mi->SetMemoMax(limit);
+
if (limit > 0)
{
if (chan.empty() && nc == source.nc)
@@ -248,6 +256,7 @@ class CommandMSSet : public Command
Config->StrictPrivmsg, source.service->nick, help->cname, source.command);
}
else if (subcommand.equals_ci("NOTIFY"))
+ {
source.Reply(_("Syntax: \002NOTIFY {ON | LOGON | NEW | MAIL | NOMAIL | OFF}\002\n"
"\n"
"Changes when you will be notified about new memos:\n"
@@ -270,6 +279,7 @@ class CommandMSSet : public Command
" OFF You will not receive any notification of memos.\n"
"\n"
"\002ON\002 is essentially \002LOGON\002 and \002NEW\002 combined."));
+ }
else if (subcommand.equals_ci("LIMIT"))
{
int max_memos = Config->GetModule("memoserv/main")->Get<int>("maxmemos");
@@ -294,7 +304,9 @@ class CommandMSSet : public Command
"However, you cannot set this any higher than {0}."), max_memos);
}
else
+ {
return false;
+ }
return true;
}
diff --git a/modules/nickserv/access.cpp b/modules/nickserv/access.cpp
index fb068e92b..48d2e3bdc 100644
--- a/modules/nickserv/access.cpp
+++ b/modules/nickserv/access.cpp
@@ -198,14 +198,18 @@ class CommandNSAccess : public Command
nc = na->GetAccount();
}
else
+ {
nc = source.nc;
+ }
if (!mask.empty() && (mask.find('@') == Anope::string::npos || mask.find('!') != Anope::string::npos))
{
source.Reply(_("Mask must be in the form \037user\037@\037host\037."));
source.Reply(_("\002%s%s HELP %s\002 for more information."), Config->StrictPrivmsg, source.service->nick, source.command); // XXX
+ return;
}
- else if (cmd.equals_ci("LIST"))
+
+ if (cmd.equals_ci("LIST"))
return this->DoList(source, nc, mask);
else if (nc->HasFieldS("NS_SUSPENDED"))
source.Reply(_("\002{0}\002 is suspended."), nc->GetDisplay());
diff --git a/modules/nickserv/cert.cpp b/modules/nickserv/cert.cpp
index 94978fd88..93804d3ed 100644
--- a/modules/nickserv/cert.cpp
+++ b/modules/nickserv/cert.cpp
@@ -279,7 +279,9 @@ class CommandNSCert : public Command
nc = na->GetAccount();
}
else
+ {
nc = source.nc;
+ }
if (cmd.equals_ci("LIST"))
return this->DoList(source, nc);
diff --git a/modules/nickserv/main/nickserv.cpp b/modules/nickserv/main/nickserv.cpp
index 461925927..c41f3b3f3 100644
--- a/modules/nickserv/main/nickserv.cpp
+++ b/modules/nickserv/main/nickserv.cpp
@@ -240,7 +240,8 @@ class NickServCore : public Module, public NickServ::NickServService
this->Collide(u, na);
return;
}
- else if (MOD_RESULT == EVENT_ALLOW)
+
+ if (MOD_RESULT == EVENT_ALLOW)
return;
if (!na->GetAccount()->HasFieldS("NS_SECURE") && u->IsRecognized())
@@ -327,7 +328,9 @@ class NickServCore : public Module, public NickServ::NickServService
}
}
else
+ {
u->Kill(*NickServ, "Services nickname-enforcer kill");
+ }
}
void Release(NickServ::Nick *na) override
diff --git a/modules/nickserv/recover.cpp b/modules/nickserv/recover.cpp
index 0196b518d..6e4c7c6b3 100644
--- a/modules/nickserv/recover.cpp
+++ b/modules/nickserv/recover.cpp
@@ -145,7 +145,9 @@ class NSRecoverRequestListener : public NickServ::IdentifyRequestListener
}
}
else
+ {
source.Reply(_("\002{0}\002 isn't registered."), user);
+ }
}
};
diff --git a/modules/nickserv/register.cpp b/modules/nickserv/register.cpp
index 7a392dd7c..e3d4d4d23 100644
--- a/modules/nickserv/register.cpp
+++ b/modules/nickserv/register.cpp
@@ -97,7 +97,9 @@ class CommandNSConfirm : public Command
}
}
else
+ {
source.Reply(_("Invalid passcode."));
+ }
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand) override
@@ -250,7 +252,9 @@ class CommandNSRegister : public Command
na->SetLastRealname(u->realname);
}
else
+ {
na->SetLastRealname(source.GetNick());
+ }
Log(LOG_COMMAND, source, this) << "to register " << na->GetNick() << " (email: " << (!na->GetAccount()->GetEmail().empty() ? na->GetAccount()->GetEmail() : "none") << ")";
diff --git a/modules/nickserv/resetpass.cpp b/modules/nickserv/resetpass.cpp
index 2a70a6ebd..6acfc905e 100644
--- a/modules/nickserv/resetpass.cpp
+++ b/modules/nickserv/resetpass.cpp
@@ -118,7 +118,9 @@ class NSResetPass : public Module
}
}
else
+ {
return EVENT_CONTINUE;
+ }
return EVENT_STOP;
}
diff --git a/modules/nickserv/set.cpp b/modules/nickserv/set.cpp
index 7637c8e47..7b1034eca 100644
--- a/modules/nickserv/set.cpp
+++ b/modules/nickserv/set.cpp
@@ -53,6 +53,7 @@ class CommandNSSet : public Command
if (c_name.find_ci(this_name + " ") == 0)
{
ServiceReference<Command> c(info.name);
+#warning "set duplication"
// XXX dup
if (!c)
continue;
@@ -273,7 +274,9 @@ class CommandNSSetAutoOp : public Command
source.Reply(_("Services will no longer set status modes on \002{0}\002 in channels."), nc->GetDisplay());
}
else
+ {
this->OnSyntaxError(source, "AUTOOP");
+ }
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) override
@@ -573,7 +576,9 @@ class CommandNSSetKeepModes : public Command
source.Reply(_("Keep modes for \002{0}\002 is now \002off\002."), nc->GetDisplay());
}
else
+ {
this->OnSyntaxError(source, "");
+ }
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) override
@@ -683,7 +688,9 @@ class CommandNSSetKill : public Command
source.Reply(_("Protection is now \002off\002 for \002{0}\002."), nc->GetDisplay());
}
else
+ {
this->OnSyntaxError(source, "KILL");
+ }
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) override
@@ -881,7 +888,9 @@ class CommandNSSetMessage : public Command
source.Reply(_("Services will now reply to \002{0}\002 with \002notices\002."), nc->GetDisplay());
}
else
+ {
this->OnSyntaxError(source, "MSG");
+ }
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) override
@@ -976,7 +985,9 @@ class CommandNSSetSecure : public Command
source.Reply(_("Secure option is now \002off\002 for \002{0}\002."), nc->GetDisplay());
}
else
+ {
this->OnSyntaxError(source, "SECURE");
+ }
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) override
@@ -1058,7 +1069,9 @@ class CommandNSSASetNoexpire : public Command
source.Reply(_("\002{0}\002 \002will\002 expire."), na->GetNick());
}
else
+ {
this->OnSyntaxError(source, "NOEXPIRE");
+ }
}
bool OnHelp(CommandSource &source, const Anope::string &) override
diff --git a/modules/nickserv/status.cpp b/modules/nickserv/status.cpp
index c092a9b46..d31622d3d 100644
--- a/modules/nickserv/status.cpp
+++ b/modules/nickserv/status.cpp
@@ -36,6 +36,7 @@ class CommandNSStatus : public Command
spacesepstream sep(nick);
Anope::string nickbuf;
+#warning "this is all disabled"
while (sep.GetToken(nickbuf))
{
#if 0
@@ -89,7 +90,6 @@ class NSStatus : public Module
NSStatus(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR)
, commandnsstatus(this)
{
- throw ModuleException("Remind Adam to fix this");
}
};
diff --git a/modules/operserv/akill.cpp b/modules/operserv/akill.cpp
index 4da93ca05..9c4a53d23 100644
--- a/modules/operserv/akill.cpp
+++ b/modules/operserv/akill.cpp
@@ -54,8 +54,11 @@ class CommandOSAKill : public Command
source.Reply(_("Invalid expiry time \002{0}\002."), expiry);
return;
}
- else if (expires > 0)
+
+ if (expires > 0)
+ {
expires += Anope::CurTime;
+ }
if (sep.StreamEnd())
{
@@ -83,7 +86,9 @@ class CommandOSAKill : public Command
mask.trim();
}
else
+ {
reason = sep.GetRemaining();
+ }
if (mask[0] == '/' && mask[mask.length() - 1] == '/')
{
diff --git a/modules/operserv/config.cpp b/modules/operserv/config.cpp
index 3935b4899..33ef0acef 100644
--- a/modules/operserv/config.cpp
+++ b/modules/operserv/config.cpp
@@ -125,7 +125,9 @@ class CommandOSConfig : public Command
source.Reply(_("End of configuration."));
}
else
+ {
this->OnSyntaxError(source, what);
+ }
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand) override
diff --git a/modules/operserv/dns.cpp b/modules/operserv/dns.cpp
index af07a2499..9afec4304 100644
--- a/modules/operserv/dns.cpp
+++ b/modules/operserv/dns.cpp
@@ -689,7 +689,9 @@ class CommandOSDNS : public Command
}
}
else
+ {
source.Reply(_("Unknown SET option."));
+ }
}
void OnPool(CommandSource &source, const std::vector<Anope::string> &params)
diff --git a/modules/operserv/ignore.cpp b/modules/operserv/ignore.cpp
index 607163fb9..a25b0ef8c 100644
--- a/modules/operserv/ignore.cpp
+++ b/modules/operserv/ignore.cpp
@@ -160,7 +160,9 @@ class OSIgnoreService : public IgnoreService
id->Delete();
}
else
+ {
return id;
+ }
}
return NULL;
@@ -194,8 +196,10 @@ class CommandOSIgnore : public Command
return mask;
}
else
+ {
/* We have user@host. Add nick wildcard. */
return "*!" + mask;
+ }
}
/* We only got a nick.. */
diff --git a/modules/operserv/jupe.cpp b/modules/operserv/jupe.cpp
index ccffcaf2a..2f9386eda 100644
--- a/modules/operserv/jupe.cpp
+++ b/modules/operserv/jupe.cpp
@@ -35,26 +35,35 @@ class CommandOSJupe : public Command
Server *server = Server::Find(jserver, true);
if (!IRCD->IsHostValid(jserver) || jserver.find('.') == Anope::string::npos)
+ {
source.Reply(_("\002{0}\002 is not a valid server name."), jserver);
- else if (server == Me || server == Servers::GetUplink() || server->IsULined())
+ return;
+ }
+
+ if (server == Me || server == Servers::GetUplink() || server->IsULined())
+ {
source.Reply(_("You can not jupe Servoces or its uplink server."));
- else if (server && server->IsJuped())
- source.Reply(_("You can not jupe an already juped server."));
- else
+ return;
+ }
+
+ if (server && server->IsJuped())
{
- Anope::string rbuf = "Juped by " + source.GetNick() + (!reason.empty() ? ": " + reason : "");
- /* Generate the new sid before quitting the old server, so they can't collide */
- Anope::string sid = IRCD->SID_Retrieve();
- if (server)
- {
- IRCD->SendSquit(server, rbuf);
- server->Delete(rbuf);
- }
- Server *juped_server = new Server(Me, jserver, 1, rbuf, sid, true);
- IRCD->SendServer(juped_server);
+ source.Reply(_("You can not jupe an already juped server."));
+ return;
+ }
- Log(LOG_ADMIN, source, this) << "on " << jserver << " (" << rbuf << ")";
+ Anope::string rbuf = "Juped by " + source.GetNick() + (!reason.empty() ? ": " + reason : "");
+ /* Generate the new sid before quitting the old server, so they can't collide */
+ Anope::string sid = IRCD->SID_Retrieve();
+ if (server)
+ {
+ IRCD->SendSquit(server, rbuf);
+ server->Delete(rbuf);
}
+ Server *juped_server = new Server(Me, jserver, 1, rbuf, sid, true);
+ IRCD->SendServer(juped_server);
+
+ Log(LOG_ADMIN, source, this) << "on " << jserver << " (" << rbuf << ")";
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand) override
diff --git a/modules/operserv/kill.cpp b/modules/operserv/kill.cpp
index 224cf7bfd..e4c97bcf4 100644
--- a/modules/operserv/kill.cpp
+++ b/modules/operserv/kill.cpp
@@ -35,18 +35,23 @@ class CommandOSKill : public Command
User *u2 = User::Find(nick, true);
if (u2 == NULL)
+ {
source.Reply(_("\002{0}\002 isn't currently online."), nick);
- else if (u2->IsProtected() || u2->server == Me)
- source.Reply(_("\002{0}\002 is protected and cannot be killed."), u2->nick);
- else
+ return;
+ }
+
+ if (u2->IsProtected() || u2->server == Me)
{
- if (reason.empty())
- reason = "No reason specified";
- if (Config->GetModule("operserv/main")->Get<bool>("addakiller"))
- reason = "(" + source.GetNick() + ") " + reason;
- Log(LOG_ADMIN, source, this) << "on " << u2->nick << " for " << reason;
- u2->Kill(*source.service, reason);
+ source.Reply(_("\002{0}\002 is protected and cannot be killed."), u2->nick);
+ return;
}
+
+ if (reason.empty())
+ reason = "No reason specified";
+ if (Config->GetModule("operserv/main")->Get<bool>("addakiller"))
+ reason = "(" + source.GetNick() + ") " + reason;
+ Log(LOG_ADMIN, source, this) << "on " << u2->nick << " for " << reason;
+ u2->Kill(*source.service, reason);
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand) override
diff --git a/modules/operserv/logsearch.cpp b/modules/operserv/logsearch.cpp
index 85a5834a7..d9dc7b891 100644
--- a/modules/operserv/logsearch.cpp
+++ b/modules/operserv/logsearch.cpp
@@ -107,7 +107,7 @@ class CommandOSLogSearch : public Command
if (!fd.is_open())
continue;
- for (Anope::string buf, token; std::getline(fd, buf.str());)
+ for (Anope::string buf; std::getline(fd, buf.str());)
if (Anope::Match(buf, "*" + search_string + "*"))
matches.push_back(buf);
@@ -126,8 +126,8 @@ class CommandOSLogSearch : public Command
source.Reply(_("Matches for \002{0}\002:"), search_string);
unsigned count = 0;
- for (std::list<Anope::string>::iterator it = matches.begin(), it_end = matches.end(); it != it_end; ++it)
- source.Reply("#%d: %s", ++count, it->c_str());
+ for (const Anope::string &str : matches)
+ source.Reply("#{0}: {1}", ++count, str);
source.Reply(_("Showed \002{0}/{1}\002 matches for \002{2}\002."), matches.size(), found, search_string);
}
diff --git a/modules/operserv/mode.cpp b/modules/operserv/mode.cpp
index a159dc3e3..a66f8897f 100644
--- a/modules/operserv/mode.cpp
+++ b/modules/operserv/mode.cpp
@@ -36,10 +36,18 @@ class CommandOSMode : public Command
Reference<Channel> c = Channel::Find(target);
if (!c)
+ {
source.Reply(_("Channel \002{0}\002 doesn't exist."), target);
- else if (c->bouncy_modes)
+ return;
+ }
+
+ if (c->bouncy_modes)
+ {
source.Reply(_("Services is unable to change modes. Are your servers' U:lines configured correctly?"));
- else if (modes.equals_ci("CLEAR"))
+ return;
+ }
+
+ if (modes.equals_ci("CLEAR"))
{
bool all = params.size() > 2 && params[2].equals_ci("ALL");
@@ -69,7 +77,9 @@ class CommandOSMode : public Command
source.Reply(_("All modes cleared on \002{0}\002."), c->name);
}
else
+ {
source.Reply(_("Non-status modes cleared on \002{0}\002."), c->name);
+ }
}
else
{
diff --git a/modules/operserv/modinfo.cpp b/modules/operserv/modinfo.cpp
index 57edc5c40..cd926d1e5 100644
--- a/modules/operserv/modinfo.cpp
+++ b/modules/operserv/modinfo.cpp
@@ -35,42 +35,43 @@ class CommandOSModInfo : public Command
Log(LOG_ADMIN, source, this) << "on " << file;
Module *m = ModuleManager::FindModule(file);
- if (m)
+ if (m == nullptr)
{
- source.Reply(_("Module: \002{0}\002 Version: \002{1}\002 Author: \002{2}\002 Loaded: \002{3}\002"), m->name, !m->version.empty() ? m->version : "?", !m->author.empty() ? m->author : "Unknown", Anope::strftime(m->created, source.GetAccount()));
- if (Anope::Debug)
- source.Reply(_(" Loaded at: {0}"), Anope::printf("0x%x", m->handle));
+ source.Reply(_("No information about module \002{0}\002 is available."), file);
+ return;
+ }
+
+ source.Reply(_("Module: \002{0}\002 Version: \002{1}\002 Author: \002{2}\002 Loaded: \002{3}\002"), m->name, !m->version.empty() ? m->version : "?", !m->author.empty() ? m->author : "Unknown", Anope::strftime(m->created, source.GetAccount()));
+ if (Anope::Debug)
+ source.Reply(_(" Loaded at: {0}"), Anope::printf("0x%x", m->handle));
+
+ std::vector<Command *> commands = ServiceManager::Get()->FindServices<Command *>();
+ for (Command *c : commands)
+ {
+ if (c->GetOwner() != m)
+ continue;
+
+ source.Reply(_(" Providing service: \002{0}\002"), c->GetName());
- std::vector<Command *> commands = ServiceManager::Get()->FindServices<Command *>();
- for (Command *c : commands)
+ for (user_map::const_iterator it = UserListByNick.begin(); it != UserListByNick.end(); ++it)
{
- if (c->GetOwner() != m)
+ User *u = it->second;
+
+ if (u->type != UserType::BOT)
continue;
- source.Reply(_(" Providing service: \002{0}\002"), c->GetName());
+ ServiceBot *bi = anope_dynamic_static_cast<ServiceBot *>(u);
- for (user_map::const_iterator it = UserListByNick.begin(); it != UserListByNick.end(); ++it)
+ for (CommandInfo::map::const_iterator cit = bi->commands.begin(), cit_end = bi->commands.end(); cit != cit_end; ++cit)
{
- User *u = it->second;
-
- if (u->type != UserType::BOT)
+ const Anope::string &c_name = cit->first;
+ const CommandInfo &info = cit->second;
+ if (info.name != c->GetName())
continue;
-
- ServiceBot *bi = anope_dynamic_static_cast<ServiceBot *>(u);
-
- for (CommandInfo::map::const_iterator cit = bi->commands.begin(), cit_end = bi->commands.end(); cit != cit_end; ++cit)
- {
- const Anope::string &c_name = cit->first;
- const CommandInfo &info = cit->second;
- if (info.name != c->GetName())
- continue;
- source.Reply(_(" Command \002{0}\002 on \002{1}\002 is linked to \002{2}\002"), c_name, bi->nick, c->GetName());
- }
+ source.Reply(_(" Command \002{0}\002 on \002{1}\002 is linked to \002{2}\002"), c_name, bi->nick, c->GetName());
}
}
}
- else
- source.Reply(_("No information about module \002{0}\002 is available."), file);
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand) override
diff --git a/modules/operserv/module.cpp b/modules/operserv/module.cpp
index 88d1def03..1e4e0bac5 100644
--- a/modules/operserv/module.cpp
+++ b/modules/operserv/module.cpp
@@ -39,9 +39,13 @@ class CommandOSModLoad : public Command
source.Reply(_("Module \002{0}\002 loaded."), mname);
}
else if (status == MOD_ERR_EXISTS)
+ {
source.Reply(_("Module \002{0}\002 is already loaded."), mname);
+ }
else
+ {
source.Reply(_("Unable to load module \002{0}\002."), mname);
+ }
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand) override
@@ -108,7 +112,9 @@ class CommandOSModReLoad : public Command
Anope::Quitting = true;
}
else
+ {
source.Reply(_("Unable to load module \002{0}\002."), mname);
+ }
}
}
@@ -155,9 +161,9 @@ class CommandOSModUnLoad : public Command
source.Reply(_("Module \002{0}\002 unloaded."), mname);
}
else
+ {
source.Reply(_("Unable to remove module \002{0}\002."), mname);
-
- return;
+ }
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand) override
diff --git a/modules/operserv/noop.cpp b/modules/operserv/noop.cpp
index 7c4a178b4..2d813a0cc 100644
--- a/modules/operserv/noop.cpp
+++ b/modules/operserv/noop.cpp
@@ -36,10 +36,18 @@ class CommandOSNOOP : public Command
Server *s = Server::Find(server, true);
if (s == NULL)
+ {
source.Reply(_("Server \002{0}\002 does not exist."), server);
- else if (s == Me || s->IsJuped() || s->IsULined())
+ return;
+ }
+
+ if (s == Me || s->IsJuped() || s->IsULined())
+ {
source.Reply(_("You can not NOOP Services."));
- else if (cmd.equals_ci("SET"))
+ return;
+ }
+
+ if (cmd.equals_ci("SET"))
{
/* Remove the O:lines */
IRCD->SendSVSNOOP(s, true);
@@ -66,7 +74,9 @@ class CommandOSNOOP : public Command
source.Reply(_("All O:lines of \002{0}\002 have been reset."), s->GetName());
}
else
+ {
this->OnSyntaxError(source, "");
+ }
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand) override
diff --git a/modules/operserv/oline.cpp b/modules/operserv/oline.cpp
index a0b968325..9564dceac 100644
--- a/modules/operserv/oline.cpp
+++ b/modules/operserv/oline.cpp
@@ -52,9 +52,9 @@ class CommandOSOLine : public Command
Log(LOG_ADMIN, source, this) << "for " << nick;
}
else
+ {
this->OnSyntaxError(source, "");
-
- return;
+ }
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand) override
diff --git a/modules/operserv/oper.cpp b/modules/operserv/oper.cpp
index 40880d8fc..34fcb1abc 100644
--- a/modules/operserv/oper.cpp
+++ b/modules/operserv/oper.cpp
@@ -185,7 +185,9 @@ class CommandOSOper : public Command
}
if (ot->GetCommands().empty())
+ {
source.Reply(_("Opertype \002{0}\002 has no allowed commands."), ot->GetName());
+ }
else
{
source.Reply(_("Available commands for \002{0}\002:"), ot->GetName());
@@ -206,8 +208,11 @@ class CommandOSOper : public Command
buf.clear();
}
}
+
if (ot->GetPrivs().empty())
+ {
source.Reply(_("Opertype \002{0}\002 has no allowed privileges."), ot->GetName());
+ }
else
{
source.Reply(_("Available privileges for \002{0}\002:"), ot->GetName());
@@ -228,11 +233,14 @@ class CommandOSOper : public Command
buf.clear();
}
}
+
if (!ot->modes.empty())
source.Reply(_("Opertype \002{0}\002 receives modes \002{1}\002 once identified."), ot->GetName(), ot->modes);
}
else
+ {
this->OnSyntaxError(source, subcommand);
+ }
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand) override
diff --git a/modules/operserv/set.cpp b/modules/operserv/set.cpp
index f12f43722..e23efb849 100644
--- a/modules/operserv/set.cpp
+++ b/modules/operserv/set.cpp
@@ -26,16 +26,16 @@ class CommandOSSet : public Command
{
Log(LOG_ADMIN, source, this) << "LIST";
- Anope::string index;
+ const char *str;
- index = Anope::ReadOnly ? _("%s is enabled") : _("%s is disabled");
- source.Reply(index.c_str(), "READONLY");
- index = Anope::Debug ? _("%s is enabled") : _("%s is disabled");
- source.Reply(index.c_str(), "DEBUG");
- index = Anope::NoExpire ? _("%s is enabled") : _("%s is disabled");
- source.Reply(index.c_str(), "NOEXPIRE");
+ str = Anope::ReadOnly ? _("{0} is enabled") : _("{0} is disabled");
+ source.Reply(str, "READONLY");
- return;
+ str = Anope::Debug ? _("{0} is enabled") : _("{0} is disabled");
+ source.Reply(str, "DEBUG");
+
+ str = Anope::NoExpire ? _("{0} is enabled") : _("{0} is disabled");
+ source.Reply(str, "NOEXPIRE");
}
void DoSetReadOnly(CommandSource &source, const std::vector<Anope::string> &params)
@@ -61,7 +61,9 @@ class CommandOSSet : public Command
source.Reply(_("Services are now in \002read-write\002 mode."));
}
else
+ {
source.Reply(_("Setting for READONLY must be \002ON\002 or \002OFF\002."));
+ }
}
void DoSetSuperAdmin(CommandSource &source, const std::vector<Anope::string> &params)
@@ -84,8 +86,12 @@ class CommandOSSet : public Command
**/
bool super_admin = Config->GetModule(this->GetOwner())->Get<bool>("superadmin");
if (!super_admin)
+ {
source.Reply(_("Super admin can not be set because it is not enabled in the configuration."));
- else if (setting.equals_ci("ON"))
+ return;
+ }
+
+ if (setting.equals_ci("ON"))
{
source.GetUser()->super_admin = true;
source.Reply(_("You are now a super admin."));
@@ -98,7 +104,9 @@ class CommandOSSet : public Command
Log(LOG_ADMIN, source, this) << "SUPERADMIN OFF";
}
else
+ {
source.Reply(_("Setting for super admin must be \002ON\002 or \002OFF\002."));
+ }
}
void DoSetDebug(CommandSource &source, const std::vector<Anope::string> &params)
@@ -136,8 +144,6 @@ class CommandOSSet : public Command
source.Reply(_("Setting for DEBUG must be \002ON\002, \002OFF\002, or a positive number."));
}
-
- return;
}
void DoSetNoExpire(CommandSource &source, const std::vector<Anope::string> &params)
@@ -163,7 +169,9 @@ class CommandOSSet : public Command
source.Reply(_("Services are now in \002expire\002 mode."));
}
else
+ {
source.Reply(_("Setting for NOEXPIRE must be \002ON\002 or \002OFF\002."));
+ }
}
public:
CommandOSSet(Module *creator) : Command(creator, "operserv/set", 1, 2)
@@ -202,6 +210,7 @@ class CommandOSSet : public Command
" LIST List the options"));
}
else if (subcommand.equals_ci("LIST"))
+#warning "?"
//source.Reply(_("Syntax: \002LIST\002\n"
// " \n"
source.Reply(("Display the various {0} settings."), source.service->nick);
diff --git a/modules/operserv/shutdown.cpp b/modules/operserv/shutdown.cpp
index c0adc182e..3b04528d5 100644
--- a/modules/operserv/shutdown.cpp
+++ b/modules/operserv/shutdown.cpp
@@ -32,7 +32,6 @@ class CommandOSQuit : public Command
Log(LOG_ADMIN, source, this);
Anope::QuitReason = source.command + " command received from " + source.GetNick();
Anope::Quitting = true;
- return;
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand) override
@@ -58,7 +57,6 @@ class CommandOSRestart : public Command
Anope::QuitReason = source.command + " command received from " + source.GetNick();
Anope::Quitting = Anope::Restarting = true;
Anope::SaveDatabases();
- return;
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand) override
@@ -82,7 +80,6 @@ class CommandOSShutdown : public Command
Anope::QuitReason = source.command + " command received from " + source.GetNick();
Anope::Quitting = true;
Anope::SaveDatabases();
- return;
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand) override
diff --git a/modules/operserv/svs.cpp b/modules/operserv/svs.cpp
index 0a5acac2f..81138740f 100644
--- a/modules/operserv/svs.cpp
+++ b/modules/operserv/svs.cpp
@@ -32,7 +32,6 @@ class CommandOSSVSNick : public Command
{
const Anope::string &nick = params[0];
Anope::string newnick = params[1];
- User *u2;
if (!IRCD->CanSVSNick)
{
@@ -55,17 +54,22 @@ class CommandOSSVSNick : public Command
return;
}
- /* Check for a nick in use or a forbidden/suspended nick */
- if (!(u2 = User::Find(nick, true)))
+ User *u2 = User::Find(nick, true);
+ if (u2 == nullptr)
+ {
source.Reply(_("\002{0}\002 isn't currently online."), nick);
- else if (!nick.equals_ci(newnick) && User::Find(newnick))
- source.Reply(_("\002{0}\002 is currently in use."), newnick);
- else
+ return;
+ }
+
+ if (!nick.equals_ci(newnick) && User::Find(newnick, true))
{
- source.Reply(_("\002{0}\002 is now being changed to \002{1}\002."), nick, newnick);
- Log(LOG_ADMIN, source, this) << "to change " << nick << " to " << newnick;
- IRCD->SendForceNickChange(u2, newnick, Anope::CurTime);
+ source.Reply(_("\002{0}\002 is currently in use."), newnick);
+ return;
}
+
+ source.Reply(_("\002{0}\002 is now being changed to \002{1}\002."), nick, newnick);
+ Log(LOG_ADMIN, source, this) << "to change " << nick << " to " << newnick;
+ IRCD->SendForceNickChange(u2, newnick, Anope::CurTime);
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand) override
@@ -95,19 +99,32 @@ class CommandOSSVSJoin : public Command
User *target = User::Find(params[0], true);
Channel *c = Channel::Find(params[1]);
if (target == NULL)
+ {
source.Reply(_("\002{0}\002 isn't currently online."), params[0]);
- else if (source.GetUser() != target && (target->IsProtected() || target->server == Me))
+ return;
+ }
+
+ if (source.GetUser() != target && (target->IsProtected() || target->server == Me))
+ {
source.Reply(_("Access denied."));
- else if (!c && !IRCD->IsChannelValid(params[1]))
+ return;
+ }
+
+ if (!c && !IRCD->IsChannelValid(params[1]))
+ {
source.Reply(_("\002{0}\002 isn't a valid channel."), params[1]);
- else if (c && c->FindUser(target))
- source.Reply(_("\002{0}\002 is already in \002{1}\002."), target->nick, c->name);
- else
+ return;
+ }
+
+ if (c && c->FindUser(target))
{
- IRCD->SendSVSJoin(*source.service, target, params[1], "");
- Log(LOG_ADMIN, source, this) << "to force " << target->nick << " to join " << params[1];
- source.Reply(_("\002{0}\002 has been joined to \002{1}\002."), target->nick, params[1]);
+ source.Reply(_("\002{0}\002 is already in \002{1}\002."), target->nick, c->name);
+ return;
}
+
+ IRCD->SendSVSJoin(*source.service, target, params[1], "");
+ Log(LOG_ADMIN, source, this) << "to force " << target->nick << " to join " << params[1];
+ source.Reply(_("\002{0}\002 has been joined to \002{1}\002."), target->nick, params[1]);
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand) override
@@ -135,25 +152,38 @@ class CommandOSSVSPart : public Command
}
User *target = User::Find(params[0], true);
- Channel *c = Channel::Find(params[1]);
- const Anope::string &reason = params.size() > 2 ? params[2] : "";
- if (target == NULL)
+ if (target == nullptr)
+ {
source.Reply(_("\002{0}\002 isn't currently online."), params[0]);
- else if (source.GetUser() != target && (target->IsProtected() || target->server == Me))
+ return;
+ }
+
+ if (source.GetUser() != target && (target->IsProtected() || target->server == Me))
+ {
source.Reply(_("Access denied."));
- else if (!c)
+ return;
+ }
+
+ Channel *c = Channel::Find(params[1]);
+ if (!c)
+ {
source.Reply(_("Channel \002{0}\002 doesn't exist."), params[1]);
- else if (!c->FindUser(target))
- source.Reply(_("\002{0}\002 is not in \002{1}\002."), target->nick, c->name);
- else
+ return;
+ }
+
+ if (!c->FindUser(target))
{
- IRCD->SendSVSPart(*source.service, target, params[1], reason);
- if (!reason.empty())
- Log(LOG_ADMIN, source, this) << "to force " << target->nick << " to part " << c->name << " with reason " << reason;
- else
- Log(LOG_ADMIN, source, this) << "to force " << target->nick << " to part " << c->name;
- source.Reply(_("\002{0}\002 has been parted from \002{1}\002."), target->nick, c->name);
+ source.Reply(_("\002{0}\002 is not in \002{1}\002."), target->nick, c->name);
+ return;
}
+
+ const Anope::string &reason = params.size() > 2 ? params[2] : "";
+ IRCD->SendSVSPart(*source.service, target, params[1], reason);
+ if (!reason.empty())
+ Log(LOG_ADMIN, source, this) << "to force " << target->nick << " to part " << c->name << " with reason " << reason;
+ else
+ Log(LOG_ADMIN, source, this) << "to force " << target->nick << " to part " << c->name;
+ source.Reply(_("\002{0}\002 has been parted from \002{1}\002."), target->nick, c->name);
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand) override
diff --git a/modules/operserv/sxline.cpp b/modules/operserv/sxline.cpp
index cc6b9669c..bd0dc8910 100644
--- a/modules/operserv/sxline.cpp
+++ b/modules/operserv/sxline.cpp
@@ -143,7 +143,9 @@ class CommandOSSXLineBase : public Command
}
if (list.IsEmpty())
+ {
source.Reply(_("No matching entries on the {0} list."), source.command);
+ }
else
{
source.Reply(_("{0} list:"), source.command);
@@ -408,9 +410,12 @@ class CommandOSSNLine : public CommandOSSXLineBase
}
}
else if (subcommand.equals_ci("DEL"))
+ {
source.Reply(_("The \002{0} DEL\002 command removes the given \037mask\037 from the {0} list if it is present."
" If a list of entry numbers is given, those entries are deleted."));
+ }
else if (subcommand.equals_ci("LIST") || subcommand.equals_ci("VIEW"))
+ {
source.Reply(_("The \002{0} LIST\002 and \002{0} VIEW\002 commands displays the {0} list.\n"
"If a wildcard \037mask\037 is given, only those entries matching the \037mask\037 are displayed."
" If a list of entry numbers is given, only those entries are shown."
@@ -421,9 +426,12 @@ class CommandOSSNLine : public CommandOSSXLineBase
" {0} LIST 2-5,7-9\n"
" Lists {0} entries numbered 2 through 5 and 7 through 9.\n"),
source.command);
+ }
else if (subcommand.equals_ci("CLEAR"))
+ {
source.Reply(_("\002{0} CLEAR\002 removes all entries from the {0} list."),
source.command);
+ }
else
{
CommandInfo *help = source.service->FindCommand("generic/help");
@@ -645,9 +653,12 @@ class CommandOSSQLine : public CommandOSSXLineBase
}
}
else if (subcommand.equals_ci("DEL"))
+ {
source.Reply(_("The \002{0} DEL\002 command removes the given \037mask\037 from the {0} list if it is present."
" If a list of entry numbers is given, those entries are deleted."));
+ }
else if (subcommand.equals_ci("LIST") || subcommand.equals_ci("VIEW"))
+ {
source.Reply(_("The \002{0} LIST\002 and \002{0} VIEW\002 commands displays the {0} list.\n"
"If a wildcard \037mask\037 is given, only those entries matching the \037mask\037 are displayed."
" If a list of entry numbers is given, only those entries are shown."
@@ -658,9 +669,12 @@ class CommandOSSQLine : public CommandOSSXLineBase
" {0} LIST 2-5,7-9\n"
" Lists {0} entries numbered 2 through 5 and 7 through 9.\n"),
source.command);
+ }
else if (subcommand.equals_ci("CLEAR"))
+ {
source.Reply(_("\002{0} CLEAR\002 removes all entries from the {0} list."),
source.command);
+ }
else
{
CommandInfo *help = source.service->FindCommand("generic/help");
diff --git a/modules/operserv/update.cpp b/modules/operserv/update.cpp
index 753644415..f12047732 100644
--- a/modules/operserv/update.cpp
+++ b/modules/operserv/update.cpp
@@ -32,7 +32,6 @@ class CommandOSUpdate : public Command
Log(LOG_ADMIN, source, this);
source.Reply(_("Updating databases."));
Anope::SaveDatabases();
- return;
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand) override