summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/commands/bs_badwords.cpp19
-rw-r--r--modules/commands/bs_bot.cpp4
-rw-r--r--modules/commands/bs_botlist.cpp15
-rw-r--r--modules/commands/bs_info.cpp2
-rw-r--r--modules/commands/cs_access.cpp54
-rw-r--r--modules/commands/cs_akick.cpp19
-rw-r--r--modules/commands/cs_enforce.cpp18
-rw-r--r--modules/commands/cs_flags.cpp12
-rw-r--r--modules/commands/cs_log.cpp44
-rw-r--r--modules/commands/cs_register.cpp107
-rw-r--r--modules/commands/cs_updown.cpp8
-rw-r--r--modules/commands/cs_xop.cpp6
-rw-r--r--modules/commands/help.cpp14
-rw-r--r--modules/commands/hs_del.cpp40
-rw-r--r--modules/commands/hs_group.cpp21
-rw-r--r--modules/commands/hs_off.cpp13
-rw-r--r--modules/commands/hs_on.cpp27
-rw-r--r--modules/commands/hs_request.cpp72
-rw-r--r--modules/commands/ms_del.cpp52
-rw-r--r--modules/commands/ms_list.cpp121
-rw-r--r--modules/commands/ms_read.cpp57
-rw-r--r--modules/commands/ms_rsend.cpp1
-rw-r--r--modules/commands/ms_set.cpp2
-rw-r--r--modules/commands/ns_ajoin.cpp40
-rw-r--r--modules/commands/ns_drop.cpp21
-rw-r--r--modules/commands/ns_getpass.cpp28
-rw-r--r--modules/commands/ns_group.cpp143
-rw-r--r--modules/commands/ns_identify.cpp54
-rw-r--r--modules/commands/ns_info.cpp117
-rw-r--r--modules/commands/ns_logout.cpp47
-rw-r--r--modules/commands/ns_register.cpp197
-rw-r--r--modules/commands/ns_resetpass.cpp23
-rw-r--r--modules/commands/ns_set.cpp38
-rw-r--r--modules/commands/os_akill.cpp6
-rw-r--r--modules/commands/os_chankill.cpp59
-rw-r--r--modules/commands/os_defcon.cpp1
36 files changed, 856 insertions, 646 deletions
diff --git a/modules/commands/bs_badwords.cpp b/modules/commands/bs_badwords.cpp
index 5e9dd363a..a29209e31 100644
--- a/modules/commands/bs_badwords.cpp
+++ b/modules/commands/bs_badwords.cpp
@@ -245,19 +245,20 @@ class CommandBSBadwords : public Command
}
if (list.IsEmpty())
- source.Reply(_("No matching entries on the bad word list of \002{0}\002."), ci->name);
- else
{
- std::vector<Anope::string> replies;
- list.Process(replies);
+ source.Reply(_("No matching entries on the bad word list of \002{0}\002."), ci->name);
+ return;
+ }
- source.Reply(_("Bad words list for \002{0}\002:"), ci->name);
+ std::vector<Anope::string> replies;
+ list.Process(replies);
- for (unsigned i = 0; i < replies.size(); ++i)
- source.Reply(replies[i]);
+ source.Reply(_("Bad words list for \002{0}\002:"), ci->name);
- source.Reply(_("End of bad words list."));
- }
+ for (unsigned i = 0; i < replies.size(); ++i)
+ source.Reply(replies[i]);
+
+ source.Reply(_("End of bad words list."));
}
void DoAdd(CommandSource &source, ChanServ::Channel *ci, const Anope::string &word)
diff --git a/modules/commands/bs_bot.cpp b/modules/commands/bs_bot.cpp
index f4beba6e6..79c23a764 100644
--- a/modules/commands/bs_bot.cpp
+++ b/modules/commands/bs_bot.cpp
@@ -76,7 +76,7 @@ class CommandBSBot : public Command
NickServ::Nick *na = NickServ::FindNick(nick);
if (na)
{
- source.Reply(_("Nickname \002{0}\002 is already registered!"), na->nick);
+ source.Reply(_("\002{0}\002 is already registered!"), na->nick);
return;
}
@@ -188,7 +188,7 @@ class CommandBSBot : public Command
NickServ::Nick *na = NickServ::FindNick(nick);
if (na)
{
- source.Reply(_("Nickname \002{0}\002 is already registered."), na->nick);
+ source.Reply(_("\002{0}\002 is already registered."), na->nick);
return;
}
diff --git a/modules/commands/bs_botlist.cpp b/modules/commands/bs_botlist.cpp
index 85855bb82..58b763d47 100644
--- a/modules/commands/bs_botlist.cpp
+++ b/modules/commands/bs_botlist.cpp
@@ -44,16 +44,17 @@ class CommandBSBotList : public Command
list.Process(replies);
if (!count)
- source.Reply(_("There are no bots available at this time."));
- else
{
- source.Reply(_("Bot list:"));
+ source.Reply(_("There are no bots available"));
+ return;
+ }
- for (unsigned i = 0; i < replies.size(); ++i)
- source.Reply(replies[i]);
+ source.Reply(_("Bot list:"));
- source.Reply(_("{0} bots available."), count);
- }
+ for (unsigned i = 0; i < replies.size(); ++i)
+ source.Reply(replies[i]);
+
+ source.Reply(_("{0} bots available."), count);
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand) override
diff --git a/modules/commands/bs_info.cpp b/modules/commands/bs_info.cpp
index 677dfaaf6..4d7bc0765 100644
--- a/modules/commands/bs_info.cpp
+++ b/modules/commands/bs_info.cpp
@@ -81,7 +81,7 @@ class CommandBSInfo : public Command
source.Reply(replies[i]);
}
else
- source.Reply(_("\002{0}\002 is not a valid bot or registered channel."), query.c_str());
+ 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/commands/cs_access.cpp b/modules/commands/cs_access.cpp
index a1153cac6..5f38dc09a 100644
--- a/modules/commands/cs_access.cpp
+++ b/modules/commands/cs_access.cpp
@@ -437,20 +437,20 @@ class CommandCSAccess : public Command
}
if (list.IsEmpty())
- source.Reply(_("No matching entries on the access list of \002{0}\002."), ci->name);
- else
{
- std::vector<Anope::string> replies;
- list.Process(replies);
+ source.Reply(_("No matching entries on the access list of \002{0}\002."), ci->name);
+ return;
+ }
- source.Reply(_("Access list for \002{0}\002:"), ci->name);
+ std::vector<Anope::string> replies;
+ list.Process(replies);
- for (unsigned i = 0; i < replies.size(); ++i)
- source.Reply(replies[i]);
+ source.Reply(_("Access list for \002{0}\002:"), ci->name);
- source.Reply(_("End of access list"));
- }
+ for (unsigned i = 0; i < replies.size(); ++i)
+ source.Reply(replies[i]);
+ source.Reply(_("End of access list."));
}
void DoList(CommandSource &source, ChanServ::Channel *ci, const std::vector<Anope::string> &params)
@@ -546,12 +546,24 @@ class CommandCSAccess : public Command
* If DEL, we require a nick and no level.
* Else (ADD), we require a level (which implies a nick). */
if (is_list || is_clear ? 0 : (cmd.equals_ci("DEL") ? (nick.empty() || !s.empty()) : s.empty()))
+ {
this->OnSyntaxError(source, cmd);
- else if (!has_access)
+ return;
+ }
+
+ if (!has_access)
+ {
source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), is_list ? "ACCESS_LIST" : "ACCESS_CHANGE", ci->name);
- else if (Anope::ReadOnly && !is_list)
+ return;
+ }
+
+ if (Anope::ReadOnly && !is_list)
+ {
source.Reply(_("Sorry, channel access list modification is temporarily disabled."));
- else if (cmd.equals_ci("ADD"))
+ return;
+ }
+
+ if (cmd.equals_ci("ADD"))
this->DoAdd(source, ci, params);
else if (cmd.equals_ci("DEL"))
this->DoDel(source, ci, params);
@@ -813,12 +825,24 @@ class CommandCSLevels : public Command
* one; else, we want none.
*/
if (cmd.equals_ci("SET") ? s.empty() : (cmd.substr(0, 3).equals_ci("DIS") ? (what.empty() || !s.empty()) : !what.empty()))
+ {
this->OnSyntaxError(source, cmd);
- else if (!source.AccessFor(ci).HasPriv("FOUNDER") && !source.HasPriv("chanserv/access/modify"))
+ return;
+ }
+
+ if (!source.AccessFor(ci).HasPriv("FOUNDER") && !source.HasPriv("chanserv/access/modify"))
+ {
source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "FOUNDER", ci->name);
- else if (Anope::ReadOnly && !cmd.equals_ci("LIST"))
+ return;
+ }
+
+ if (Anope::ReadOnly && !cmd.equals_ci("LIST"))
+ {
source.Reply(_("Services are in read-only mode."));
- else if (cmd.equals_ci("SET"))
+ return;
+ }
+
+ if (cmd.equals_ci("SET"))
this->DoSet(source, ci, params);
else if (cmd.equals_ci("DIS") || cmd.equals_ci("DISABLE"))
this->DoDisable(source, ci, params);
diff --git a/modules/commands/cs_akick.cpp b/modules/commands/cs_akick.cpp
index 435373810..9f69810fc 100644
--- a/modules/commands/cs_akick.cpp
+++ b/modules/commands/cs_akick.cpp
@@ -418,19 +418,20 @@ class CommandCSAKick : public Command
}
if (list.IsEmpty())
- source.Reply(_("No matching entries on %s autokick list."), ci->name.c_str());
- else
{
- std::vector<Anope::string> replies;
- list.Process(replies);
+ source.Reply(_("No matching entries on %s autokick list."), ci->name.c_str());
+ return;
+ }
- source.Reply(_("Autokick list for %s:"), ci->name.c_str());
+ std::vector<Anope::string> replies;
+ list.Process(replies);
- for (unsigned i = 0; i < replies.size(); ++i)
- source.Reply(replies[i]);
+ source.Reply(_("Autokick list for %s:"), ci->name.c_str());
- source.Reply(_("End of autokick list"));
- }
+ for (unsigned i = 0; i < replies.size(); ++i)
+ source.Reply(replies[i]);
+
+ source.Reply(_("End of autokick list"));
}
void DoList(CommandSource &source, ChanServ::Channel *ci, const std::vector<Anope::string> &params)
diff --git a/modules/commands/cs_enforce.cpp b/modules/commands/cs_enforce.cpp
index 64ef9ab0d..80abed196 100644
--- a/modules/commands/cs_enforce.cpp
+++ b/modules/commands/cs_enforce.cpp
@@ -235,12 +235,24 @@ class CommandCSEnforce : public Command
ChanServ::Channel *ci = ChanServ::Find(params[0]);
if (!ci)
+ {
source.Reply(_("Channel \002{0}\002 isn't registered."), params[0]);
- else if (!ci->c)
+ return;
+ }
+
+ if (!ci->c)
+ {
source.Reply(_("Channel \002{0}\002 doesn't exist."), ci->name);
- else if (!source.AccessFor(ci).HasPriv("AKICK") && !source.HasPriv("chanserv/access/modify"))
+ return;
+ }
+
+ if (!source.AccessFor(ci).HasPriv("AKICK") && !source.HasPriv("chanserv/access/modify"))
+ {
source.Reply("Access denied. You do not have the \002{0}\002 privilege on \002{1}\002.", "AKICK", ci->name);
- else if (what.equals_ci("SECUREOPS"))
+ return;
+ }
+
+ if (what.equals_ci("SECUREOPS"))
this->DoSecureOps(source, ci);
else if (what.equals_ci("RESTRICTED"))
this->DoRestricted(source, ci);
diff --git a/modules/commands/cs_flags.cpp b/modules/commands/cs_flags.cpp
index 7e17a1b47..ac03febb7 100644
--- a/modules/commands/cs_flags.cpp
+++ b/modules/commands/cs_flags.cpp
@@ -396,10 +396,18 @@ class CommandCSFlags : public Command
has_access = true;
if (!has_access)
+ {
source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), is_list ? "ACCESS_LIST" : "ACCESS_CHANGE", ci->name);
- else if (Anope::ReadOnly && !is_list)
+ return;
+ }
+
+ if (Anope::ReadOnly && !is_list)
+ {
source.Reply(_("Sorry, channel access list modification is temporarily disabled."));
- else if (cmd.equals_ci("MODIFY"))
+ return;
+ }
+
+ if (cmd.equals_ci("MODIFY"))
this->DoModify(source, ci, params);
else if (is_list)
this->DoList(source, ci, params);
diff --git a/modules/commands/cs_log.cpp b/modules/commands/cs_log.cpp
index 9fd1a2fdf..5c80448c2 100644
--- a/modules/commands/cs_log.cpp
+++ b/modules/commands/cs_log.cpp
@@ -129,33 +129,35 @@ public:
{
LogSettings *ls = ci->Require<LogSettings>("logsettings");
if (!ls || (*ls)->empty())
- source.Reply(_("There currently are no logging configurations for \002{0}\002."), ci->name);
- else
{
- ListFormatter list(source.GetAccount());
- list.AddColumn(_("Number")).AddColumn(_("Service")).AddColumn(_("Command")).AddColumn(_("Method")).AddColumn("");
+ source.Reply(_("There currently are no logging configurations for \002{0}\002."), ci->name);
+ return;
+ }
- for (unsigned i = 0; i < (*ls)->size(); ++i)
- {
- const LogSetting *log = (*ls)->at(i);
-
- ListFormatter::ListEntry entry;
- entry["Number"] = stringify(i + 1);
- entry["Service"] = log->command_service;
- entry["Command"] = !log->command_name.empty() ? log->command_name : log->service_name;
- entry["Method"] = log->method;
- entry[""] = log->extra;
- list.AddEntry(entry);
- }
- source.Reply(_("Log list for \002{0}\002:"), ci->name);
+ ListFormatter list(source.GetAccount());
+ list.AddColumn(_("Number")).AddColumn(_("Service")).AddColumn(_("Command")).AddColumn(_("Method")).AddColumn("");
- std::vector<Anope::string> replies;
- list.Process(replies);
+ for (unsigned i = 0; i < (*ls)->size(); ++i)
+ {
+ const LogSetting *log = (*ls)->at(i);
- for (unsigned i = 0; i < replies.size(); ++i)
- source.Reply(replies[i]);
+ ListFormatter::ListEntry entry;
+ entry["Number"] = stringify(i + 1);
+ entry["Service"] = log->command_service;
+ entry["Command"] = !log->command_name.empty() ? log->command_name : log->service_name;
+ entry["Method"] = log->method;
+ entry[""] = log->extra;
+ list.AddEntry(entry);
}
+
+ source.Reply(_("Log list for \002{0}\002:"), ci->name);
+
+ std::vector<Anope::string> replies;
+ list.Process(replies);
+
+ for (unsigned i = 0; i < replies.size(); ++i)
+ source.Reply(replies[i]);
}
else if (params.size() > 2)
{
diff --git a/modules/commands/cs_register.cpp b/modules/commands/cs_register.cpp
index 594babe2f..36803e608 100644
--- a/modules/commands/cs_register.cpp
+++ b/modules/commands/cs_register.cpp
@@ -24,66 +24,97 @@ class CommandCSRegister : public Command
{
const Anope::string &chan = params[0];
const Anope::string &chdesc = params.size() > 1 ? params[1] : "";
- unsigned maxregistered = Config->GetModule("chanserv")->Get<unsigned>("maxregistered");
User *u = source.GetUser();
NickServ::Account *nc = source.nc;
- Channel *c = Channel::Find(params[0]);
- ChanServ::Channel *ci = ChanServ::Find(params[0]);
if (Anope::ReadOnly)
+ {
source.Reply(_("Sorry, channel registration is temporarily disabled."));
- else if (nc->HasExt("UNCONFIRMED"))
+ return;
+ }
+
+ if (nc->HasExt("UNCONFIRMED"))
+ {
source.Reply(_("You must confirm your account before you can register a channel."));
- else if (chan[0] == '&')
+ return;
+ }
+
+ if (chan[0] == '&')
+ {
source.Reply(_("Local channels can not be registered."));
- else if (chan[0] != '#')
+ return;
+ }
+
+ if (chan[0] != '#')
+ {
source.Reply(_("Please use the symbol of \002#\002 when attempting to register."));
- else if (!IRCD->IsChannelValid(chan))
+ return;
+ }
+
+ if (!IRCD->IsChannelValid(chan))
+ {
source.Reply(_("Channel \002{0}\002 is not a valid channel."), chan);
- else if (!c && u)
+ return;
+ }
+
+ Channel *c = Channel::Find(params[0]);
+ if (!c && u)
+ {
source.Reply(_("Channel \002{0}\002 doesn't exist."), chan);
- else if (ci)
- source.Reply(_("Channel \002%s\002 is already registered!"), chan.c_str());
- else if (c && !c->HasUserStatus(u, "OP"))
+ return;
+ }
+
+ ChanServ::Channel *ci = ChanServ::Find(chan);
+ if (ci)
+ {
+ source.Reply(_("Channel \002{0}\002 is already registered!"), chan);
+ return;
+ }
+
+ if (c && !c->HasUserStatus(u, "OP"))
+ {
source.Reply(_("You must be a channel operator to register the channel."));
- else if (maxregistered && nc->channelcount >= maxregistered && !source.HasPriv("chanserv/no-register-limit"))
+ return;
+ }
+
+ unsigned maxregistered = Config->GetModule("chanserv")->Get<unsigned>("maxregistered");
+ if (maxregistered && nc->channelcount >= maxregistered && !source.HasPriv("chanserv/no-register-limit"))
{
if (nc->channelcount > maxregistered)
source.Reply(_("Sorry, you have already exceeded your limit of \002{0}\002 channels."), maxregistered);
else
source.Reply(_("Sorry, you have already reached your limit of \002{0}\002 channels."), maxregistered);
+ return;
}
- else
- {
- if (!ChanServ::service)
- return;
- ci = ChanServ::service->Create(chan);
- ci->SetFounder(nc);
- ci->desc = chdesc;
-
- if (c && !c->topic.empty())
- {
- ci->last_topic = c->topic;
- ci->last_topic_setter = c->topic_setter;
- ci->last_topic_time = c->topic_time;
- }
- else
- ci->last_topic_setter = source.service->nick;
- Log(LOG_COMMAND, source, this, ci);
- source.Reply(_("Channel \002{0}\002 registered under your account: \002{1}\002"), chan, nc->display);
+ if (!ChanServ::service)
+ return;
+ ci = ChanServ::service->Create(chan);
+ ci->SetFounder(nc);
+ ci->desc = chdesc;
- /* Implement new mode lock */
- if (c)
- {
- c->CheckModes();
- if (u)
- c->SetCorrectModes(u, true);
- }
+ if (c && !c->topic.empty())
+ {
+ ci->last_topic = c->topic;
+ ci->last_topic_setter = c->topic_setter;
+ ci->last_topic_time = c->topic_time;
+ }
+ else
+ ci->last_topic_setter = source.service->nick;
+
+ Log(LOG_COMMAND, source, this, ci);
+ source.Reply(_("Channel \002{0}\002 registered under your account: \002{1}\002"), chan, nc->display);
- Event::OnChanRegistered(&Event::ChanRegistered::OnChanRegistered, ci);
+ /* Implement new mode lock */
+ if (c)
+ {
+ c->CheckModes();
+ if (u)
+ c->SetCorrectModes(u, true);
}
+
+ Event::OnChanRegistered(&Event::ChanRegistered::OnChanRegistered, ci);
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand) override
diff --git a/modules/commands/cs_updown.cpp b/modules/commands/cs_updown.cpp
index 0e487ff6c..5339d7f73 100644
--- a/modules/commands/cs_updown.cpp
+++ b/modules/commands/cs_updown.cpp
@@ -90,12 +90,14 @@ class CommandCSUp : public Command
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;
}
- else if (!u->FindChannel(c))
+
+ if (!u->FindChannel(c))
{
source.Reply(_("You must be on channel \002{0}\002 to use this command."), c->name);
return;
@@ -201,12 +203,14 @@ class CommandCSDown : public Command
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;
}
- else if (!u->FindChannel(c))
+
+ if (!u->FindChannel(c))
{
source.Reply(_("\002%s\002 is not on channel %s."), u->nick, c->name);
return;
diff --git a/modules/commands/cs_xop.cpp b/modules/commands/cs_xop.cpp
index c3b43cd3e..44af355ec 100644
--- a/modules/commands/cs_xop.cpp
+++ b/modules/commands/cs_xop.cpp
@@ -149,7 +149,8 @@ class CommandCSXOP : public Command
source.Reply(_("Channel \002{0}\002 isn't registered."), mask);
return;
}
- else if (ci == targ_ci)
+
+ if (ci == targ_ci)
{
source.Reply(_("You can't add a channel to its own access list."));
return;
@@ -165,7 +166,8 @@ class CommandCSXOP : public Command
source.Reply(_("Masks and unregistered users may not be on access lists."));
return;
}
- else if (mask.find_first_of("!*@") == Anope::string::npos && !na)
+
+ if (mask.find_first_of("!*@") == Anope::string::npos && !na)
{
User *targ = User::Find(mask, true);
if (targ != NULL)
diff --git a/modules/commands/help.cpp b/modules/commands/help.cpp
index 4d8ee27bb..fc367760b 100644
--- a/modules/commands/help.cpp
+++ b/modules/commands/help.cpp
@@ -14,8 +14,6 @@
class CommandHelp : public Command
{
- static const unsigned help_wrap_len = 40;
-
static CommandGroup *FindGroup(const Anope::string &name)
{
for (unsigned i = 0; i < Config->CommandGroups.size(); ++i)
@@ -108,20 +106,10 @@ class CommandHelp : public Command
for (std::list<Anope::string>::iterator it2 = it->second.begin(), it2_end = it->second.end(); it2 != it2_end; ++it2)
{
const Anope::string &c_name = *it2;
-
buf += ", " + c_name;
-
- if (buf.length() > help_wrap_len)
- {
- source.Reply(" {0}", buf.substr(2));
- buf.clear();
- }
}
if (buf.length() > 2)
- {
source.Reply(" {0}", buf.substr(2));
- buf.clear();
- }
}
if (!groups.empty())
{
@@ -156,6 +144,8 @@ class CommandHelp : public Command
const Anope::string &subcommand = params.size() > max ? params[max] : "";
source.command = it->first;
+
+ c->SendSyntax(source);
if (!c->OnHelp(source, subcommand))
continue;
diff --git a/modules/commands/hs_del.cpp b/modules/commands/hs_del.cpp
index 02727185e..907b3e12c 100644
--- a/modules/commands/hs_del.cpp
+++ b/modules/commands/hs_del.cpp
@@ -30,15 +30,16 @@ class CommandHSDel : public Command
const Anope::string &nick = params[0];
NickServ::Nick *na = NickServ::FindNick(nick);
- if (na)
+ if (!na)
{
- Log(LOG_ADMIN, source, this) << "for user " << na->nick;
- this->OnDeleteVhost(&Event::DeleteVhost::OnDeleteVhost, na);
- na->RemoveVhost();
- source.Reply(_("Vhost for \002{0}\002 has been removed."), na->nick);
- }
- else
source.Reply(_("\002{0}\002 isn't registered."), nick);
+ return;
+ }
+
+ Log(LOG_ADMIN, source, this) << "for user " << na->nick;
+ this->OnDeleteVhost(&Event::DeleteVhost::OnDeleteVhost, na);
+ na->RemoveVhost();
+ source.Reply(_("Vhost for \002{0}\002 has been removed."), na->nick);
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand) override
@@ -66,20 +67,21 @@ class CommandHSDelAll : public Command
const Anope::string &nick = params[0];
NickServ::Nick *na = NickServ::FindNick(nick);
- if (na)
+ if (!na)
{
- this->ondeletevhost(&Event::DeleteVhost::OnDeleteVhost, na);
- const NickServ::Account *nc = na->nc;
- for (unsigned i = 0; i < nc->aliases->size(); ++i)
- {
- na = nc->aliases->at(i);
- na->RemoveVhost();
- }
- Log(LOG_ADMIN, source, this) << "for all nicks in group " << nc->display;
- source.Reply(_("Vhosts for group \002{0}\002 have been removed."), nc->display);
- }
- else
source.Reply(_("\002{0}\002 isn't registered."), nick);
+ return;
+ }
+
+ this->ondeletevhost(&Event::DeleteVhost::OnDeleteVhost, na);
+ const NickServ::Account *nc = na->nc;
+ for (unsigned i = 0; i < nc->aliases->size(); ++i)
+ {
+ na = nc->aliases->at(i);
+ na->RemoveVhost();
+ }
+ Log(LOG_ADMIN, source, this) << "for all nicks in group " << nc->display;
+ source.Reply(_("Vhosts for group \002{0}\002 have been removed."), nc->display);
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand) override
diff --git a/modules/commands/hs_group.cpp b/modules/commands/hs_group.cpp
index 8b84d0f65..a3d68844b 100644
--- a/modules/commands/hs_group.cpp
+++ b/modules/commands/hs_group.cpp
@@ -52,16 +52,23 @@ class CommandHSGroup : public Command
}
NickServ::Nick *na = NickServ::FindNick(source.GetNick());
- if (na && source.GetAccount() == na->nc && na->HasVhost())
+ if (!na || na->nc != source.GetAccount())
{
- this->Sync(na);
- if (!na->GetVhostIdent().empty())
- source.Reply(_("All vhosts in the group \002{0}\002 have been set to \002{1}\002@\002{2}\002."), source.nc->display, na->GetVhostIdent(), na->GetVhostHost());
- else
- source.Reply(_("All vhosts in the group \002{0}\002 have been set to \002{1}\002."), source.nc->display, na->GetVhostHost());
+ source.Reply(_("Access denied."));
+ return;
}
- else
+
+ if (!na->HasVhost())
+ {
source.Reply(_("There is no vhost assigned to this nickname."));
+ return;
+ }
+
+ this->Sync(na);
+ if (!na->GetVhostIdent().empty())
+ source.Reply(_("All vhosts in the group \002{0}\002 have been set to \002{1}\002@\002{2}\002."), source.nc->display, na->GetVhostIdent(), na->GetVhostHost());
+ else
+ source.Reply(_("All vhosts in the group \002{0}\002 have been set to \002{1}\002."), source.nc->display, na->GetVhostHost());
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand) override
diff --git a/modules/commands/hs_off.cpp b/modules/commands/hs_off.cpp
index 2d8c23b80..e847963d6 100644
--- a/modules/commands/hs_off.cpp
+++ b/modules/commands/hs_off.cpp
@@ -25,14 +25,15 @@ class CommandHSOff : public Command
User *u = source.GetUser();
const NickServ::Nick *na = NickServ::FindNick(u->nick);
- if (!na || !na->HasVhost())
- source.Reply(_("There is no vhost assigned to this nickname."));
- else
+ if (!na || !na->HasVhost() || na->nc != source.GetAccount())
{
- IRCD->SendVhostDel(u);
- Log(LOG_COMMAND, source, this) << "to disable their vhost";
- source.Reply(_("Your vhost was removed and the normal cloaking restored."));
+ source.Reply(_("There is no vhost assigned to this nickname."));
+ return;
}
+
+ IRCD->SendVhostDel(u);
+ Log(LOG_COMMAND, source, this) << "to disable their vhost";
+ source.Reply(_("Your vhost was removed and the normal cloaking restored."));
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand) override
diff --git a/modules/commands/hs_on.cpp b/modules/commands/hs_on.cpp
index c9e686131..8ec26f565 100644
--- a/modules/commands/hs_on.cpp
+++ b/modules/commands/hs_on.cpp
@@ -27,21 +27,24 @@ class CommandHSOn : public Command
User *u = source.GetUser();
const NickServ::Nick *na = NickServ::FindNick(u->nick);
- if (na && u->Account() == na->nc && na->HasVhost())
+
+ if (!na || !na->HasVhost() || na->nc != u->Account())
{
- if (!na->GetVhostIdent().empty())
- source.Reply(_("Your vhost of \002{0}\002@\002{1}\002 is now activated."), na->GetVhostIdent(), na->GetVhostHost());
- else
- source.Reply(_("Your vhost of \002{0}\002 is now activated."), na->GetVhostHost());
- Log(LOG_COMMAND, source, this) << "to enable their vhost of " << (!na->GetVhostIdent().empty() ? na->GetVhostIdent() + "@" : "") << na->GetVhostHost();
- IRCD->SendVhost(u, na->GetVhostIdent(), na->GetVhostHost());
- u->vhost = na->GetVhostHost();
- if (IRCD->CanSetVIdent && !na->GetVhostIdent().empty())
- u->SetVIdent(na->GetVhostIdent());
- u->UpdateHost();
+ source.Reply(_("There is no vhost assigned to this nickname."));
+ return;
}
+
+ if (!na->GetVhostIdent().empty())
+ source.Reply(_("Your vhost of \002{0}\002@\002{1}\002 is now activated."), na->GetVhostIdent(), na->GetVhostHost());
else
- source.Reply(_("There is no vhost assigned to this nickname."));
+ source.Reply(_("Your vhost of \002{0}\002 is now activated."), na->GetVhostHost());
+
+ Log(LOG_COMMAND, source, this) << "to enable their vhost of " << (!na->GetVhostIdent().empty() ? na->GetVhostIdent() + "@" : "") << na->GetVhostHost();
+ IRCD->Se