1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-12-25 22:07:56 +01:00

Fix roster handling of outgoing 'unavailable' presence

make sure that the 'to' attribute is not set, as otherwhise the
listener would also be invoked e.g. when the user leaves a MUC.
This commit is contained in:
Florian Schmaus 2017-01-29 11:08:45 +01:00
parent 5d0dd49e61
commit 85fcb55bd9

View file

@ -46,9 +46,11 @@ import org.jivesoftware.smack.SmackException.NotConnectedException;
import org.jivesoftware.smack.SmackException.NotLoggedInException;
import org.jivesoftware.smack.XMPPConnectionRegistry;
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
import org.jivesoftware.smack.filter.AndFilter;
import org.jivesoftware.smack.filter.PresenceTypeFilter;
import org.jivesoftware.smack.filter.StanzaFilter;
import org.jivesoftware.smack.filter.StanzaTypeFilter;
import org.jivesoftware.smack.filter.ToMatchesFilter;
import org.jivesoftware.smack.iqrequest.AbstractIqRequestHandler;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.IQ.Type;
@ -124,6 +126,8 @@ public final class Roster extends Manager {
private static final StanzaFilter PRESENCE_PACKET_FILTER = StanzaTypeFilter.PRESENCE;
private static final StanzaFilter OUTGOING_USER_UNAVAILABLE_PRESENCE = new AndFilter(PresenceTypeFilter.UNAVAILABLE, ToMatchesFilter.MATCH_NO_TO_SET);
private static boolean rosterLoadedAtLoginDefault = true;
/**
@ -326,7 +330,7 @@ public final class Roster extends Manager {
// state).
setOfflinePresences();
}
}, PresenceTypeFilter.UNAVAILABLE);
}, OUTGOING_USER_UNAVAILABLE_PRESENCE);
// If the connection is already established, call reload
if (connection.isAuthenticated()) {