From a9dae0621a3ac227101011d6f7f9d1925ce51496 Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Mon, 7 Mar 2022 22:41:44 -0500 Subject: [PATCH] Add gateway/irc and caps --- src/xmpp/biboumi_component.cpp | 14 +++++++++++++- src/xmpp/xmpp_component.hpp | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/xmpp/biboumi_component.cpp b/src/xmpp/biboumi_component.cpp index 4d432bb..e328423 100644 --- a/src/xmpp/biboumi_component.cpp +++ b/src/xmpp/biboumi_component.cpp @@ -962,11 +962,15 @@ void BiboumiComponent::send_self_disco_info(const std::string& id, const std::st iq["from"] = this->served_hostname; XmlSubNode query(iq, "query"); query["xmlns"] = DISCO_INFO_NS; + XmlSubNode gwid(query, "identity"); + gwid["category"] = "gateway"; + gwid["type"] = "irc"; + gwid["name"] = "Biboumi"; XmlSubNode identity(query, "identity"); identity["category"] = "conference"; identity["type"] = "irc"; identity["name"] = "Biboumi XMPP-IRC gateway"; - for (const char *ns: {DISCO_INFO_NS, MUC_NS, ADHOC_NS, PING_NS, MAM_NS, VERSION_NS, STABLE_MUC_ID_NS}) + for (const char *ns: {DISCO_INFO_NS, CAPS_NS, MUC_NS, ADHOC_NS, PING_NS, MAM_NS, VERSION_NS, STABLE_MUC_ID_NS}) { XmlSubNode feature(query, "feature"); feature["var"] = ns; @@ -1203,6 +1207,14 @@ void BiboumiComponent::send_presence_to_contact(const std::string& from, const s presence["type"] = type; if (!id.empty()) presence["id"] = id; + + if (type.empty() && from == this->served_hostname) { + XmlSubNode c(presence, "c"); + c["xmlns"] = CAPS_NS; + c["hash"] = "sha-1"; + c["node"] = "https://biboumi.louiz.org/"; + c["ver"] = "m8CzZQt9wVuZlrV5a/vZYk/zAN0="; + } this->send_stanza(presence); } diff --git a/src/xmpp/xmpp_component.hpp b/src/xmpp/xmpp_component.hpp index a415183..6bc2892 100644 --- a/src/xmpp/xmpp_component.hpp +++ b/src/xmpp/xmpp_component.hpp @@ -16,6 +16,7 @@ #define STREAM_NS "http://etherx.jabber.org/streams" #define COMPONENT_NS "jabber:component:accept" +#define CAPS_NS "http://jabber.org/protocol/caps" #define MUC_NS "http://jabber.org/protocol/muc" #define MUC_USER_NS MUC_NS"#user" #define MUC_ADMIN_NS MUC_NS"#admin"