From 3e5fa361abc07e328476cf96f6ddb63d1ce15dd7 Mon Sep 17 00:00:00 2001 From: Denver Gingerich Date: Mon, 9 Jan 2017 18:01:36 +0000 Subject: [PATCH] reply() does the hard work I've been doing myself --- sgx-catapult.rb | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/sgx-catapult.rb b/sgx-catapult.rb index 8ddfe111e6d7095ac50d96afa724038a19708fc4..31e09490b94d9bb06c15900b9f076fd5f3c4ee22 100755 --- a/sgx-catapult.rb +++ b/sgx-catapult.rb @@ -52,10 +52,7 @@ module SGXcatapult puts "IQ: #{i.inspect}" - msg = Blather::Stanza::Iq::DiscoItems.new - msg.id = i.id - msg.to = i.from - msg.type = 'result' + msg = i.reply puts "RESPONSE0: #{msg.inspect}" write_to_stream msg @@ -67,11 +64,7 @@ module SGXcatapult puts "IQ: #{i.inspect}" - msg = Blather::Stanza::Iq::DiscoInfo.new - msg.id = i.id - msg.to = i.from - msg.type = 'result' - + msg = i.reply msg.identities = [{:name => 'Soprani.ca Gateway to XMPP - Catapult', :type => 'sms-ctplt', :category => 'gateway'}] @@ -127,20 +120,14 @@ module SGXcatapult end # success (for now) - msg = Blather::Stanza::Iq.new - msg.id = i.id - msg.to = i.from - msg.type = 'result' + msg = i.reply puts "RESPONSE3: #{msg.inspect}" write_to_stream msg puts "SENT" elsif i.type == :get - orig = Blather::Stanza::Iq.new - orig.id = i.id - orig.to = i.from - orig.type = 'result' + orig = i.reply msg = Nokogiri::XML::Node.new 'query',orig.document msg['xmlns'] = 'jabber:iq:register'