diff options
author | louiz’ <louiz@louiz.org> | 2017-03-29 23:24:47 +0200 |
---|---|---|
committer | louiz’ <louiz@louiz.org> | 2017-03-29 16:28:25 +0200 |
commit | ce2daa5ea093437bf8f14ba92a467d0ae688e6ca (patch) | |
tree | cd8bb2a53c3099d37a5b68909481df4b11019fdd /src/xmpp | |
parent | e8ccfe97be6f7042b0960f40ce29a89801b9982e (diff) | |
download | biboumi-ce2daa5ea093437bf8f14ba92a467d0ae688e6ca.tar.gz biboumi-ce2daa5ea093437bf8f14ba92a467d0ae688e6ca.tar.bz2 biboumi-ce2daa5ea093437bf8f14ba92a467d0ae688e6ca.tar.xz biboumi-ce2daa5ea093437bf8f14ba92a467d0ae688e6ca.zip |
Respond to disco#info on MUC JIDs
Otherwise, some client won’t do MAM, since they don’t know biboumi supports
it.
Diffstat (limited to 'src/xmpp')
-rw-r--r-- | src/xmpp/biboumi_component.cpp | 34 | ||||
-rw-r--r-- | src/xmpp/biboumi_component.hpp | 1 |
2 files changed, 34 insertions, 1 deletions
diff --git a/src/xmpp/biboumi_component.cpp b/src/xmpp/biboumi_component.cpp index 41eb4b8..ab8e5e0 100644 --- a/src/xmpp/biboumi_component.cpp +++ b/src/xmpp/biboumi_component.cpp @@ -422,7 +422,13 @@ void BiboumiComponent::handle_iq(const Stanza& stanza) } else if (iid.type == Iid::Type::Channel) { - if (node == MUC_TRAFFIC_NS) + log_debug("type_channel"); + if (node.empty()) + { + this->send_irc_channel_disco_info(id, from, to_str); + stanza_error.disable(); + } + else if (node == MUC_TRAFFIC_NS) { this->send_irc_channel_muc_traffic_info(id, from, to_str); stanza_error.disable(); @@ -755,6 +761,32 @@ void BiboumiComponent::send_irc_channel_muc_traffic_info(const std::string& id, this->send_stanza(iq); } +void BiboumiComponent::send_irc_channel_disco_info(const std::string& id, const std::string& jid_to, const std::string& jid_from) +{ + log_debug("jid_from: ", jid_from); + Jid from(jid_from); + Iid iid(from.local, {}); + Stanza iq("iq"); + { + iq["type"] = "result"; + iq["id"] = id; + iq["to"] = jid_to; + iq["from"] = jid_from; + XmlSubNode query(iq, "query"); + query["xmlns"] = DISCO_INFO_NS; + XmlSubNode identity(query, "identity"); + identity["category"] = "conference"; + identity["type"] = "irc"; + identity["name"] = "IRC channel "s + iid.get_local() + " from server " + iid.get_server() + " over biboumi"; + for (const char *ns: {DISCO_INFO_NS, MUC_NS, ADHOC_NS, PING_NS, MAM_NS, VERSION_NS}) + { + XmlSubNode feature(query, "feature"); + feature["var"] = ns; + } + } + this->send_stanza(iq); +} + void BiboumiComponent::send_ping_request(const std::string& from, const std::string& jid_to, const std::string& id) diff --git a/src/xmpp/biboumi_component.hpp b/src/xmpp/biboumi_component.hpp index 25ec2dd..f416dac 100644 --- a/src/xmpp/biboumi_component.hpp +++ b/src/xmpp/biboumi_component.hpp @@ -70,6 +70,7 @@ public: * http://xmpp.org/extensions/xep-0045.html#impl-service-traffic */ void send_irc_channel_muc_traffic_info(const std::string& id, const std::string& jid_to, const std::string& jid_from); + void send_irc_channel_disco_info(const std::string& id, const std::string& jid_to, const std::string& jid_from); /** * Send a ping request */ |