From 25064310b8dda5683e7aa36ea66e4edffc1ec7b4 Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Wed, 23 Jun 2021 09:29:24 -0500 Subject: [PATCH] Pass through commands we know the SGX can handle --- sgx_jmp.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/sgx_jmp.rb b/sgx_jmp.rb index 20bee94..5c70c2b 100644 --- a/sgx_jmp.rb +++ b/sgx_jmp.rb @@ -243,6 +243,8 @@ end disco_items node: "http://jabber.org/protocol/commands" do |iq| reply = iq.reply reply.items = [ + { node: "number-display", name: "Display JMP Number" }, + { node: "configure-calls", name: "Configure Calls" }, # TODO: don't show this item if no braintree methods available # TODO: don't show this item if no plan for this customer { node: "buy-credit", name: "Buy account credit" }, @@ -293,6 +295,19 @@ def reply_with_note(iq, text, type: :info) self << reply end +# Commands that just pass through to the SGX +command node: ["number-display", "configure-calls"] do |iq| + sentry_hub = new_sentry_hub(iq, name: iq.node) + Customer.for_jid(iq.from.stripped).then { |customer| + sentry_hub.current_scope.set_user( + id: customer.customer_id, + jid: iq.from.stripped.to_s + ) + + customer.stanza_from(iq) + }.catch { |e| panic(e, sentry_hub) } +end + command :execute?, node: "buy-credit", sessionid: nil do |iq| sentry_hub = new_sentry_hub(iq, name: iq.node) reply = iq.reply -- 2.38.5