From 8fcc48af8b3f382a63883bf7452f6828557c1e33 Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Tue, 21 May 2024 14:57:37 -0500 Subject: [PATCH] We rely on this key in sgx-jmp, so set it from here Instead of assuming the backend will do it --- lib/backend_sgx.rb | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/lib/backend_sgx.rb b/lib/backend_sgx.rb index e2540fee283e7dc9d34e764bfe58f7a4769f075e..5badd5fa02e51496f677cc79b8d75405692b66a3 100644 --- a/lib/backend_sgx.rb +++ b/lib/backend_sgx.rb @@ -18,13 +18,11 @@ class BackendSgx end def register!(tel) - ibr = Blather::Stanza::Iq::IBR.new(:set, @jid) - ibr.from = from_jid - ibr.nick = creds[:account] - ibr.username = creds[:username] - ibr.password = creds[:password] - ibr.phone = tel - IQ_MANAGER.write(ibr) + iq = ibr + iq.phone = tel + IQ_MANAGER.write(iq).then do + REDIS.set("catapult_jid-#{tel}", from_jid.to_s) + end end def deregister! @@ -47,4 +45,15 @@ class BackendSgx def set_ogm_url(url) REDIS.set("catapult_ogm_url-#{from_jid}", url) end + +protected + + def ibr + s = Blather::Stanza::Iq::IBR.new(:set, jid) + s.from = from_jid + s.nick = creds[:account] + s.username = creds[:username] + s.password = creds[:password] + s + end end