Pregunta

I am working on a chat application and implemented a rosterlistener to get changed presence. But I am getting from all of my rosters presence update.

This is how far I got..

How I change presence:

public void setStatus(boolean available, String status) {

    Presence.Type type = available ? Type.available : Type.unavailable;
    Presence presence = new Presence(type);

    presence.setStatus(status);
    connection.sendPacket(presence);

}

How I listen for changing presence:

roster.addRosterListener(new RosterListener() {

    public void entriesAdded(Collection<String> param) {
    }

    public void entriesDeleted(Collection<String> addresses) {
    }

    public void entriesUpdated(Collection<String> addresses) {
    }

    public void presenceChanged(Presence presence) {

        /* Do something when presence changed */

    });

Is there a way to send presence change like status only for selected rosters ?

¿Fue útil?

Solución

This can be controlled with XEP-0016: Privacy Lists

I don't know whether smack supports this though.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top