summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/users.h1
-rw-r--r--modules/commands/os_mode.cpp2
-rw-r--r--modules/extra/m_sql_oper.cpp2
-rw-r--r--modules/pseudoclients/nickserv.cpp4
-rw-r--r--src/users.cpp15
5 files changed, 15 insertions, 9 deletions
diff --git a/include/users.h b/include/users.h
index f017c0e9d..02fb48b60 100644
--- a/include/users.h
+++ b/include/users.h
@@ -303,6 +303,7 @@ public:
* @param umodes The modes
*/
void SetModes(BotInfo *bi, const char *umodes, ...) ATTR_FORMAT(3, 4);
+ void SetModes(BotInfo *bi, const Anope::string &umodes);
/** Set a string of modes on a user internally
* @param setter who/what is setting the mode
diff --git a/modules/commands/os_mode.cpp b/modules/commands/os_mode.cpp
index c0b16ce43..b432d4c15 100644
--- a/modules/commands/os_mode.cpp
+++ b/modules/commands/os_mode.cpp
@@ -154,7 +154,7 @@ public:
source.Reply(NICK_X_NOT_IN_USE, target.c_str());
else
{
- u2->SetModes(source.service, "%s", modes.c_str());
+ u2->SetModes(source.service, modes);
source.Reply(_("Changed usermodes of \002%s\002 to %s."), u2->nick.c_str(), modes.c_str());
u2->SendMessage(source.service, _("\002%s\002 changed your usermodes to %s."), source.GetNick().c_str(), modes.c_str());
diff --git a/modules/extra/m_sql_oper.cpp b/modules/extra/m_sql_oper.cpp
index 30677382c..13a3b8521 100644
--- a/modules/extra/m_sql_oper.cpp
+++ b/modules/extra/m_sql_oper.cpp
@@ -112,7 +112,7 @@ public:
IRCD->SendOper(user);
if (!modes.empty())
- user->SetModes(OperServ, "%s", modes.c_str());
+ user->SetModes(OperServ, modes);
}
}
diff --git a/modules/pseudoclients/nickserv.cpp b/modules/pseudoclients/nickserv.cpp
index e896f9bec..c885d5576 100644
--- a/modules/pseudoclients/nickserv.cpp
+++ b/modules/pseudoclients/nickserv.cpp
@@ -223,7 +223,7 @@ public:
const Anope::string &modesonid = Config->GetModule(this)->Get<Anope::string>("modesonid");
if (!modesonid.empty())
- u->SetModes(NickServ, "%s", modesonid.c_str());
+ u->SetModes(NickServ, modesonid);
}
void Collide(User *u, NickAlias *na) override
@@ -351,7 +351,7 @@ public:
const Anope::string &modesonid = block->Get<const Anope::string>("modesonid");
if (!modesonid.empty())
- u->SetModes(NickServ, "%s", modesonid.c_str());
+ u->SetModes(NickServ, modesonid);
if (block->Get<bool>("forceemail", "yes") && u->Account()->email.empty())
{
diff --git a/src/users.cpp b/src/users.cpp
index f4e77c5f9..fc509ee0a 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -372,7 +372,7 @@ void User::Identify(NickAlias *na)
{
if (!this->nc->o->ot->modes.empty())
{
- this->SetModes(NULL, "%s", this->nc->o->ot->modes.c_str());
+ this->SetModes(NULL, this->nc->o->ot->modes);
this->SendMessage(NULL, "Changing your usermodes to \002%s\002", this->nc->o->ot->modes.c_str());
UserMode *um = ModeManager::FindUserModeByName("OPER");
if (um && !this->HasMode("OPER") && this->nc->o->ot->modes.find(um->mchar) != Anope::string::npos)
@@ -543,7 +543,7 @@ void User::SetModeInternal(const MessageSource &source, UserMode *um, const Anop
{
if (!this->nc->o->ot->modes.empty())
{
- this->SetModes(NULL, "%s", this->nc->o->ot->modes.c_str());
+ this->SetModes(NULL, this->nc->o->ot->modes);
this->SendMessage(NULL, "Changing your usermodes to \002%s\002", this->nc->o->ot->modes.c_str());
UserMode *oper = ModeManager::FindUserModeByName("OPER");
if (oper && !this->HasMode("OPER") && this->nc->o->ot->modes.find(oper->mchar) != Anope::string::npos)
@@ -620,13 +620,18 @@ void User::SetModes(BotInfo *bi, 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);
- spacesepstream sep(buf);
+ SetModes(bi, Anope::string(buf));
+}
+
+void User::SetModes(BotInfo *bi, const Anope::string &umodes)
+{
+ Anope::string modebuf, sbuf;
+ int add = -1;
+ spacesepstream sep(umodes);
sep.GetToken(modebuf);
for (auto mode : modebuf)
{