From faed8952cb6ba063e5424364df69cef193fb736e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Sat, 8 Jul 2017 14:04:35 +0200 Subject: Remove a bunch of useless string_literal usage --- src/irc/irc_client.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'src/irc') 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 -- cgit v1.2.3 From 3a95076db40dbdff4b130c5d9b8db81e537a750d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Sat, 8 Jul 2017 16:59:29 +0200 Subject: Send a 110 status code on a QUIT received for ourself --- src/irc/irc_client.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/irc') diff --git a/src/irc/irc_client.cpp b/src/irc/irc_client.cpp index 00a7158..00314b2 100644 --- a/src/irc/irc_client.cpp +++ b/src/irc/irc_client.cpp @@ -1015,6 +1015,9 @@ void IrcClient::on_quit(const IrcMessage& message) const std::string& chan_name = pair.first; IrcChannel* channel = pair.second.get(); const IrcUser* user = channel->find_user(message.prefix); + bool self = false; + if (user == channel->get_self()) + self = true; if (user) { std::string nick = user->nick; @@ -1023,7 +1026,7 @@ void IrcClient::on_quit(const IrcMessage& message) iid.set_local(chan_name); iid.set_server(this->hostname); iid.type = Iid::Type::Channel; - this->bridge.send_muc_leave(iid, std::move(nick), txt, false); + this->bridge.send_muc_leave(iid, std::move(nick), txt, self); } } } -- cgit v1.2.3 From 9fa1852c7ea094086f45e840fa22cc83d56b744e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Sat, 8 Jul 2017 18:10:47 +0200 Subject: =?UTF-8?q?Send=20status=20code=3D'332'=20on=20biboumi=20or=20IRC?= =?UTF-8?q?=20server=E2=80=99s=20shutdown?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/irc/irc_client.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/irc') diff --git a/src/irc/irc_client.cpp b/src/irc/irc_client.cpp index 00314b2..67221c5 100644 --- a/src/irc/irc_client.cpp +++ b/src/irc/irc_client.cpp @@ -981,7 +981,7 @@ void IrcClient::on_part(const IrcMessage& message) // channel pointer is now invalid channel = nullptr; } - this->bridge.send_muc_leave(iid, std::move(nick), txt, self); + this->bridge.send_muc_leave(iid, std::move(nick), txt, self, true); } } @@ -999,7 +999,7 @@ void IrcClient::on_error(const IrcMessage& message) if (!channel->joined) continue; std::string own_nick = channel->get_self()->nick; - this->bridge.send_muc_leave(iid, std::move(own_nick), leave_message, true); + this->bridge.send_muc_leave(iid, std::move(own_nick), leave_message, true, false); } this->channels.clear(); this->send_gateway_message("ERROR: " + leave_message); @@ -1026,7 +1026,7 @@ void IrcClient::on_quit(const IrcMessage& message) iid.set_local(chan_name); iid.set_server(this->hostname); iid.type = Iid::Type::Channel; - this->bridge.send_muc_leave(iid, std::move(nick), txt, self); + this->bridge.send_muc_leave(iid, std::move(nick), txt, self, false); } } } @@ -1255,7 +1255,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("%" + 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, true, resource); } #ifdef BOTAN_FOUND -- cgit v1.2.3 From f9a6f973966430b108642ac57d54db5fd0d5535e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Tue, 4 Jul 2017 20:42:40 +0200 Subject: Implement the roster presences from IRC servers --- src/irc/irc_client.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/irc') diff --git a/src/irc/irc_client.cpp b/src/irc/irc_client.cpp index 67221c5..46dbdbe 100644 --- a/src/irc/irc_client.cpp +++ b/src/irc/irc_client.cpp @@ -297,6 +297,7 @@ void IrcClient::on_connected() #endif this->send_gateway_message("Connected to IRC server"s + (this->use_tls ? " (encrypted)": "") + "."); this->send_pending_data(); + this->bridge.on_irc_client_connected(this->get_hostname()); } void IrcClient::on_connection_close(const std::string& error_msg) @@ -309,6 +310,7 @@ void IrcClient::on_connection_close(const std::string& error_msg) const IrcMessage error{"ERROR", {message}}; this->on_error(error); log_warning(message); + this->bridge.on_irc_client_disconnected(this->get_hostname()); } IrcChannel* IrcClient::get_channel(const std::string& n) -- cgit v1.2.3 From 24f2511d7ba105d65c9684dd5606a57c5af95445 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Thu, 20 Jul 2017 21:28:18 +0200 Subject: In fixed mode, fix the iid type of the component JID --- src/irc/iid.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/irc') diff --git a/src/irc/iid.cpp b/src/irc/iid.cpp index a63a1c3..131c18c 100644 --- a/src/irc/iid.cpp +++ b/src/irc/iid.cpp @@ -35,7 +35,8 @@ Iid::Iid(const std::string& iid, const Bridge *bridge) void Iid::set_type(const std::set& chantypes) { - if (this->local.empty() && this->server.empty()) + if (this->local.empty() && ( + !Config::get("fixed_irc_server", "").empty() || this->server.empty())) this->type = Iid::Type::None; if (this->local.empty()) return; -- cgit v1.2.3