문제

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 ?

도움이 되었습니까?

해결책

This can be controlled with XEP-0016: Privacy Lists

I don't know whether smack supports this though.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top