~singpolyma/sgx-jmp

d40dfe00f26f67febbc04f4cdd990d6e9cd61a90 — Stephen Paul Weber 1 year, 2 months ago c85df3f
Disco info with XEP-0157

Allows us to advertise support address, for eventual inclusion in Cheogram adhoc
bot help output.
2 files changed, 22 insertions(+), 0 deletions(-)

M config.dhall.sample
M sgx_jmp.rb
M config.dhall.sample => config.dhall.sample +3 -0
@@ 34,6 34,9 @@
			CAD = ""
		}
	},
	xep0157 = {
		{ var = "support-addresses", value = "xmpp:+14169938000@cheogram.com" }
	},
	plans = ./plans.dhall
	electrum = ./electrum.dhall,
	oxr_app_id = "",

M sgx_jmp.rb => sgx_jmp.rb +19 -0
@@ 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 = [