0

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 ?

4

1 回答 1

1

这可以通过XEP-0016 控制:隐私列表

我不知道 smack 是否支持这一点。

于 2013-09-09T13:12:57.880 回答