summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorlouiz’ <louiz@louiz.org>2017-04-04 18:40:30 +0200
committerlouiz’ <louiz@louiz.org>2017-04-04 18:40:30 +0200
commite4cc69607c91db43cf154326aaba8afbe97a4c81 (patch)
treea2a7b286201f7ddae81e2751d4e4ade7b82e60d8 /src
parent62225e8fe92eab78a2703de64019a6cdde4e2851 (diff)
downloadbiboumi-e4cc69607c91db43cf154326aaba8afbe97a4c81.tar.gz
biboumi-e4cc69607c91db43cf154326aaba8afbe97a4c81.tar.bz2
biboumi-e4cc69607c91db43cf154326aaba8afbe97a4c81.tar.xz
biboumi-e4cc69607c91db43cf154326aaba8afbe97a4c81.zip
Handle some iq of type='error' as valid ping response
fix #3251
Diffstat (limited to 'src')
-rw-r--r--src/xmpp/biboumi_component.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/xmpp/biboumi_component.cpp b/src/xmpp/biboumi_component.cpp
index df96d62..dc57eeb 100644
--- a/src/xmpp/biboumi_component.cpp
+++ b/src/xmpp/biboumi_component.cpp
@@ -564,6 +564,12 @@ void BiboumiComponent::handle_iq(const Stanza& stanza)
else if (type == "error")
{
stanza_error.disable();
+ const auto it = this->waiting_iq.find(id);
+ if (it != this->waiting_iq.end())
+ {
+ it->second(bridge, stanza);
+ this->waiting_iq.erase(it);
+ }
}
}
catch (const IRCNotConnected& ex)
@@ -807,8 +813,14 @@ void BiboumiComponent::send_ping_request(const std::string& from,
{
log_error("Received a corresponding ping result, but the 'to' from "
"the response mismatches the 'from' of the request");
+ return;
}
- else
+ const std::string type = stanza.get_tag("type");
+ const XmlNode* error = stanza.get_child("error", COMPONENT_NS);
+ // Check if what we receive is considered a valid response. And yes, those errors are valid responses
+ if (type == "result" ||
+ (type == "error" && error && (error->get_child("feature-not-implemented", STANZA_NS) ||
+ error->get_child("service-unavailable", STANZA_NS))))
bridge->send_irc_ping_result({from, bridge}, id);
};
this->waiting_iq[id] = result_cb;