~singpolyma/sgx-endstream

831894e9ce3d4a22047b36b9ea7c88cef4e9b699 — Stephen Paul Weber a month ago dc3e40b
Use unroute instead of route to bogus jid
1 files changed, 12 insertions(+), 1 deletions(-)

M lib/registration_repo.rb
M lib/registration_repo.rb => lib/registration_repo.rb +12 -1
@@ 31,7 31,7 @@ class RegistrationRepo
			next { code: 0 } unless creds

			EMPromise.all([
				setup_endstream_route(*creds, "#{creds.first}@example.com"),
				remove_endstream_route(*creds),
				@redis.del("endstream_registration-#{jid.stripped}")
			]).then { |(status, _)| status }
		end


@@ 51,4 51,15 @@ protected
			).body.dig(:did_route_sms_to_xmpp_response, :did_route_sms_to_xmpp_result)
		}
	end

	def remove_endstream_route(tel, username, password)
		EM.promise_defer {
			@savon.call(
				:did_unroute_sms, message: {
					auth: { username: username, password: password },
					dID: tel.sub(/\A\+/, "")
				}
			).body.dig(:did_unroute_sms_response, :did_unroute_sms_result)
		}
	end
end