diff options
author | Florent Le Coz <louiz@louiz.org> | 2014-05-06 22:50:37 +0200 |
---|---|---|
committer | Florent Le Coz <louiz@louiz.org> | 2014-05-06 22:50:37 +0200 |
commit | 5ec05cb0edda6b01ff5c21a42edf9142b90399e5 (patch) | |
tree | d18e94ef0f8184a18e776defea1895343c597b83 /src/xmpp | |
parent | f35db5cebaf1b9e267a7f2341699bb50fbc54c65 (diff) | |
download | biboumi-5ec05cb0edda6b01ff5c21a42edf9142b90399e5.tar.gz biboumi-5ec05cb0edda6b01ff5c21a42edf9142b90399e5.tar.bz2 biboumi-5ec05cb0edda6b01ff5c21a42edf9142b90399e5.tar.xz biboumi-5ec05cb0edda6b01ff5c21a42edf9142b90399e5.zip |
Forward CTCP version request to XMPP
Diffstat (limited to 'src/xmpp')
-rw-r--r-- | src/xmpp/xmpp_component.cpp | 19 | ||||
-rw-r--r-- | src/xmpp/xmpp_component.hpp | 5 |
2 files changed, 24 insertions, 0 deletions
diff --git a/src/xmpp/xmpp_component.cpp b/src/xmpp/xmpp_component.cpp index 9f62514..7e00346 100644 --- a/src/xmpp/xmpp_component.cpp +++ b/src/xmpp/xmpp_component.cpp @@ -28,6 +28,9 @@ #define XHTMLIM_NS "http://jabber.org/protocol/xhtml-im" #define STANZA_NS "urn:ietf:params:xml:ns:xmpp-stanzas" #define STREAMS_NS "urn:ietf:params:xml:ns:xmpp-streams" +#define VERSION_NS "jabber:iq:version" + +using namespace std::string_literals; unsigned long XmppComponent::current_id = 0; @@ -786,6 +789,22 @@ void XmppComponent::send_self_disco_info(const std::string& id, const std::strin this->send_stanza(iq); } +void XmppComponent::send_iq_version_request(const std::string& from, + const std::string& jid_to) +{ + Stanza iq("iq"); + iq["type"] = "get"; + iq["id"] = "version_"s + XmppComponent::next_id(); + iq["from"] = from + "@" + this->served_hostname; + iq["to"] = jid_to; + XmlNode query("query"); + query["xmlns"] = VERSION_NS; + query.close(); + iq.add_child(std::move(query)); + iq.close(); + this->send_stanza(iq); +} + std::string XmppComponent::next_id() { return std::to_string(XmppComponent::current_id++); diff --git a/src/xmpp/xmpp_component.hpp b/src/xmpp/xmpp_component.hpp index f54ebd7..fdf068b 100644 --- a/src/xmpp/xmpp_component.hpp +++ b/src/xmpp/xmpp_component.hpp @@ -155,6 +155,11 @@ public: */ void send_self_disco_info(const std::string& id, const std::string& jid_to); /** + * Send an iq version request + */ + void send_iq_version_request(const std::string& from, + const std::string& jid_to); + /** * Handle the various stanza types */ void handle_handshake(const Stanza& stanza); |