diff options
author | iNPUTmice <daniel@gultsch.de> | 2014-06-13 18:16:14 +0200 |
---|---|---|
committer | iNPUTmice <daniel@gultsch.de> | 2014-06-13 18:16:14 +0200 |
commit | d067448808801b49732e1a64b9b573267e0dee37 (patch) | |
tree | 54f2461c30cd6d14f8f29ec44f6b0075a3642617 /src/eu | |
parent | 76f3894107e2d2513a48ac66a9c4a76d9d75554a (diff) |
offline sending of images
Diffstat (limited to 'src/eu')
-rw-r--r-- | src/eu/siacs/conversations/services/XmppConnectionService.java | 22 | ||||
-rw-r--r-- | src/eu/siacs/conversations/ui/ConversationActivity.java | 1 |
2 files changed, 16 insertions, 7 deletions
diff --git a/src/eu/siacs/conversations/services/XmppConnectionService.java b/src/eu/siacs/conversations/services/XmppConnectionService.java index 026f212b9..f6bf4307f 100644 --- a/src/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/eu/siacs/conversations/services/XmppConnectionService.java @@ -699,8 +699,8 @@ public class XmppConnectionService extends Service { } } } else { + message.setStatus(Message.STATUS_WAITING); if (message.getType() == Message.TYPE_IMAGE) { - message.setStatus(Message.STATUS_WAITING); saveInDb = true; addToConversation = true; } else { @@ -719,8 +719,6 @@ public class XmppConnectionService extends Service { } else if (!conv.hasValidOtrSession() && message.getPresence() != null) { conv.startOtrSession(getApplicationContext(), message.getPresence(), false); - } else if (message.getPresence() == null) { - message.setStatus(Message.STATUS_WAITING); } saveInDb = true; addToConversation = true; @@ -749,8 +747,7 @@ public class XmppConnectionService extends Service { private void sendUnsendMessages(Conversation conversation) { for (int i = 0; i < conversation.getMessages().size(); ++i) { int status = conversation.getMessages().get(i).getStatus(); - if ((status == Message.STATUS_UNSEND) - || (status == Message.STATUS_WAITING)) { + if (status == Message.STATUS_WAITING) { resendMessage(conversation.getMessages().get(i)); } } @@ -799,8 +796,19 @@ public class XmppConnectionService extends Service { markMessage(message, Message.STATUS_SEND); } } else if (message.getType() == Message.TYPE_IMAGE) { - // TODO: send images - + Presences presences = message.getConversation().getContact().getPresences(); + if ((message.getPresence() != null) + && (presences.has(message.getPresence()))) { + markMessage(message, Message.STATUS_OFFERED); + mJingleConnectionManager.createNewConnection(message); + } else { + if (presences.size() == 1) { + String presence = presences.asStringArray()[0]; + message.setPresence(presence); + markMessage(message, Message.STATUS_OFFERED); + mJingleConnectionManager.createNewConnection(message); + } + } } } diff --git a/src/eu/siacs/conversations/ui/ConversationActivity.java b/src/eu/siacs/conversations/ui/ConversationActivity.java index d0982e8e8..51fe6c5e2 100644 --- a/src/eu/siacs/conversations/ui/ConversationActivity.java +++ b/src/eu/siacs/conversations/ui/ConversationActivity.java @@ -866,6 +866,7 @@ public class ConversationActivity extends XmppActivity { } else { Presences presences = contact.getPresences(); if (presences.size() == 0) { + conversation.setNextPresence(null); listener.onPresenceSelected(true, null); } else if (presences.size() == 1) { String presence = (String) presences.asStringArray()[0]; |