Disco info with XEP-0157

Stephen Paul Weber created

Allows us to advertise support address, for eventual inclusion in Cheogram adhoc
bot help output.

Change summary

config.dhall.sample |  3 +++
sgx_jmp.rb          | 19 +++++++++++++++++++
2 files changed, 22 insertions(+)

Detailed changes

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 = "",

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 = [