~singpolyma/sgx-jmp

sgx-jmp/lib/blather_ext.rb -rw-r--r-- 386 bytes
1ef966f3Amolith Eliminate a registration race condition 17 days ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# frozen_string_literal: true

require "securerandom"

module Blather
	class JID
		def with(node: self.node, domain: self.domain, resource: self.resource)
			self.class.new(node, domain, resource)
		end
	end

	module DSL
		def say(to, msg, using=:chat)
			client.write(Blather::Stanza::Message.new(to, msg, using).tap { |message|
				message.id = SecureRandom.uuid
			})
		end
	end
end