I’‘m trying to get a better understanding of the difference between these two interfaces and when it is better to use which. My scenario is that I have a wildfire plugin that attaches some information to each user’‘s Presence on the server. What I want to do is have a spark client plugin that is able to handle the modified Presence object being sent to the spark clients and have my code update each of the contacts’’ presence info displayed in the client.
Based on the API docs, both these interfaces seem to capture when a user’'s presence changes. My question is “which should I use to be able to examine the custom presence object sent from the server?”
I did some more searching of the APIs and found the correct way to get this done. I actually did not need the PresenceListener or the ContactItemHandler. Turns out the correct approach was having my plugin implement the PacketListener interface from the smack library. This interface allows you to intercept packets sent from the server to the client. In particular, the PacketExtensionFilter came in handy because on the server the custom Presence object I send to clients is actuall a PacketExtension.
The PresenceListener and ContactItemHandler interfaces seem to be geared more toward presence changes originating from the IM client and being sent to the server.