Apply all the clang-tidy performance-* fixes
This commit is contained in:
@@ -988,16 +988,16 @@ void Bridge::send_room_history(const std::string& hostname, const std::string& c
|
|||||||
this->send_room_history(hostname, chan_name, resource);
|
this->send_room_history(hostname, chan_name, resource);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Bridge::send_room_history(const std::string& hostname, const std::string& chan_name, const std::string& resource)
|
void Bridge::send_room_history(const std::string& hostname, std::string chan_name, const std::string& resource)
|
||||||
{
|
{
|
||||||
#ifdef USE_DATABASE
|
#ifdef USE_DATABASE
|
||||||
const auto coptions = Database::get_irc_channel_options_with_server_and_global_default(this->user_jid, hostname, chan_name);
|
const auto coptions = Database::get_irc_channel_options_with_server_and_global_default(this->user_jid, hostname, chan_name);
|
||||||
const auto lines = Database::get_muc_logs(this->user_jid, chan_name, hostname, coptions.maxHistoryLength.value());
|
const auto lines = Database::get_muc_logs(this->user_jid, chan_name, hostname, coptions.maxHistoryLength.value());
|
||||||
|
chan_name.append(utils::empty_if_fixed_server("%" + hostname));
|
||||||
for (const auto& line: lines)
|
for (const auto& line: lines)
|
||||||
{
|
{
|
||||||
const auto seconds = line.date.value().timeStamp();
|
const auto seconds = line.date.value().timeStamp();
|
||||||
this->xmpp.send_history_message(chan_name + utils::empty_if_fixed_server("%" + hostname), line.nick.value(),
|
this->xmpp.send_history_message(chan_name, line.nick.value(), line.body.value(),
|
||||||
line.body.value(),
|
|
||||||
this->user_jid + "/" + resource, seconds);
|
this->user_jid + "/" + resource, seconds);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ public:
|
|||||||
* Send the MUC history to the user
|
* Send the MUC history to the user
|
||||||
*/
|
*/
|
||||||
void send_room_history(const std::string& hostname, const std::string& chan_name);
|
void send_room_history(const std::string& hostname, const std::string& chan_name);
|
||||||
void send_room_history(const std::string& hostname, const std::string& chan_name, const std::string& resource);
|
void send_room_history(const std::string& hostname, std::string chan_name, const std::string& resource);
|
||||||
/**
|
/**
|
||||||
* Send a MUC message from some participant
|
* Send a MUC message from some participant
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -385,7 +385,7 @@ void IrcClient::send_message(IrcMessage&& message)
|
|||||||
res += message.command;
|
res += message.command;
|
||||||
for (const std::string& arg: message.arguments)
|
for (const std::string& arg: message.arguments)
|
||||||
{
|
{
|
||||||
if (arg.find(" ") != std::string::npos ||
|
if (arg.find(' ') != std::string::npos ||
|
||||||
(!arg.empty() && arg[0] == ':'))
|
(!arg.empty() && arg[0] == ':'))
|
||||||
{
|
{
|
||||||
res += " :" + arg;
|
res += " :" + arg;
|
||||||
@@ -1080,7 +1080,7 @@ void IrcClient::on_channel_mode(const IrcMessage& message)
|
|||||||
{
|
{
|
||||||
// That mode can also be of type B if it is present in the
|
// That mode can also be of type B if it is present in the
|
||||||
// prefix_to_mode map
|
// prefix_to_mode map
|
||||||
for (const std::pair<char, char>& pair: this->prefix_to_mode)
|
for (const auto& pair: this->prefix_to_mode)
|
||||||
if (pair.second == c)
|
if (pair.second == c)
|
||||||
{
|
{
|
||||||
type = 1;
|
type = 1;
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ const std::string& BasicCredentialsManager::get_trusted_fingerprint() const
|
|||||||
|
|
||||||
void check_tls_certificate(const std::vector<Botan::X509_Certificate>& certs,
|
void check_tls_certificate(const std::vector<Botan::X509_Certificate>& certs,
|
||||||
const std::string& hostname, const std::string& trusted_fingerprint,
|
const std::string& hostname, const std::string& trusted_fingerprint,
|
||||||
std::exception_ptr exc)
|
const std::exception_ptr& exc)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!trusted_fingerprint.empty() && !certs.empty() &&
|
if (!trusted_fingerprint.empty() && !certs.empty() &&
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ class TCPSocketHandler;
|
|||||||
*/
|
*/
|
||||||
void check_tls_certificate(const std::vector<Botan::X509_Certificate>& certs,
|
void check_tls_certificate(const std::vector<Botan::X509_Certificate>& certs,
|
||||||
const std::string& hostname, const std::string& trusted_fingerprint,
|
const std::string& hostname, const std::string& trusted_fingerprint,
|
||||||
std::exception_ptr exc);
|
const std::exception_ptr& exc);
|
||||||
|
|
||||||
class BasicCredentialsManager: public Botan::Credentials_Manager
|
class BasicCredentialsManager: public Botan::Credentials_Manager
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -445,7 +445,7 @@ void XmppComponent::send_muc_leave(const std::string& muc_name, const std::strin
|
|||||||
presence["to"] = jid_to;
|
presence["to"] = jid_to;
|
||||||
presence["from"] = muc_name + "@" + this->served_hostname + "/" + nick;
|
presence["from"] = muc_name + "@" + this->served_hostname + "/" + nick;
|
||||||
presence["type"] = "unavailable";
|
presence["type"] = "unavailable";
|
||||||
const std::string message_str = std::get<0>(message);
|
const std::string& message_str = std::get<0>(message);
|
||||||
XmlSubNode x(presence, "x");
|
XmlSubNode x(presence, "x");
|
||||||
x["xmlns"] = MUC_USER_NS;
|
x["xmlns"] = MUC_USER_NS;
|
||||||
if (self)
|
if (self)
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ XmlNode::XmlNode(const std::string& name, XmlNode* parent):
|
|||||||
parent(parent)
|
parent(parent)
|
||||||
{
|
{
|
||||||
// split the namespace and the name
|
// split the namespace and the name
|
||||||
auto n = name.rfind(":");
|
auto n = name.rfind(':');
|
||||||
if (n == std::string::npos)
|
if (n == std::string::npos)
|
||||||
this->name = name;
|
this->name = name;
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user