Send an error presence when the connection to the IRC server fails

This commit is contained in:
Florent Le Coz
2014-05-28 01:27:41 +02:00
parent 7b31bea75b
commit 6c2d03da4e
5 changed files with 54 additions and 1 deletions
+8 -1
View File
@@ -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)