diff options
author | Daniel Vassdal <shutter@canternet.org> | 2014-03-05 16:48:29 -0800 |
---|---|---|
committer | Daniel Vassdal <shutter@canternet.org> | 2014-03-06 04:55:30 -0800 |
commit | 98cfdd26c48880cfaa973670be72fe99e9462ef5 (patch) | |
tree | f09b02f18bb5846172b6f6a391939a11d13b0674 | |
parent | 051a42b547ee5ec40be09f5dc9fce2f202792ada (diff) |
ns_group: Don't require a nick param when logged in
-rw-r--r-- | modules/commands/ns_group.cpp | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/modules/commands/ns_group.cpp b/modules/commands/ns_group.cpp index 0dbc9470e..9c54ab815 100644 --- a/modules/commands/ns_group.cpp +++ b/modules/commands/ns_group.cpp @@ -72,10 +72,10 @@ class NSGroupRequest : public IdentifyRequest class CommandNSGroup : public Command { public: - CommandNSGroup(Module *creator) : Command(creator, "nickserv/group", 1, 2) + CommandNSGroup(Module *creator) : Command(creator, "nickserv/group", 0, 2) { this->SetDesc(_("Join a group")); - this->SetSyntax(_("\037target\037 \037password\037")); + this->SetSyntax(_("\037[target]\037 \037[password]\037")); this->AllowUnregistered(true); this->RequireUser(true); } @@ -83,7 +83,23 @@ class CommandNSGroup : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override { User *u = source.GetUser(); - const Anope::string &nick = params[0]; + + Anope::string nick; + if (params.empty()) + { + NickCore* core = u->Account(); + if (core) + nick = core->display; + } + else + nick = params[0]; + + if (nick.empty()) + { + this->SendSyntax(source); + return; + } + const Anope::string &pass = params.size() > 1 ? params[1] : ""; if (Anope::ReadOnly) |