Change summary
lib/backend_sgx.rb | 23 ++++++++++++++++-------
1 file changed, 16 insertions(+), 7 deletions(-)
Detailed changes
@@ -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