diff options
author | Adam <Adam@anope.org> | 2012-11-09 19:20:17 -0500 |
---|---|---|
committer | Adam <Adam@anope.org> | 2012-11-09 19:20:17 -0500 |
commit | 8f36f65f39c6ea843c388af398ed0bbfe84d1207 (patch) | |
tree | d3b83a020ed610e9b86e4f27d1911a9e2c5945ca | |
parent | ff3e396e92dfc6f95bf8e7a099e43cc0d3eebdf9 (diff) |
Made access del and xop del behave like access add/xop add by using a users mask if given an unregistered nick
-rw-r--r-- | modules/commands/cs_access.cpp | 14 | ||||
-rw-r--r-- | modules/commands/cs_xop.cpp | 14 |
2 files changed, 26 insertions, 2 deletions
diff --git a/modules/commands/cs_access.cpp b/modules/commands/cs_access.cpp index 295321f8b..40414a336 100644 --- a/modules/commands/cs_access.cpp +++ b/modules/commands/cs_access.cpp @@ -186,7 +186,19 @@ class CommandCSAccess : public Command void DoDel(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> ¶ms) { - const Anope::string &mask = params[2]; + Anope::string mask = params[2]; + + if (mask.find_first_of("!*@") == Anope::string::npos && !findnick(mask)) + { + User *targ = finduser(mask); + if (targ != NULL) + mask = "*!*@" + targ->GetDisplayedHost(); + else + { + source.Reply(NICK_X_NOT_REGISTERED, mask.c_str()); + return; + } + } if (!ci->GetAccessCount()) source.Reply(_("%s access list is empty."), ci->name.c_str()); diff --git a/modules/commands/cs_xop.cpp b/modules/commands/cs_xop.cpp index aa04b8d28..1fc3cbdf0 100644 --- a/modules/commands/cs_xop.cpp +++ b/modules/commands/cs_xop.cpp @@ -291,7 +291,7 @@ class XOPBase : public Command void DoDel(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> ¶ms, XOPType level) { NickCore *nc = source.nc; - const Anope::string &mask = params.size() > 2 ? params[2] : ""; + Anope::string mask = params.size() > 2 ? params[2] : ""; if (mask.empty()) { @@ -319,6 +319,18 @@ class XOPBase : public Command const ChanAccess *highest = access.Highest(); bool override = false; + if (mask.find_first_of("!*@") == Anope::string::npos && !findnick(mask)) + { + User *targ = finduser(mask); + if (targ != NULL) + mask = "*!*@" + targ->GetDisplayedHost(); + else + { + source.Reply(NICK_X_NOT_REGISTERED, mask.c_str()); + return; + } + } + if ((!mask.equals_ci(nc->display) && !access.HasPriv("ACCESS_CHANGE") && !access.Founder) || ((!highest || tmp_access >= *highest) && !access.Founder)) { if (source.HasPriv("chanserv/access/modify")) |