summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2025-05-09 22:36:50 +0100
committerSadie Powell <sadie@witchery.services>2025-05-09 22:36:50 +0100
commiteec428b0c7e6dd05c67df35d973b19cc1c2cf4b7 (patch)
treedbf608c85cd7686451affa3dbb486305941bf439 /modules
parentb706a6259eaeeed66fd17651e806d30432fc576e (diff)
Build buffers a bit smarter in cs_access/cs_xop/help.
Diffstat (limited to 'modules')
-rw-r--r--modules/chanserv/cs_access.cpp13
-rw-r--r--modules/chanserv/cs_xop.cpp13
-rw-r--r--modules/help.cpp8
3 files changed, 18 insertions, 16 deletions
diff --git a/modules/chanserv/cs_access.cpp b/modules/chanserv/cs_access.cpp
index bba3b602c..85e2d85d5 100644
--- a/modules/chanserv/cs_access.cpp
+++ b/modules/chanserv/cs_access.cpp
@@ -297,7 +297,7 @@ private:
ChannelInfo *ci;
Command *c;
unsigned deleted = 0;
- Anope::string Nicks;
+ Anope::string nicks;
bool denied = false;
bool override = false;
public:
@@ -315,9 +315,9 @@ private:
source.Reply(_("No matching entries on %s access list."), ci->name.c_str());
else
{
- Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, c, ci) << "to delete " << Nicks;
+ Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, c, ci) << "to delete " << nicks;
if (deleted == 1)
- source.Reply(_("Deleted %s from %s access list."), Nicks.c_str(), ci->name.c_str());
+ source.Reply(_("Deleted %s from %s access list."), nicks.c_str(), ci->name.c_str());
else
source.Reply(deleted, N_("Deleted %d entry from %s access list.", "Deleted %d entries from %s access list."), deleted, ci->name.c_str());
@@ -341,10 +341,9 @@ private:
}
++deleted;
- if (!Nicks.empty())
- Nicks += ", " + access->Mask();
- else
- Nicks = access->Mask();
+ if (!nicks.empty())
+ nicks += ", ";
+ nicks += access->Mask();
ci->EraseAccess(Number - 1);
diff --git a/modules/chanserv/cs_xop.cpp b/modules/chanserv/cs_xop.cpp
index 8fa5b3bb2..bb38805f9 100644
--- a/modules/chanserv/cs_xop.cpp
+++ b/modules/chanserv/cs_xop.cpp
@@ -338,9 +338,8 @@ private:
++deleted;
if (!nicks.empty())
- nicks += ", " + caccess->Mask();
- else
- nicks = caccess->Mask();
+ nicks += ", ";
+ nicks += caccess->Mask();
ci->EraseAccess(number - 1);
FOREACH_MOD(OnAccessDel, (ci, source, caccess));
@@ -556,16 +555,18 @@ public:
Anope::string buf;
for (const auto &permission : permissions[cmd])
{
- buf += ", " + permission;
+ if (!buf.empty())
+ buf += ", ";
+ buf += permission;
if (buf.length() > 75)
{
- source.Reply(" %s", buf.substr(2).c_str());
+ source.Reply(" %s", buf.c_str());
buf.clear();
}
}
if (!buf.empty())
{
- source.Reply(" %s", buf.substr(2).c_str());
+ source.Reply(" %s", buf.c_str());
buf.clear();
}
diff --git a/modules/help.cpp b/modules/help.cpp
index 9fae2d43f..7b49764b9 100644
--- a/modules/help.cpp
+++ b/modules/help.cpp
@@ -102,17 +102,19 @@ public:
Anope::string buf;
for (const auto &c_name : cmds)
{
- buf += ", " + c_name;
+ if (!buf.empty())
+ buf += ", ";
+ buf += c_name;
if (buf.length() > help_wrap_len)
{
- source.Reply(" %s", buf.substr(2).c_str());
+ source.Reply(" %s", buf.c_str());
buf.clear();
}
}
if (buf.length() > 2)
{
- source.Reply(" %s", buf.substr(2).c_str());
+ source.Reply(" %s", buf.c_str());
buf.clear();
}
}