diff --git a/src/eu/siacs/conversations/parser/PresenceParser.java b/src/eu/siacs/conversations/parser/PresenceParser.java index d946f3339d5f84ac75bab000e7e844be23c33e07..cf55f61fb4c7cfb8a33c60ae2be8c5ff4eef9931 100644 --- a/src/eu/siacs/conversations/parser/PresenceParser.java +++ b/src/eu/siacs/conversations/parser/PresenceParser.java @@ -73,7 +73,7 @@ public class PresenceParser extends AbstractParser { } updateLastseen(packet, account,true); mXmppConnectionService.onContactStatusChanged - .onContactStatusChanged(contact); + .onContactStatusChanged(contact,true); } } else if (type.equals("unavailable")) { if (fromParts.length != 2) { @@ -82,7 +82,7 @@ public class PresenceParser extends AbstractParser { contact.removePresence(fromParts[1]); } mXmppConnectionService.onContactStatusChanged - .onContactStatusChanged(contact); + .onContactStatusChanged(contact,false); } else if (type.equals("subscribe")) { if (contact.getOption(Contact.Options.PREEMPTIVE_GRANT)) { mXmppConnectionService.sendPresenceUpdatesTo(contact); diff --git a/src/eu/siacs/conversations/services/XmppConnectionService.java b/src/eu/siacs/conversations/services/XmppConnectionService.java index 16814baa3039d43aa84a7b66d0c6ed7d39b5482e..20268574ddb1bb0d8d41102e3e7c488d94e78ea7 100644 --- a/src/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/eu/siacs/conversations/services/XmppConnectionService.java @@ -98,10 +98,13 @@ public class XmppConnectionService extends Service { public OnContactStatusChanged onContactStatusChanged = new OnContactStatusChanged() { @Override - public void onContactStatusChanged(Contact contact) { + public void onContactStatusChanged(Contact contact, boolean online) { Conversation conversation = findActiveConversation(contact); if (conversation != null) { conversation.endOtrIfNeeded(); + if (online&&(contact.getPresences().size() == 1)) { + sendUnsendMessages(conversation); + } } } }; diff --git a/src/eu/siacs/conversations/xmpp/OnContactStatusChanged.java b/src/eu/siacs/conversations/xmpp/OnContactStatusChanged.java index 8597a753a77a11ead337980b96b3ca4c3f498239..849e8e7646d2ed8dc8be358e5928c4e61cff6519 100644 --- a/src/eu/siacs/conversations/xmpp/OnContactStatusChanged.java +++ b/src/eu/siacs/conversations/xmpp/OnContactStatusChanged.java @@ -3,5 +3,5 @@ package eu.siacs.conversations.xmpp; import eu.siacs.conversations.entities.Contact; public interface OnContactStatusChanged { - public void onContactStatusChanged(Contact contact); + public void onContactStatusChanged(Contact contact, boolean online); }