Commit be9c577d authored by louiz’'s avatar louiz’

Apply all the clang-tidy performance-* fixes

parent b82a14f2
......@@ -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);
}
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
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());
chan_name.append(utils::empty_if_fixed_server("%" + hostname));
for (const auto& line: lines)
{
const auto seconds = line.date.value().timeStamp();
this->xmpp.send_history_message(chan_name + utils::empty_if_fixed_server("%" + hostname), line.nick.value(),
line.body.value(),
this->xmpp.send_history_message(chan_name, line.nick.value(), line.body.value(),
this->user_jid + "/" + resource, seconds);
}
#endif
......
......@@ -157,7 +157,7 @@ public:
* 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, 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
*/
......
......@@ -385,7 +385,7 @@ void IrcClient::send_message(IrcMessage&& message)
res += message.command;
for (const std::string& arg: message.arguments)
{
if (arg.find(" ") != std::string::npos ||
if (arg.find(' ') != std::string::npos ||
(!arg.empty() && arg[0] == ':'))
{
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
// 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)
{
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,
const std::string& hostname, const std::string& trusted_fingerprint,
std::exception_ptr exc)
const std::exception_ptr& exc)
{
if (!trusted_fingerprint.empty() && !certs.empty() &&
......
......@@ -19,7 +19,7 @@ class TCPSocketHandler;
*/
void check_tls_certificate(const std::vector<Botan::X509_Certificate>& certs,
const std::string& hostname, const std::string& trusted_fingerprint,
std::exception_ptr exc);
const std::exception_ptr& exc);
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["from"] = muc_name + "@" + this->served_hostname + "/" + nick;
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");
x["xmlns"] = MUC_USER_NS;
if (self)
......
......@@ -52,7 +52,7 @@ XmlNode::XmlNode(const std::string& name, XmlNode* parent):
parent(parent)
{
// split the namespace and the name
auto n = name.rfind(":");
auto n = name.rfind(':');
if (n == std::string::npos)
this->name = name;
else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment