powered by Jive Software

IQ handler question

Hey guys,

I’‘ve installed an IQ handler as a plugin in Wildfire but can’‘t get it to respond to the IQ packets I’'m sending to it. I can tell from the Wildfire logs the handler is installed and initialized. I have some tracing in the handler that shows the handler is constructed, but handleIQ never gets called.

The handler constructer is registered for query packets of the form:

info = new IQHandlerInfo(“query”, “jabber:iq:geo”);[/code]

I’'m sending the IQ packet using Smack as follows, using code copied out of the Smack examples:

// Request the geo information from a remote user.

XMPPConnection con = new XMPPConnection(“XMPPServer”);

GEOIQ geoRequest = new GEOIQ();

geoRequest.setType(IQ.Type.GET);

// Create a packet collector to listen for a response.

PacketCollector collector = con.createPacketCollector(

new PacketIDFilter(geoRequest.getPacketID()));

con.sendPacket(geoRequest);

// Wait up to 5 seconds for a result.

String IP = null;

GEOIQ geoResult = null;

IQ result = (IQ)collector.nextResult(5000);

if (result != null && result.getType() == IQ.Type.RESULT) {

geoResult = (GEOIQ)result;

// Do something with result…

IP = geoResult.getIp();

}[/code]

The query packet created by GEOIQ has the namespace I’‘ve registered GEOIQHandler to handle, jabber:iq:geo. I think I’'m missing something obvious, has anyone else installed an IQ handler as a plugin?

Also, is there any way to trace packets as they’'re sent back and forth from Wildfire?

Thanks!

Jay

Hey Jay,

I see 2 things missing in the code snippet. 1) Login is missing. I see that you are creating a connection but there is no login and 2) the TO of the IQ packet is not being set.

You may also want to enable the debug log in Smack and post the generated XML so we can see the traffic activity.

Regards,

– Gato

Hey Gato,

Thanks for the response, I’'ll give it a shot and let you know!

Jay

Hey Gato,

Shoot, I forgot to mark this as answered, it’'s all working now, thanks!

Jay