summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2024-10-19 17:36:23 +0100
committerSadie Powell <sadie@witchery.services>2024-10-19 17:40:24 +0100
commit8cb2b801e948564223ee97bef25a6b53f3f1ad9b (patch)
tree5acacd0b2d05052251f1a1a6840cae6889d4cd97 /modules
parent66b45534a8cbf088fa7b8ecf7a9096567ee50837 (diff)
Use the target nick as the default desc for mask access entries.
Diffstat (limited to 'modules')
-rw-r--r--modules/chanserv/cs_access.cpp7
-rw-r--r--modules/chanserv/cs_flags.cpp6
-rw-r--r--modules/chanserv/cs_xop.cpp4
3 files changed, 15 insertions, 2 deletions
diff --git a/modules/chanserv/cs_access.cpp b/modules/chanserv/cs_access.cpp
index 4c3981a5e..b7c39ac6d 100644
--- a/modules/chanserv/cs_access.cpp
+++ b/modules/chanserv/cs_access.cpp
@@ -87,6 +87,7 @@ class CommandCSAccess final
void DoAdd(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> &params)
{
Anope::string mask = params[2];
+ Anope::string description = params.size() > 4 ? params[4] : "";
Privilege *p = NULL;
int level = ACCESS_INVALID;
@@ -172,7 +173,11 @@ class CommandCSAccess final
{
User *targ = User::Find(mask, true);
if (targ != NULL)
+ {
mask = "*!*@" + targ->GetDisplayedHost();
+ if (description.empty())
+ description = targ->nick;
+ }
else
{
source.Reply(NICK_X_NOT_REGISTERED, mask.c_str());
@@ -216,7 +221,7 @@ class CommandCSAccess final
access->level = level;
access->last_seen = 0;
access->created = Anope::CurTime;
- access->description = params.size() > 4 ? params[4] : "";
+ access->description = description;
ci->AddAccess(access);
FOREACH_MOD(OnAccessAdd, (ci, source, access));
diff --git a/modules/chanserv/cs_flags.cpp b/modules/chanserv/cs_flags.cpp
index cdba434dc..396447fbc 100644
--- a/modules/chanserv/cs_flags.cpp
+++ b/modules/chanserv/cs_flags.cpp
@@ -79,7 +79,7 @@ FlagsAccessProvider *FlagsAccessProvider::ap;
class CommandCSFlags final
: public Command
{
- void DoModify(CommandSource &source, ChannelInfo *ci, Anope::string mask, const Anope::string &flags, const Anope::string &description)
+ void DoModify(CommandSource &source, ChannelInfo *ci, Anope::string mask, const Anope::string &flags, Anope::string description)
{
if (flags.empty())
{
@@ -131,7 +131,11 @@ class CommandCSFlags final
{
User *targ = User::Find(mask, true);
if (targ != NULL)
+ {
mask = "*!*@" + targ->GetDisplayedHost();
+ if (description.empty())
+ description = targ->nick;
+ }
else
{
source.Reply(NICK_X_NOT_REGISTERED, mask.c_str());
diff --git a/modules/chanserv/cs_xop.cpp b/modules/chanserv/cs_xop.cpp
index 19fbf0c37..db8456492 100644
--- a/modules/chanserv/cs_xop.cpp
+++ b/modules/chanserv/cs_xop.cpp
@@ -179,7 +179,11 @@ private:
{
User *targ = User::Find(mask, true);
if (targ != NULL)
+ {
mask = "*!*@" + targ->GetDisplayedHost();
+ if (description.empty())
+ description = targ->nick;
+ }
else
{
source.Reply(NICK_X_NOT_REGISTERED, mask.c_str());