Unsubscribed presence packets not handled

Hey,

The roster doesn’‘t seem to handle presence unsubscription, therefore leaving the users in the last availability status they were, even though one doesn’'t get any more notifications from them.

The attached patch fixes this issue as far as I could test.

To reproduce:

Add some user to your roster, subscribe to his entry.

Unsubscribe from his presence (you can use the following code):

Presence presencePacket = new Presence(Presence.Type.UNSUBSCRIBE);

presencePacket.setTo(whom);

xmpp.sendPacket(presencePacket);

You’‘ll see that you still see this user as “available” (if he was available, that is), even though the actual presence status would be “not subscribed” (as you don’'t see his updates).

If you re-log-in without my patch, you’‘ll also see his presence as “not subscribed” (actually you will get a null presence, but you can get a more detailed idea by inspecting his entry’'s subscription type).
roster-unsubscribed.diff (1280 Bytes)