fix disco code so non-:get disco <iq>s are ignored

Denver Gingerich created

A copy of https://gitlab.com/ossguy/sgx-catapult/commit/a887c61 :

This is not 100% correct, but it's close enough for our purposes and
we left a TODO in case someone wants to fix it properly in the future.
This fix will at least prevent feedback loops of the type we had
previously with components like Cheogram.

Change summary

sgx-bwmsgsv2.rb | 9 +++++++++
1 file changed, 9 insertions(+)

Detailed changes

sgx-bwmsgsv2.rb 🔗

@@ -529,6 +529,15 @@ module SGXbwmsgsv2
 	end
 
 	iq '/iq/ns:query', ns:	'http://jabber.org/protocol/disco#info' do |i|
+		# TODO: return error if i.type is :set - if it is :reply or
+		#  :error it should be ignored (as the below does currently);
+		#  review specification to see how to handle other type values
+		if i.type != :get
+			puts 'DISCO iq rcvd, of non-get type "' + i.type.to_s +
+				'" for message "' + i.inspect + '"; ignoring...'
+			next
+		end
+
 		# respond to capabilities request for an sgx-bwmsgsv2 number JID
 		if i.to.node
 			# TODO: confirm the node URL is expected using below