summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlouiz’ <louiz@louiz.org>2017-07-08 14:04:35 +0200
committerlouiz’ <louiz@louiz.org>2017-07-08 14:04:35 +0200
commitfaed8952cb6ba063e5424364df69cef193fb736e (patch)
treec7a4b744db70bb12b7dca9fcc6f724ab0a6993da
parent7a9b2dca06c390531ec7f5d85e58cc27e17e7b74 (diff)
downloadbiboumi-faed8952cb6ba063e5424364df69cef193fb736e.tar.gz
biboumi-faed8952cb6ba063e5424364df69cef193fb736e.tar.bz2
biboumi-faed8952cb6ba063e5424364df69cef193fb736e.tar.xz
biboumi-faed8952cb6ba063e5424364df69cef193fb736e.zip
Remove a bunch of useless string_literal usage
-rw-r--r--src/bridge/bridge.cpp10
-rw-r--r--src/database/select_query.hpp2
-rw-r--r--src/database/table.cpp2
-rw-r--r--src/database/table.hpp2
-rw-r--r--src/irc/irc_client.cpp22
-rw-r--r--src/network/tcp_client_socket_handler.cpp6
-rw-r--r--src/xmpp/adhoc_command.cpp2
-rw-r--r--src/xmpp/adhoc_commands_handler.cpp8
-rw-r--r--src/xmpp/biboumi_adhoc_commands.cpp12
-rw-r--r--src/xmpp/biboumi_component.cpp10
-rw-r--r--src/xmpp/xmpp_component.cpp6
11 files changed, 41 insertions, 41 deletions
diff --git a/src/bridge/bridge.cpp b/src/bridge/bridge.cpp
index 81ca147..f4c7412 100644
--- a/src/bridge/bridge.cpp
+++ b/src/bridge/bridge.cpp
@@ -378,7 +378,7 @@ void Bridge::forward_affiliation_role_change(const Iid& iid, const std::string&
}
else if (message.command == "472" && message.arguments.size() >= 2)
{
- std::string error_message = "Unknown mode: "s + message.arguments[1];
+ std::string error_message = "Unknown mode: " + message.arguments[1];
if (message.arguments.size() >= 3)
error_message = message.arguments[2];
this->xmpp.send_stanza_error("iq", from, std::to_string(iid), id, "cancel", "not-allowed",
@@ -465,7 +465,7 @@ void Bridge::leave_irc_channel(Iid&& iid, const std::string& status_message, con
{
if (channel && channel->joined)
this->send_muc_leave(iid, channel->get_self()->nick,
- "Biboumi note: "s + std::to_string(resources - 1) + " resources are still in this channel.",
+ "Biboumi note: " + std::to_string(resources - 1) + " resources are still in this channel.",
true, resource);
this->remove_resource_from_chan(key, resource);
if (this->number_of_channels_the_resource_is_in(iid.get_server(), resource) == 0)
@@ -702,12 +702,12 @@ void Bridge::send_xmpp_version_to_irc(const Iid& iid, const std::string& name, c
{
std::string result(name + " " + version + " " + os);
- this->send_private_message(iid, "\01VERSION "s + result + "\01", "NOTICE");
+ this->send_private_message(iid, "\01VERSION " + result + "\01", "NOTICE");
}
void Bridge::send_irc_ping_result(const Iid& iid, const std::string& id)
{
- this->send_private_message(iid, "\01PING "s + utils::revstr(id) + "\01", "NOTICE");
+ this->send_private_message(iid, "\01PING " + utils::revstr(id) + "\01", "NOTICE");
}
void Bridge::send_irc_user_ping_request(const std::string& irc_hostname, const std::string& nick,
@@ -923,7 +923,7 @@ void Bridge::send_xmpp_message(const std::string& from, const std::string& autho
if (!author.empty())
{
IrcUser user(author);
- body = "\u000303"s + user.nick + (user.host.empty()?
+ body = "\u000303" + user.nick + (user.host.empty()?
"\u0003: ":
(" (\u000310" + user.host + "\u000303)\u0003: ")) + msg;
}
diff --git a/src/database/select_query.hpp b/src/database/select_query.hpp
index f4d71af..872001c 100644
--- a/src/database/select_query.hpp
+++ b/src/database/select_query.hpp
@@ -79,7 +79,7 @@ struct SelectQuery: public Query
using ColumnsType = std::tuple<T...>;
using ColumnType = typename std::remove_reference<decltype(std::get<N>(std::declval<ColumnsType>()))>::type;
- this->body += " "s + ColumnType::name;
+ this->body += " " + std::string{ColumnType::name};
if (N < (sizeof...(T) - 1))
this->body += ", ";
diff --git a/src/database/table.cpp b/src/database/table.cpp
index 5929f33..160f426 100644
--- a/src/database/table.cpp
+++ b/src/database/table.cpp
@@ -4,7 +4,7 @@ std::set<std::string> get_all_columns_from_table(sqlite3* db, const std::string&
{
std::set<std::string> result;
char* errmsg;
- std::string query{"PRAGMA table_info("s + table_name + ")"};
+ std::string query{"PRAGMA table_info(" + table_name + ")"};
log_debug(query);
int res = sqlite3_exec(db, query.data(), [](void* param, int columns_nb, char** columns, char**) -> int {
constexpr int name_column = 1;
diff --git a/src/database/table.hpp b/src/database/table.hpp
index f2f70bb..c9e35d3 100644
--- a/src/database/table.hpp
+++ b/src/database/table.hpp
@@ -17,7 +17,7 @@ template <typename ColumnType>
void add_column_to_table(sqlite3* db, const std::string& table_name)
{
const std::string name = ColumnType::name;
- std::string query{"ALTER TABLE "s + table_name + " ADD " + ColumnType::name + " " + TypeToSQLType<typename ColumnType::real_type>::type};
+ std::string query{"ALTER TABLE " + table_name + " ADD " + ColumnType::name + " " + TypeToSQLType<typename ColumnType::real_type>::type};
log_debug(query);
char* error;
const auto result = sqlite3_exec(db, query.data(), nullptr, nullptr, &error);
diff --git a/src/irc/irc_client.cpp b/src/irc/irc_client.cpp
index bacb89e..00a7158 100644
--- a/src/irc/irc_client.cpp
+++ b/src/irc/irc_client.cpp
@@ -178,7 +178,7 @@ IrcClient::~IrcClient()
{
// This event may or may not exist (if we never got connected, it
// doesn't), but it's ok
- TimedEventsManager::instance().cancel("PING"s + this->hostname + this->bridge.get_jid());
+ TimedEventsManager::instance().cancel("PING" + this->hostname + this->bridge.get_jid());
}
void IrcClient::start()
@@ -194,7 +194,7 @@ void IrcClient::start()
bool tls;
std::tie(port, tls) = this->ports_to_try.top();
this->ports_to_try.pop();
- this->bridge.send_xmpp_message(this->hostname, "", "Connecting to "s +
+ this->bridge.send_xmpp_message(this->hostname, "", "Connecting to " +
this->hostname + ":" + port + " (" +
(tls ? "encrypted" : "not encrypted") + ")");
@@ -213,7 +213,7 @@ void IrcClient::start()
void IrcClient::on_connection_failed(const std::string& reason)
{
this->bridge.send_xmpp_message(this->hostname, "",
- "Connection failed: "s + reason);
+ "Connection failed: " + reason);
if (this->hostname_resolution_failed)
while (!this->ports_to_try.empty())
@@ -260,7 +260,7 @@ void IrcClient::on_connected()
{
if (this->is_connected())
{
- this->on_connection_close("Could not resolve hostname "s + this->user_hostname +
+ this->on_connection_close("Could not resolve hostname " + this->user_hostname +
": " + error_msg);
this->send_quit_command("");
}
@@ -585,7 +585,7 @@ void IrcClient::on_notice(const IrcMessage& message)
// The notice was directed at a channel we are in. Modify the message
// to indicate that it is a notice, and make it a MUC message coming
// from the MUC JID
- IrcMessage modified_message(std::move(from), "PRIVMSG", {to, "\u000303[notice]\u0003 "s + body});
+ IrcMessage modified_message(std::move(from), "PRIVMSG", {to, "\u000303[notice]\u0003 " + body});
this->on_channel_message(modified_message);
}
}
@@ -697,7 +697,7 @@ void IrcClient::on_channel_message(const IrcMessage& message)
{
if (body.substr(1, 6) == "ACTION")
this->bridge.send_message(iid, nick,
- "/me"s + body.substr(7, body.size() - 8), muc);
+ "/me" + body.substr(7, body.size() - 8), muc);
else if (body.substr(1, 8) == "VERSION\01")
this->bridge.send_iq_version_request(nick, this->hostname);
else if (body.substr(1, 5) == "PING ")
@@ -899,7 +899,7 @@ void IrcClient::on_welcome_message(const IrcMessage& message)
#endif
// Install a repeated events to regularly send a PING
TimedEventsManager::instance().add_event(TimedEvent(240s, std::bind(&IrcClient::send_ping_command, this),
- "PING"s + this->hostname + this->bridge.get_jid()));
+ "PING" + this->hostname + this->bridge.get_jid()));
std::string channels{};
std::string channels_with_key{};
std::string keys{};
@@ -1002,7 +1002,7 @@ void IrcClient::on_error(const IrcMessage& message)
this->bridge.send_muc_leave(iid, std::move(own_nick), leave_message, true);
}
this->channels.clear();
- this->send_gateway_message("ERROR: "s + leave_message);
+ this->send_gateway_message("ERROR: " + leave_message);
}
void IrcClient::on_quit(const IrcMessage& message)
@@ -1135,7 +1135,7 @@ void IrcClient::on_channel_mode(const IrcMessage& message)
mode_arguments += message.arguments[i];
}
}
- this->bridge.send_message(iid, "", "Mode "s + iid.get_local() +
+ this->bridge.send_message(iid, "", "Mode " + iid.get_local() +
" [" + mode_arguments + "] by " + user.nick,
true);
const IrcChannel* channel = this->get_channel(iid.get_local());
@@ -1213,7 +1213,7 @@ void IrcClient::on_channel_mode(const IrcMessage& message)
void IrcClient::on_user_mode(const IrcMessage& message)
{
this->bridge.send_xmpp_message(this->hostname, "",
- "User mode for "s + message.arguments[0] +
+ "User mode for " + message.arguments[0] +
" is [" + message.arguments[1] + "]");
}
@@ -1252,7 +1252,7 @@ void IrcClient::leave_dummy_channel(const std::string& exit_message, const std::
this->dummy_channel.joined = false;
this->dummy_channel.joining = false;
this->dummy_channel.remove_all_users();
- this->bridge.send_muc_leave(Iid("%"s + this->hostname, this->chantypes), std::string(this->current_nick), exit_message, true, resource);
+ this->bridge.send_muc_leave(Iid("%" + this->hostname, this->chantypes), std::string(this->current_nick), exit_message, true, resource);
}
#ifdef BOTAN_FOUND
diff --git a/src/network/tcp_client_socket_handler.cpp b/src/network/tcp_client_socket_handler.cpp
index 35f2446..aac13d0 100644
--- a/src/network/tcp_client_socket_handler.cpp
+++ b/src/network/tcp_client_socket_handler.cpp
@@ -146,7 +146,7 @@ void TCPClientSocketHandler::connect(const std::string& address, const std::stri
|| errno == EISCONN)
{
log_info("Connection success.");
- TimedEventsManager::instance().cancel("connection_timeout"s +
+ TimedEventsManager::instance().cancel("connection_timeout" +
std::to_string(this->socket));
this->poller->add_socket_handler(this);
this->connected = true;
@@ -196,7 +196,7 @@ void TCPClientSocketHandler::connect(const std::string& address, const std::stri
TimedEventsManager::instance().add_event(
TimedEvent(std::chrono::steady_clock::now() + 5s,
std::bind(&TCPClientSocketHandler::on_connection_timeout, this),
- "connection_timeout"s + std::to_string(this->socket)));
+ "connection_timeout" + std::to_string(this->socket)));
return ;
}
log_info("Connection failed:", std::strerror(errno));
@@ -220,7 +220,7 @@ void TCPClientSocketHandler::connect()
void TCPClientSocketHandler::close()
{
- TimedEventsManager::instance().cancel("connection_timeout"s +
+ TimedEventsManager::instance().cancel("connection_timeout" +
std::to_string(this->socket));
TCPSocketHandler::close();
diff --git a/src/xmpp/adhoc_command.cpp b/src/xmpp/adhoc_command.cpp
index e02bf35..fbf4ce2 100644
--- a/src/xmpp/adhoc_command.cpp
+++ b/src/xmpp/adhoc_command.cpp
@@ -59,7 +59,7 @@ void HelloStep2(XmppComponent&, AdhocSession& session, XmlNode& command_node)
command_node.delete_all_children();
XmlSubNode note(command_node, "note");
note["type"] = "info";
- note.set_inner("Hello "s + value_str + "!"s);
+ note.set_inner("Hello " + value_str + "!"s);
return;
}
}
diff --git a/src/xmpp/adhoc_commands_handler.cpp b/src/xmpp/adhoc_commands_handler.cpp
index 040d0ff..e4dcd5c 100644
--- a/src/xmpp/adhoc_commands_handler.cpp
+++ b/src/xmpp/adhoc_commands_handler.cpp
@@ -19,7 +19,7 @@ void AdhocCommandsHandler::add_command(std::string name, AdhocCommand command)
{
const auto found = this->commands.find(name);
if (found != this->commands.end())
- throw std::runtime_error("Trying to add an ad-hoc command that already exist: "s + name);
+ throw std::runtime_error("Trying to add an ad-hoc command that already exist: " + name);
this->commands.emplace(std::make_pair(std::move(name), std::move(command)));
}
@@ -59,7 +59,7 @@ XmlNode AdhocCommandsHandler::handle_request(const std::string& executor_jid, co
std::forward_as_tuple(command_it->second, executor_jid, to));
TimedEventsManager::instance().add_event(TimedEvent(std::chrono::steady_clock::now() + 3600s,
std::bind(&AdhocCommandsHandler::remove_session, this, sessionid, executor_jid),
- "adhocsession"s + sessionid + executor_jid));
+ "adhocsession" + sessionid + executor_jid));
}
auto session_it = this->sessions.find(std::make_pair(sessionid, executor_jid));
if ((session_it != this->sessions.end()) &&
@@ -74,7 +74,7 @@ XmlNode AdhocCommandsHandler::handle_request(const std::string& executor_jid, co
{
this->sessions.erase(session_it);
command_node["status"] = "completed";
- TimedEventsManager::instance().cancel("adhocsession"s + sessionid + executor_jid);
+ TimedEventsManager::instance().cancel("adhocsession" + sessionid + executor_jid);
}
else
{
@@ -87,7 +87,7 @@ XmlNode AdhocCommandsHandler::handle_request(const std::string& executor_jid, co
{
this->sessions.erase(session_it);
command_node["status"] = "canceled";
- TimedEventsManager::instance().cancel("adhocsession"s + sessionid + executor_jid);
+ TimedEventsManager::instance().cancel("adhocsession" + sessionid + executor_jid);
}
else // unsupported action
{
diff --git a/src/xmpp/biboumi_adhoc_commands.cpp b/src/xmpp/biboumi_adhoc_commands.cpp
index 4129517..27b079b 100644
--- a/src/xmpp/biboumi_adhoc_commands.cpp
+++ b/src/xmpp/biboumi_adhoc_commands.cpp
@@ -223,9 +223,9 @@ void ConfigureIrcServerStep1(XmppComponent&, AdhocSession& session, XmlNode& com
XmlSubNode x(command_node, "jabber:x:data:x");
x["type"] = "form";
XmlSubNode title(x, "title");
- title.set_inner("Configure the IRC server "s + server_domain);
+ title.set_inner("Configure the IRC server " + server_domain);
XmlSubNode instructions(x, "instructions");
- instructions.set_inner("Edit the form, to configure the settings of the IRC server "s + server_domain);
+ instructions.set_inner("Edit the form, to configure the settings of the IRC server " + server_domain);
{
XmlSubNode ports(x, "field");
@@ -469,9 +469,9 @@ void insert_irc_channel_configuration_form(XmlNode& node, const Jid& requester,
XmlSubNode x(node, "jabber:x:data:x");
x["type"] = "form";
XmlSubNode title(x, "title");
- title.set_inner("Configure the IRC channel "s + iid.get_local() + " on server "s + iid.get_server());
+ title.set_inner("Configure the IRC channel " + iid.get_local() + " on server " + iid.get_server());
XmlSubNode instructions(x, "instructions");
- instructions.set_inner("Edit the form, to configure the settings of the IRC channel "s + iid.get_local());
+ instructions.set_inner("Edit the form, to configure the settings of the IRC channel " + iid.get_local());
{
XmlSubNode record_history(x, "field");
@@ -693,7 +693,7 @@ void DisconnectUserFromServerStep2(XmppComponent& xmpp_component, AdhocSession&
{
XmlSubNode note(command_node, "note");
note["type"] = "info";
- note.set_inner("User "s + jid_to_disconnect + " is not connected to any IRC server.");
+ note.set_inner("User " + jid_to_disconnect + " is not connected to any IRC server.");
session.terminate();
return ;
}
@@ -797,7 +797,7 @@ void GetIrcConnectionInfoStep1(XmppComponent& component, AdhocSession& session,
IrcClient* irc = bridge->find_irc_client(hostname);
if (!irc || !irc->is_connected())
{
- message = "You are not connected to the IRC server "s + hostname;
+ message = "You are not connected to the IRC server " + hostname;
return;
}
diff --git a/src/xmpp/biboumi_component.cpp b/src/xmpp/biboumi_component.cpp
index 32f3968..1c7cd92 100644
--- a/src/xmpp/biboumi_component.cpp
+++ b/src/xmpp/biboumi_component.cpp
@@ -177,7 +177,7 @@ void BiboumiComponent::handle_presence(const Stanza& stanza)
if (type != "unavailable")
this->send_stanza_error("presence", from_str, to_str, id,
"cancel", "remote-server-not-found",
- "Not connected to IRC server "s + ex.hostname,
+ "Not connected to IRC server " + ex.hostname,
true);
}
stanza_error.disable();
@@ -277,7 +277,7 @@ void BiboumiComponent::handle_message(const Stanza& stanza)
{
this->send_stanza_error("message", from_str, to_str, id,
"cancel", "remote-server-not-found",
- "Not connected to IRC server "s + ex.hostname,
+ "Not connected to IRC server " + ex.hostname,
true);
}
stanza_error.disable();
@@ -586,7 +586,7 @@ void BiboumiComponent::handle_iq(const Stanza& stanza)
{
this->send_stanza_error("iq", from, to_str, id,
"cancel", "remote-server-not-found",
- "Not connected to IRC server "s + ex.hostname,
+ "Not connected to IRC server " + ex.hostname,
true);
stanza_error.disable();
return;
@@ -806,7 +806,7 @@ void BiboumiComponent::send_irc_server_disco_info(const std::string& id, const s
XmlSubNode identity(query, "identity");
identity["category"] = "conference";
identity["type"] = "irc";
- identity["name"] = "IRC server "s + from.local + " over Biboumi";
+ identity["name"] = "IRC server " + from.local + " over Biboumi";
for (const char *ns: {DISCO_INFO_NS, MUC_NS, ADHOC_NS, PING_NS, MAM_NS, VERSION_NS})
{
XmlSubNode feature(query, "feature");
@@ -849,7 +849,7 @@ void BiboumiComponent::send_irc_channel_disco_info(const std::string& id, const
XmlSubNode identity(query, "identity");
identity["category"] = "conference";
identity["type"] = "irc";
- identity["name"] = "IRC channel "s + iid.get_local() + " from server " + iid.get_server() + " over biboumi";
+ identity["name"] = "IRC channel " + iid.get_local() + " from server " + iid.get_server() + " over biboumi";
for (const char *ns: {DISCO_INFO_NS, MUC_NS, ADHOC_NS, PING_NS, MAM_NS, VERSION_NS})
{
XmlSubNode feature(query, "feature");
diff --git a/src/xmpp/xmpp_component.cpp b/src/xmpp/xmpp_component.cpp
index b138ed9..3c69b36 100644
--- a/src/xmpp/xmpp_component.cpp
+++ b/src/xmpp/xmpp_component.cpp
@@ -92,7 +92,7 @@ void XmppComponent::on_connected()
{
log_info("connected to XMPP server");
this->first_connection_try = true;
- auto data = "<stream:stream to='"s + this->served_hostname + \
+ auto data = "<stream:stream to='" + this->served_hostname + \
"' xmlns:stream='http://etherx.jabber.org/streams' xmlns='" COMPONENT_NS "'>";
log_debug("XMPP SENDING: ", data);
this->send_data(std::move(data));
@@ -142,7 +142,7 @@ void XmppComponent::on_remote_stream_open(const XmlNode& node)
}
// Try to authenticate
- auto data = "<handshake xmlns='" COMPONENT_NS "'>"s + get_handshake_digest(this->stream_id, this->secret) + "</handshake>";
+ auto data = "<handshake xmlns='" COMPONENT_NS "'>" + get_handshake_digest(this->stream_id, this->secret) + "</handshake>";
log_debug("XMPP SENDING: ", data);
this->send_data(std::move(data));
}
@@ -642,7 +642,7 @@ void XmppComponent::send_iq_version_request(const std::string& from,
Stanza iq("iq");
{
iq["type"] = "get";
- iq["id"] = "version_"s + XmppComponent::next_id();
+ iq["id"] = "version_" + XmppComponent::next_id();
iq["from"] = from + "@" + this->served_hostname;
iq["to"] = jid_to;
XmlSubNode query(iq, "query");