diff options
author | Daniel Gultsch <daniel.gultsch@rwth-aachen.de> | 2014-04-16 19:14:20 +0200 |
---|---|---|
committer | Andreas Straub <andy@strb.org> | 2014-04-18 00:17:34 +0200 |
commit | a04d736f75c793dc943c1e0ce7c89e1c20a3a684 (patch) | |
tree | c1013c173338bcc6913989a3781ed275b8b350e7 /src/eu/siacs/conversations/services/XmppConnectionService.java | |
parent | 4a36abf30fb2d59934d5bfd121542fa82f5c98ce (diff) |
fixed possible race conditions with presences
Diffstat (limited to '')
-rw-r--r-- | src/eu/siacs/conversations/services/XmppConnectionService.java | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/eu/siacs/conversations/services/XmppConnectionService.java b/src/eu/siacs/conversations/services/XmppConnectionService.java index a1054c403..e9f93a63c 100644 --- a/src/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/eu/siacs/conversations/services/XmppConnectionService.java @@ -1,6 +1,5 @@ package eu.siacs.conversations.services; -import java.io.File; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Collections; @@ -288,8 +287,7 @@ public class XmppConnectionService extends Service { } else { Contact contact = findContact(account, fromParts[0]); if (contact == null) { - //Log.d(LOGTAG,"contact was null"); - // most likely roster not synced + Log.d(LOGTAG,packet.getFrom()+ " could not be found"); return; } if (type == null) { @@ -314,17 +312,19 @@ public class XmppConnectionService extends Service { } } } + replaceContactInConversation(contact.getJid(), contact); databaseBackend.updateContact(contact); } else { - // Log.d(LOGTAG,"presence without resource "+packet.toString()); + //Log.d(LOGTAG,"presence without resource "+packet.toString()); } } else if (type.equals("unavailable")) { if (fromParts.length != 2) { - // Log.d(LOGTAG,"received presence with no resource "+packet.toString()); + contact.clearPresences(); } else { contact.removePresence(fromParts[1]); - databaseBackend.updateContact(contact); } + replaceContactInConversation(contact.getJid(), contact); + databaseBackend.updateContact(contact); } else if (type.equals("subscribe")) { Log.d(LOGTAG,"received subscribe packet from "+packet.getFrom()); if (contact @@ -348,7 +348,6 @@ public class XmppConnectionService extends Service { } else { //Log.d(LOGTAG, packet.toString()); } - replaceContactInConversation(contact.getJid(), contact); } } } |