summaryrefslogtreecommitdiff
path: root/src/irc/irc_client.cpp
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2014-05-28 01:27:41 +0200
committerFlorent Le Coz <louiz@louiz.org>2014-05-28 01:27:41 +0200
commit6c2d03da4ea0443624b6bf434b6a654c12e48438 (patch)
treea1fd150cd3f6c114f1844bed7f57d8ce6438049f /src/irc/irc_client.cpp
parent7b31bea75b0c5b9fe127ea6d845e48a3f87d480f (diff)
downloadbiboumi-6c2d03da4ea0443624b6bf434b6a654c12e48438.tar.gz
biboumi-6c2d03da4ea0443624b6bf434b6a654c12e48438.tar.bz2
biboumi-6c2d03da4ea0443624b6bf434b6a654c12e48438.tar.xz
biboumi-6c2d03da4ea0443624b6bf434b6a654c12e48438.zip
Send an error presence when the connection to the IRC server fails
Diffstat (limited to 'src/irc/irc_client.cpp')
-rw-r--r--src/irc/irc_client.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/irc/irc_client.cpp b/src/irc/irc_client.cpp
index 270e0ed..f08e9d6 100644
--- a/src/irc/irc_client.cpp
+++ b/src/irc/irc_client.cpp
@@ -50,6 +50,13 @@ void IrcClient::on_connection_failed(const std::string& reason)
{
this->bridge->send_xmpp_message(this->hostname, "",
"Connection failed: "s + reason);
+ // Send an error message for all room that the user wanted to join
+ for (const std::string& channel: this->channels_to_join)
+ {
+ Iid iid(channel + "%" + this->hostname);
+ this->bridge->send_join_failed(iid, this->current_nick,
+ "cancel", "item-not-found", reason);
+ }
}
void IrcClient::on_connected()
@@ -167,11 +174,11 @@ void IrcClient::send_quit_command(const std::string& reason)
void IrcClient::send_join_command(const std::string& chan_name)
{
- this->start();
if (this->welcomed == false)
this->channels_to_join.push_back(chan_name);
else
this->send_message(IrcMessage("JOIN", {chan_name}));
+ this->start();
}
bool IrcClient::send_channel_message(const std::string& chan_name, const std::string& body)