diff options
author | Florent Le Coz <louiz@louiz.org> | 2015-05-11 04:47:31 +0200 |
---|---|---|
committer | Florent Le Coz <louiz@louiz.org> | 2015-05-11 04:47:31 +0200 |
commit | 5475d16b574e1daf9c1e5f94b5b821bfb1b9c8f8 (patch) | |
tree | ed9cd935d27fa28963f9ea79f57fc18c6ae29a42 /src/xmpp | |
parent | 71fec776c4d7b99b76a44deae6f333d9cffa1496 (diff) | |
download | biboumi-5475d16b574e1daf9c1e5f94b5b821bfb1b9c8f8.tar.gz biboumi-5475d16b574e1daf9c1e5f94b5b821bfb1b9c8f8.tar.bz2 biboumi-5475d16b574e1daf9c1e5f94b5b821bfb1b9c8f8.tar.xz biboumi-5475d16b574e1daf9c1e5f94b5b821bfb1b9c8f8.zip |
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
Diffstat (limited to 'src/xmpp')
-rw-r--r-- | src/xmpp/biboumi_component.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/xmpp/biboumi_component.cpp b/src/xmpp/biboumi_component.cpp index 37383a8..4996438 100644 --- a/src/xmpp/biboumi_component.cpp +++ b/src/xmpp/biboumi_component.cpp @@ -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"; } |