Forward CTCP version request to XMPP

This commit is contained in:
Florent Le Coz
2014-05-06 22:50:37 +02:00
parent f35db5ceba
commit 5ec05cb0ed
5 changed files with 35 additions and 0 deletions
+19
View File
@@ -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++);
+5
View File
@@ -154,6 +154,11 @@ public:
* Send a result IQ with the gateway disco informations.
*/
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
*/