Remove "otherJid" when receiving unavailable presence.
This commit is contained in:
parent
ebe4208502
commit
27f506c253
|
|
@ -172,10 +172,11 @@ public class ServiceXmpp extends Observable implements PresenceEventListener {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void presenceAvailable(FullJid address, Presence availablePresence) {
|
||||
public void presenceAvailable(FullJid address, Presence presence) {
|
||||
String fullJid = address.asFullJidIfPossible().toString();
|
||||
if (presence.getType() == Presence.Type.available) {
|
||||
if (!fullJid.equals(jid) && (otherJid == null || !fullJid.equals(otherJid))) {
|
||||
Log.i(TAG, "PRESENCE AVAILABLE RECEIVED FROM "+fullJid);
|
||||
Log.i(TAG, "PRESENCE AVAILABLE RECEIVED FROM " + fullJid);
|
||||
otherJid = fullJid;
|
||||
try {
|
||||
sendPresenceAvailable(fullJid);
|
||||
|
|
@ -189,6 +190,11 @@ public class ServiceXmpp extends Observable implements PresenceEventListener {
|
|||
setChanged();
|
||||
notifyObservers(new Notification(NOTIF_NEW_PRESENCE_RECEIVED).addExtra(NOTIF_NEW_PRESENCE_RECEIVED_VALUE_JID, otherJid));
|
||||
}
|
||||
} else if (presence.getType() == Presence.Type.unavailable) {
|
||||
if (otherJid != null && otherJid.equals(fullJid)) {
|
||||
otherJid = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Reference in New Issue