mirror of
https://github.com/anope/anope.git
synced 2026-07-04 11:03:14 +02:00
Add a non-formatting overload of User::SetModesInternal.
This commit is contained in:
@@ -309,6 +309,7 @@ public:
|
||||
* @param umodes The modes
|
||||
*/
|
||||
void SetModesInternal(const MessageSource &source, const char *umodes, ...) ATTR_FORMAT(3, 4);
|
||||
void SetModesInternal(const MessageSource &source, const Anope::string &umodes);
|
||||
|
||||
/** Get modes set for this user.
|
||||
* @return A string of modes set on the user
|
||||
|
||||
@@ -593,7 +593,7 @@ struct IRCDMessageSVSMode : IRCDMessage
|
||||
if (!params[1].is_pos_number_only() || convertTo<time_t>(params[1]) != u->timestamp)
|
||||
return;
|
||||
|
||||
u->SetModesInternal(source, "%s", params[2].c_str());
|
||||
u->SetModesInternal(source, params[2]);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1690,7 +1690,7 @@ struct IRCDMessageMode : IRCDMessage
|
||||
*/
|
||||
User *u = User::Find(params[0]);
|
||||
if (u)
|
||||
u->SetModesInternal(source, "%s", params[1].c_str());
|
||||
u->SetModesInternal(source, params[1]);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -380,7 +380,7 @@ struct IRCDMessageMode : IRCDMessage
|
||||
User *u = User::Find(params[0]);
|
||||
|
||||
if (u)
|
||||
u->SetModesInternal(source, "%s", params[1].c_str());
|
||||
u->SetModesInternal(source, params[1]);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1153,7 +1153,7 @@ struct IRCDMessageMode : IRCDMessage
|
||||
{
|
||||
User *u = User::Find(params[0]);
|
||||
if (u)
|
||||
u->SetModesInternal(source, "%s", params[1].c_str());
|
||||
u->SetModesInternal(source, params[1]);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -1622,7 +1622,7 @@ struct IRCDMessageUmode2 : IRCDMessage
|
||||
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override
|
||||
{
|
||||
source.GetUser()->SetModesInternal(source, "%s", params[0].c_str());
|
||||
source.GetUser()->SetModesInternal(source, params[0]);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ BotInfo::BotInfo(const Anope::string &nnick, const Anope::string &nuser, const A
|
||||
{
|
||||
Anope::string tmodes = !this->botmodes.empty() ? ("+" + this->botmodes) : IRCD->DefaultPseudoclientModes;
|
||||
if (!tmodes.empty())
|
||||
this->SetModesInternal(this, tmodes.c_str());
|
||||
this->SetModesInternal(this, tmodes);
|
||||
|
||||
XLine x(this->nick, "Reserved for services");
|
||||
IRCD->SendSQLine(NULL, &x);
|
||||
|
||||
+1
-1
@@ -229,7 +229,7 @@ void Message::Mode::Run(MessageSource &source, const std::vector<Anope::string>
|
||||
User *u = User::Find(params[0]);
|
||||
|
||||
if (u)
|
||||
u->SetModesInternal(source, "%s", buf.substr(1).c_str());
|
||||
u->SetModesInternal(source, buf.substr(1));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -52,7 +52,7 @@ Server::Server(Server *up, const Anope::string &sname, unsigned shops, const Ano
|
||||
{
|
||||
Anope::string modes = !bi->botmodes.empty() ? ("+" + bi->botmodes) : IRCD->DefaultPseudoclientModes;
|
||||
|
||||
bi->SetModesInternal(bi, modes.c_str());
|
||||
bi->SetModesInternal(bi, modes);
|
||||
for (const auto &botchannel : bi->botchannels)
|
||||
{
|
||||
size_t h = botchannel.find('#');
|
||||
|
||||
+12
-6
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user