From d40dfe00f26f67febbc04f4cdd990d6e9cd61a90 Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Tue, 1 Jun 2021 09:23:05 -0500 Subject: [PATCH] Disco info with XEP-0157 Allows us to advertise support address, for eventual inclusion in Cheogram adhoc bot help output. --- config.dhall.sample | 3 +++ sgx_jmp.rb | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/config.dhall.sample b/config.dhall.sample index 9e22c41..c050569 100644 --- a/config.dhall.sample +++ b/config.dhall.sample @@ -34,6 +34,9 @@ CAD = "" } }, + xep0157 = { + { var = "support-addresses", value = "xmpp:+14169938000@cheogram.com" } + }, plans = ./plans.dhall electrum = ./electrum.dhall, oxr_app_id = "", diff --git a/sgx_jmp.rb b/sgx_jmp.rb index 6947314..3008d54 100644 --- a/sgx_jmp.rb +++ b/sgx_jmp.rb @@ -174,6 +174,25 @@ IQ_MANAGER = SessionManager.new(self, :id) COMMAND_MANAGER = SessionManager.new(self, :sessionid, timeout: 60 * 60) web_register_manager = WebRegisterManager.new +disco_info to: Blather::JID.new(CONFIG[:component][:jid]) do |iq| + reply = iq.reply + reply.identities = [{ + name: "JMP.chat", + type: "sms", + category: "gateway" + }] + form = Blather::Stanza::X.find_or_create(reply.query) + form.type = "result" + form.fields = [ + { + var: "FORM_TYPE", + type: "hidden", + value: "http://jabber.org/network/serverinfo" + } + ] + CONFIG[:xep0157] + self << reply +end + disco_items node: "http://jabber.org/protocol/commands" do |iq| reply = iq.reply reply.items = [ -- 2.45.2