Return a stanza error whenever the IRCClient for a given server does not exist
Instead of ignoring the stanza, we send back an error of type remote-server-not-found each time it's possible. Also avoid having to do if (!irc) return; everytime. fix #3045
This commit is contained in:
@@ -166,6 +166,8 @@ void BiboumiComponent::handle_message(const Stanza& stanza)
|
||||
error_type, error_name, "");
|
||||
});
|
||||
XmlNode* body = stanza.get_child("body", COMPONENT_NS);
|
||||
|
||||
try { // catch IRCNotConnected exceptions
|
||||
if (type == "groupchat" && iid.is_channel)
|
||||
{
|
||||
if (body && !body->get_inner().empty())
|
||||
@@ -220,6 +222,13 @@ void BiboumiComponent::handle_message(const Stanza& stanza)
|
||||
}
|
||||
else if (iid.is_user)
|
||||
this->send_invalid_user_error(to.local, from);
|
||||
} catch (const IRCNotConnected& ex)
|
||||
{
|
||||
this->send_stanza_error("message", from, to_str, id,
|
||||
"cancel", "remote-server-not-found",
|
||||
"Not connected to IRC server "s + ex.hostname,
|
||||
true);
|
||||
}
|
||||
stanza_error.disable();
|
||||
}
|
||||
|
||||
@@ -262,6 +271,7 @@ void BiboumiComponent::handle_iq(const Stanza& stanza)
|
||||
this->send_stanza_error("iq", from, to_str, id,
|
||||
error_type, error_name, "");
|
||||
});
|
||||
try {
|
||||
if (type == "set")
|
||||
{
|
||||
XmlNode* query;
|
||||
@@ -412,6 +422,16 @@ void BiboumiComponent::handle_iq(const Stanza& stanza)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (const IRCNotConnected& ex)
|
||||
{
|
||||
this->send_stanza_error("iq", from, to_str, id,
|
||||
"cancel", "remote-server-not-found",
|
||||
"Not connected to IRC server "s + ex.hostname,
|
||||
true);
|
||||
stanza_error.disable();
|
||||
return;
|
||||
}
|
||||
error_type = "cancel";
|
||||
error_name = "feature-not-implemented";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user