How would one respond to an IQ using Smack? Smack has good support for sending IQ requests, but no obvious support for responding to them. The Wildfire API seems to have support for this (IQHandler, IQ#createResultIQ(IQ), etc.). One might argue that typically the server responds to IQs; however, I do not believe the XMPP spec restricts clients from responding to them as well.
This add your IQProvider that will listen for incoming packets:
YOURPacket.NAMESPACE, new YOURPacket.Provider());
*To see how to implements a IQProvider take a look at SparkVersion.java at Spark source code in SVN.
( You could do this using your browser too ).*
You can also just install a generic packet listener with a filter for IQ packets.
Yes, I see how IQProvider implementations are used to parse IQ messages to create IQ beans. Are you suggesting that they are also used to respond to IQ messages? Should I implement my response code in IQProvider#parseIQ? That seems odd.
Yes, I considered that. I was just hoping that there was a nicer way to handle IQ messages, like there is in the Wildfire API.