From ad5bd99618fd4f1ee92d48d90912d627187aaa11 Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Mon, 11 May 2015 05:03:09 +0200 Subject: Properly send error response on presence stanzas --- src/xmpp/biboumi_component.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/xmpp') diff --git a/src/xmpp/biboumi_component.cpp b/src/xmpp/biboumi_component.cpp index 4996438..5d571ec 100644 --- a/src/xmpp/biboumi_component.cpp +++ b/src/xmpp/biboumi_component.cpp @@ -116,6 +116,7 @@ void BiboumiComponent::handle_presence(const Stanza& stanza) error_type, error_name, ""); }); + try { if (iid.is_channel && !iid.get_server().empty()) { // presence toward a MUC that corresponds to an irc channel, or a // dummy channel if iid.chan is empty @@ -141,6 +142,14 @@ void BiboumiComponent::handle_presence(const Stanza& stanza) if (type.empty()) this->send_invalid_room_error(to.local, to.resource, from); } + } + catch (const IRCNotConnected& ex) + { + this->send_stanza_error("presence", from, to_str, id, + "cancel", "remote-server-not-found", + "Not connected to IRC server "s + ex.hostname, + true); + } stanza_error.disable(); } -- cgit v1.2.3