summaryrefslogtreecommitdiff
path: root/modules/commands/ns_ajoin.cpp
diff options
context:
space:
mode:
authorRobby- <robby@chat.be>2013-09-29 05:02:22 +0200
committerAdam <Adam@anope.org>2013-09-29 15:42:22 -0400
commit32a57150ecddc75b1bfd2efc185575b76431cbff (patch)
treeb1c99df49444ee138578432cd213fec6c0135406 /modules/commands/ns_ajoin.cpp
parent2a5e8f1890ecc3a390d814cf24cbc9451a938840 (diff)
ns_access: Allow LIST by Services Operators on suspended nicks. Change wording.
ns_ajoin: Fix the number of command parameters. Check for nick suspension. Do not allow just any Services Operator to access other users' AJOIN, require nickserv/ajoin. Change wording. ns_cert: Add ability for Services Operators to modify other users' certificate lists.
Diffstat (limited to 'modules/commands/ns_ajoin.cpp')
-rw-r--r--modules/commands/ns_ajoin.cpp52
1 files changed, 33 insertions, 19 deletions
diff --git a/modules/commands/ns_ajoin.cpp b/modules/commands/ns_ajoin.cpp
index 9a0ab0538..85c15c236 100644
--- a/modules/commands/ns_ajoin.cpp
+++ b/modules/commands/ns_ajoin.cpp
@@ -127,8 +127,8 @@ class CommandNSAJoin : public Command
if ((*channels)->at(i)->channel.equals_ci(chan))
break;
- if (*source.nc == nc && (*channels)->size() >= Config->GetModule(this->owner)->Get<unsigned>("ajoinmax"))
- source.Reply(_("Your auto join list is full."));
+ if ((*channels)->size() >= Config->GetModule(this->owner)->Get<unsigned>("ajoinmax"))
+ source.Reply(_("Sorry, the maximum of %d auto join entries has been reached."), Config->GetModule(this->owner)->Get<unsigned>("ajoinmax"));
else if (i != (*channels)->size())
source.Reply(_("%s is already on %s's auto join list."), chan.c_str(), nc->display.c_str());
else if (IRCD->IsChannelValid(chan) == false)
@@ -140,7 +140,7 @@ class CommandNSAJoin : public Command
entry->channel = chan;
entry->key = key;
(*channels)->push_back(entry);
- source.Reply(_("Added %s to %s's auto join list."), chan.c_str(), nc->display.c_str());
+ source.Reply(_("%s added to %s's auto join list."), chan.c_str(), nc->display.c_str());
}
}
@@ -166,25 +166,36 @@ class CommandNSAJoin : public Command
}
public:
- CommandNSAJoin(Module *creator) : Command(creator, "nickserv/ajoin", 1, 3)
+ CommandNSAJoin(Module *creator) : Command(creator, "nickserv/ajoin", 1, 4)
{
this->SetDesc(_("Manage your auto join list"));
- this->SetSyntax(_("ADD [\037user\037] \037channel\037 [\037key\037]"));
- this->SetSyntax(_("DEL [\037user\037] \037channel\037"));
- this->SetSyntax(_("LIST [\037user\037]"));
+ this->SetSyntax(_("ADD [\037nickname\037] \037channel\037 [\037key\037]"));
+ this->SetSyntax(_("DEL [\037nickname\037] \037channel\037"));
+ this->SetSyntax(_("LIST [\037nickname\037]"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
- NickCore *nc = source.GetAccount();
- Anope::string param, param2;
+ const Anope::string &cmd = params[0];
+ Anope::string nick, param, param2;
- if (params.size() > 1 && source.IsServicesOper() && IRCD->IsNickValid(params[1]))
+ if (cmd.equals_ci("LIST"))
+ nick = params.size() > 1 ? params[1] : "";
+ else
+ nick = (params.size() > 2 && IRCD->IsChannelValid(params[2])) ? params[1] : "";
+
+ NickCore *nc;
+ if (!nick.empty())
{
- NickAlias *na = NickAlias::Find(params[1]);
- if (!na)
+ const NickAlias *na = NickAlias::Find(nick);
+ if (na == NULL)
+ {
+ source.Reply(NICK_X_NOT_REGISTERED, nick.c_str());
+ return;
+ }
+ else if (na->nc != source.GetAccount() && !source.HasCommand("nickserv/ajoin"))
{
- source.Reply(NICK_X_NOT_REGISTERED, params[1].c_str());
+ source.Reply(ACCESS_DENIED);
return;
}
@@ -194,20 +205,23 @@ class CommandNSAJoin : public Command
}
else
{
+ nc = source.nc;
param = params.size() > 1 ? params[1] : "";
param2 = params.size() > 2 ? params[2] : "";
}
- if (params[0].equals_ci("LIST"))
- this->DoList(source, nc);
+ if (cmd.equals_ci("LIST"))
+ return this->DoList(source, nc);
+ else if (nc->HasExt("NS_SUSPENDED"))
+ source.Reply(NICK_X_SUSPENDED, nc->display.c_str());
else if (param.empty())
this->OnSyntaxError(source, "");
else if (Anope::ReadOnly)
source.Reply(READ_ONLY_MODE);
- else if (params[0].equals_ci("ADD"))
- this->DoAdd(source, nc, param, param2);
- else if (params[0].equals_ci("DEL"))
- this->DoDel(source, nc, param);
+ else if (cmd.equals_ci("ADD"))
+ return this->DoAdd(source, nc, param, param2);
+ else if (cmd.equals_ci("DEL"))
+ return this->DoDel(source, nc, param);
else
this->OnSyntaxError(source, "");
}