~singpolyma/sgx-jmp

ref: f571b5e726750cf8c4523c22d77e110194c3e16a sgx-jmp/lib/ibr_repo.rb -rw-r--r-- 451 bytes
f571b5e7Stephen Paul Weber Postgres#query_one 7 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# frozen_string_literal: true

require "lazy_object"
require "value_semantics/monkey_patched"

require_relative "ibr"

class IBRRepo
	value_semantics do
		iq_manager Anything(), default: LazyObject.new { IQ_MANAGER }
	end

	def registered?(jid, from:)
		ibr = IBR.new(:get, jid)
		ibr.from = from

		iq_manager.write(ibr).then do |result|
			if result.respond_to?(:registered?) && result.registered?
				result
			else
				false
			end
		end
	end
end