aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/siacs
diff options
context:
space:
mode:
authoriNPUTmice <daniel@gultsch.de>2014-06-12 10:41:47 +0200
committeriNPUTmice <daniel@gultsch.de>2014-06-12 10:41:47 +0200
commit18871230e1c0ef76431b97037e6073856279f93e (patch)
tree35cff8432c581df13ad89b33beb2f7b4ffd88df5 /src/eu/siacs
parente353a1c109f68f212c9fbf76c5186be97c835628 (diff)
send otr messages when contacts comes online
Diffstat (limited to 'src/eu/siacs')
-rw-r--r--src/eu/siacs/conversations/parser/PresenceParser.java4
-rw-r--r--src/eu/siacs/conversations/services/XmppConnectionService.java5
-rw-r--r--src/eu/siacs/conversations/xmpp/OnContactStatusChanged.java2
3 files changed, 7 insertions, 4 deletions
diff --git a/src/eu/siacs/conversations/parser/PresenceParser.java b/src/eu/siacs/conversations/parser/PresenceParser.java
index d946f3339..cf55f61fb 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 16814baa3..20268574d 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 8597a753a..849e8e764 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);
}