summaryrefslogtreecommitdiff
path: root/src/users.cpp
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2024-01-06 14:41:54 +0000
committerSadie Powell <sadie@witchery.services>2024-01-08 13:11:50 +0000
commit5db79c1e242d4c06d1aeb2b09f99b8254b7fb5de (patch)
tree05beddb85b9a11c8c674d78f7405f50072f18f7b /src/users.cpp
parenta4dddfd5f121c9cc74e05e08a568c6a9febfd56f (diff)
Add a non-formatting overload of User::SetModesInternal.
Diffstat (limited to 'src/users.cpp')
-rw-r--r--src/users.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/users.cpp b/src/users.cpp
index cc9ac9af0..f4e77c5f9 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -50,7 +50,7 @@ User::User(const Anope::string &snick, const Anope::string &sident, const Anope:
this->server = sserver;
this->realname = srealname;
this->timestamp = this->signon = ts;
- this->SetModesInternal(sserver, "%s", smodes.c_str());
+ this->SetModesInternal(sserver, smodes);
this->uid = suid;
this->super_admin = false;
this->nc = NULL;
@@ -664,16 +664,21 @@ void User::SetModesInternal(const MessageSource &source, const char *umodes, ...
{
char buf[BUFSIZE] = "";
va_list args;
- Anope::string modebuf, sbuf;
- int add = -1;
va_start(args, umodes);
vsnprintf(buf, BUFSIZE - 1, umodes, args);
va_end(args);
- if (this->server && this->server->IsSynced() && Anope::string(buf) != "+")
- Log(this, "mode") << "changes modes to " << buf;
+ SetModesInternal(source, Anope::string(buf));
+}
- spacesepstream sep(buf);
+void User::SetModesInternal(const MessageSource &source, const Anope::string &umodes)
+{
+ if (this->server && this->server->IsSynced() && Anope::string(umodes) != "+")
+ Log(this, "mode") << "changes modes to " << umodes;
+
+ int add = -1;
+ Anope::string modebuf;
+ spacesepstream sep(umodes);
sep.GetToken(modebuf);
for (auto mode : modebuf)
{
@@ -697,6 +702,7 @@ void User::SetModesInternal(const MessageSource &source, const char *umodes, ...
if (add)
{
+ Anope::string sbuf;
if (um->type == MODE_PARAM && sep.GetToken(sbuf))
this->SetModeInternal(source, um, sbuf);
else