summaryrefslogtreecommitdiff
path: root/modules/commands/ns_access.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/commands/ns_access.cpp')
-rw-r--r--modules/commands/ns_access.cpp83
1 files changed, 35 insertions, 48 deletions
diff --git a/modules/commands/ns_access.cpp b/modules/commands/ns_access.cpp
index e15f2abfd..95a93fea1 100644
--- a/modules/commands/ns_access.cpp
+++ b/modules/commands/ns_access.cpp
@@ -25,27 +25,25 @@ class CommandNSAccess : public Command
if (Anope::ReadOnly)
{
- source.Reply(READ_ONLY_MODE);
+ source.Reply(_("Services are in read-only mode."));
return;
}
if (nc->access.size() >= Config->GetModule(this->owner)->Get<unsigned>("accessmax", "32"))
{
- source.Reply(_("Sorry, the maximum of %d access entries has been reached."), Config->GetModule(this->owner)->Get<unsigned>("accessmax"));
+ source.Reply(_("Sorry, the maximum of \002{0}\002 access entries has been reached."), Config->GetModule(this->owner)->Get<unsigned>("accessmax"));
return;
}
if (nc->FindAccess(mask))
{
- source.Reply(_("Mask \002%s\002 already present on %s's access list."), mask.c_str(), nc->display.c_str());
+ source.Reply(_("Mask \002{0}\002 already present on the access list of \002{1}\002."), mask, nc->display);
return;
}
nc->AddAccess(mask);
Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to ADD mask " << mask << " to " << nc->display;
- source.Reply(_("\002%s\002 added to %s's access list."), mask.c_str(), nc->display.c_str());
-
- return;
+ source.Reply(_("\002{0}\002 added to the access list of \002{1}\002."), mask, nc->display);
}
void DoDel(CommandSource &source, NickServ::Account *nc, const Anope::string &mask)
@@ -58,21 +56,19 @@ class CommandNSAccess : public Command
if (Anope::ReadOnly)
{
- source.Reply(READ_ONLY_MODE);
+ source.Reply(_("Services are in read-only mode."));
return;
}
if (!nc->FindAccess(mask))
{
- source.Reply(_("\002%s\002 not found on %s's access list."), mask.c_str(), nc->display.c_str());
+ source.Reply(_("\002{0}\002 not found on the access list of \002{1}\002."), mask, nc->display);
return;
}
nc->EraseAccess(mask);
Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to DELETE mask " << mask << " from " << nc->display;
- source.Reply(_("\002%s\002 deleted from %s's access list."), mask.c_str(), nc->display.c_str());
-
- return;
+ source.Reply(_("\002{0}\002 deleted from the access list of \002{1}\002."), mask, nc->display);
}
void DoList(CommandSource &source, NickServ::Account *nc, const Anope::string &mask)
@@ -81,20 +77,18 @@ class CommandNSAccess : public Command
if (nc->access.empty())
{
- source.Reply(_("%s's access list is empty."), nc->display.c_str());
+ source.Reply(_("The access list of \002{0}\002 is empty."), nc->display);
return;
}
- source.Reply(_("Access list for %s:"), nc->display.c_str());
+ source.Reply(_("Access list for \002{0}\002:"), nc->display);
for (i = 0, end = nc->access.size(); i < end; ++i)
{
Anope::string access = nc->GetAccess(i);
if (!mask.empty() && !Anope::Match(access, mask))
continue;
- source.Reply(" %s", access.c_str());
+ source.Reply(" {0}", access);
}
-
- return;
}
public:
CommandNSAccess(Module *creator) : Command(creator, "nickserv/access", 1, 3)
@@ -119,20 +113,16 @@ class CommandNSAccess : public Command
}
NickServ::Account *nc;
- if (!nick.empty())
+ if (!nick.empty() && source.HasPriv("nickserv/access"))
{
const NickServ::Nick *na = NickServ::FindNick(nick);
if (na == NULL)
{
- source.Reply(NICK_X_NOT_REGISTERED, nick.c_str());
+ source.Reply(_("\002{0}\002 isn't registered."), nick);
return;
}
- else if (na->nc != source.GetAccount() && !source.HasPriv("nickserv/access"))
- {
- source.Reply(ACCESS_DENIED);
- return;
- }
- else if (Config->GetModule("nickserv")->Get<bool>("secureadmins", "yes") && source.GetAccount() != na->nc && na->nc->IsServicesOper() && !cmd.equals_ci("LIST"))
+
+ if (Config->GetModule("nickserv")->Get<bool>("secureadmins", "yes") && source.GetAccount() != na->nc && na->nc->IsServicesOper() && !cmd.equals_ci("LIST"))
{
source.Reply(_("You may view but not modify the access list of other Services Operators."));
return;
@@ -145,13 +135,13 @@ class CommandNSAccess : public Command
if (!mask.empty() && (mask.find('@') == Anope::string::npos || mask.find('!') != Anope::string::npos))
{
- source.Reply(BAD_USERHOST_MASK);
- source.Reply(MORE_INFO, Config->StrictPrivmsg.c_str(), source.service->nick.c_str(), source.command.c_str());
+ 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
}
else if (cmd.equals_ci("LIST"))
return this->DoList(source, nc, mask);
else if (nc->HasExt("NS_SUSPENDED"))
- source.Reply(NICK_X_SUSPENDED, nc->display.c_str());
+ source.Reply(_("\002{0}\002 is suspended."), nc->display);
else if (cmd.equals_ci("ADD"))
return this->DoAdd(source, nc, mask);
else if (cmd.equals_ci("DEL"))
@@ -162,27 +152,24 @@ class CommandNSAccess : public Command
bool OnHelp(CommandSource &source, const Anope::string &subcommand) override
{
- this->SendSyntax(source);
- source.Reply(" ");
- source.Reply(_("Modifies or displays the access list for your nick. This\n"
- "is the list of addresses which will be automatically\n"
- "recognized by %s as allowed to use the nick. If\n"
- "you want to use the nick from a different address, you\n"
- "need to send an \002IDENTIFY\002 command to make %s\n"
- "recognize you. Services Operators may provide a nick\n"
- "to modify other users' access lists.\n"
- " \n"
- "Examples:\n"
- " \n"
- " \002ACCESS ADD anyone@*.bepeg.com\002\n"
- " Allows access to user \002anyone\002 from any machine in\n"
- " the \002bepeg.com\002 domain.\n"
- " \n"
- " \002ACCESS DEL anyone@*.bepeg.com\002\n"
- " Reverses the previous command.\n"
- " \n"
- " \002ACCESS LIST\002\n"
- " Displays the current access list."), source.service->nick.c_str(), source.service->nick.c_str());
+ source.Reply(_("Modifies or displays the access list for your account."
+ " The access list is a list of addresses that {1} uses to recognize you."
+ " If you match one of the hosts on the access list, services will not force you to change your nickname if the \002KILL\002 option is set."
+ " Furthermore, if the \002SECURE\002 option is disabled, services will recognize you just based on your hostmask, without having to supply a password."
+ " To gain access to channels when only recognized by your hostmask, the channel must too have the \002SECURE\002 option off."
+ " Services Operators may provide \037nickname\037 to modify other user's access lists.\n"
+ "\n"
+ "Examples:\n"
+ " \n"
+ " {command} ADD anyone@*.bepeg.com\n"
+ " Allows access to user \"anyone\" from any machine in the \"bepeg.com\" domain.\n"
+ "\n"
+ " {command} DEL anyone@*.bepeg.com\n"
+ " Reverses the previous command.\n"
+ "\n"
+ " {command} LIST\n"
+ " Displays the current access list."),
+ source.command, source.service->nick);
return true;
}
};