powered by Jive Software

Changing entry type

Is it possible to change the type of an entry using the API?

I want to unsubscribe myself from a user’‘s presence updates, but I don’'t want to block him in the process. That is, if the entry type is TO, I want it to become REMOVE or NONE; but if it is BOTH, I want it to become FROM.

Javier,

If you only want to unsubscribe from the contact’'s presence information but keep the entry in your roster, you should send a presence stanza of type “unsubscribe” to the contact. The following example shows you how to send that kind of presences.

// Create a presence of type "unsubscribe" and send it to the contact.
    Presence presencePacket = new Presence(Presence.Type.UNSUBSCRIBE);
    presencePacket.setTo(user);
    connection.sendPacket(presencePacket);

Regards,

– Gato

Gracias, Gato.