diff options
author | iNPUTmice <daniel@gultsch.de> | 2014-06-12 18:27:50 +0200 |
---|---|---|
committer | iNPUTmice <daniel@gultsch.de> | 2014-06-12 18:27:50 +0200 |
commit | b1482212b879123344ef8dcdc622ce095a4dc765 (patch) | |
tree | 7b3e6d9f2074bd16cdef1655ad84e02aa2c51cf9 /src | |
parent | 18871230e1c0ef76431b97037e6073856279f93e (diff) |
fire onContactStatusChanged only on online/offline changes. not on status changes
Diffstat (limited to 'src')
3 files changed, 4 insertions, 13 deletions
diff --git a/src/eu/siacs/conversations/parser/MessageParser.java b/src/eu/siacs/conversations/parser/MessageParser.java index 63e789a37..fdd7db642 100644 --- a/src/eu/siacs/conversations/parser/MessageParser.java +++ b/src/eu/siacs/conversations/parser/MessageParser.java @@ -1,10 +1,7 @@ package eu.siacs.conversations.parser; -import java.util.List; - import net.java.otr4j.session.Session; import net.java.otr4j.session.SessionStatus; -import android.util.Log; import eu.siacs.conversations.entities.Account; import eu.siacs.conversations.entities.Conversation; import eu.siacs.conversations.entities.Message; @@ -45,16 +42,10 @@ public class MessageParser extends AbstractParser { String body = packet.getBody(); if (!conversation.hasValidOtrSession()) { if (properlyAddressed) { - Log.d("xmppService", - "starting new otr session with " - + packet.getFrom() - + " because no valid otr session has been found"); conversation.startOtrSession( mXmppConnectionService.getApplicationContext(), fromParts[1], false); } else { - Log.d("xmppService", account.getJid() - + ": ignoring otr session with " + fromParts[0]); return null; } } else { @@ -63,8 +54,6 @@ public class MessageParser extends AbstractParser { if (!foreignPresence.equals(fromParts[1])) { conversation.resetOtrSession(); if (properlyAddressed) { - Log.d("xmppService", - "replacing otr session with " + packet.getFrom()); conversation.startOtrSession( mXmppConnectionService.getApplicationContext(), fromParts[1], false); diff --git a/src/eu/siacs/conversations/parser/PresenceParser.java b/src/eu/siacs/conversations/parser/PresenceParser.java index cf55f61fb..2003d4cd6 100644 --- a/src/eu/siacs/conversations/parser/PresenceParser.java +++ b/src/eu/siacs/conversations/parser/PresenceParser.java @@ -1,6 +1,5 @@ package eu.siacs.conversations.parser; -import android.util.Log; import eu.siacs.conversations.crypto.PgpEngine; import eu.siacs.conversations.entities.Account; import eu.siacs.conversations.entities.Contact; @@ -54,6 +53,7 @@ public class PresenceParser extends AbstractParser { Contact contact = account.getRoster().getContact(packet.getFrom()); if (type == null) { if (fromParts.length == 2) { + int sizeBefore = contact.getPresences().size(); contact.updatePresence(fromParts[1], Presences.parseShow(packet.findChild("show"))); PgpEngine pgp = mXmppConnectionService.getPgpEngine(); @@ -71,9 +71,10 @@ public class PresenceParser extends AbstractParser { x.getContent())); } } + boolean online = sizeBefore < contact.getPresences().size(); updateLastseen(packet, account,true); mXmppConnectionService.onContactStatusChanged - .onContactStatusChanged(contact,true); + .onContactStatusChanged(contact,online); } } else if (type.equals("unavailable")) { if (fromParts.length != 2) { diff --git a/src/eu/siacs/conversations/services/XmppConnectionService.java b/src/eu/siacs/conversations/services/XmppConnectionService.java index 20268574d..44964c7c2 100644 --- a/src/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/eu/siacs/conversations/services/XmppConnectionService.java @@ -1194,6 +1194,7 @@ public class XmppConnectionService extends Service { Account account = conversation.getAccount(); List<Message> messages = conversation.getMessages(); Session otrSession = conversation.getOtrSession(); + Log.d(LOGTAG,account.getJid()+" otr session established with "+conversation.getContactJid()+"/"+otrSession.getSessionID().getUserID()); for (int i = 0; i < messages.size(); ++i) { Message msg = messages.get(i); if ((msg.getStatus() == Message.STATUS_UNSEND) |