aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/eu/siacs/conversations/services/XmppConnectionService.java54
-rw-r--r--src/eu/siacs/conversations/ui/ConversationFragment.java11
2 files changed, 41 insertions, 24 deletions
diff --git a/src/eu/siacs/conversations/services/XmppConnectionService.java b/src/eu/siacs/conversations/services/XmppConnectionService.java
index 154b317e..026f212b 100644
--- a/src/eu/siacs/conversations/services/XmppConnectionService.java
+++ b/src/eu/siacs/conversations/services/XmppConnectionService.java
@@ -650,7 +650,13 @@ public class XmppConnectionService extends Service {
boolean send = false;
if (account.getStatus() == Account.STATUS_ONLINE) {
if (message.getType() == Message.TYPE_IMAGE) {
- mJingleConnectionManager.createNewConnection(message);
+ if (message.getPresence() !=null ) {
+ mJingleConnectionManager.createNewConnection(message);
+ } else {
+ message.setStatus(Message.STATUS_WAITING);
+ saveInDb = true;
+ addToConversation = true;
+ }
} else {
if (message.getEncryption() == Message.ENCRYPTION_OTR) {
if (!conv.hasValidOtrSession()&&(message.getPresence() != null)) {
@@ -693,29 +699,35 @@ public class XmppConnectionService extends Service {
}
}
} else {
- if (message.getEncryption() == Message.ENCRYPTION_PGP) {
- String pgpBody = message.getEncryptedBody();
- String decryptedBody = message.getBody();
- message.setBody(pgpBody);
- databaseBackend.createMessage(message);
- message.setEncryption(Message.ENCRYPTION_DECRYPTED);
- message.setBody(decryptedBody);
- addToConversation = true;
- } else if (message.getEncryption() == Message.ENCRYPTION_OTR) {
- if (conv.hasValidOtrSession()) {
- message.setPresence(conv.getOtrSession().getSessionID()
- .getUserID());
- } else if (!conv.hasValidOtrSession() && message.getPresence() != null) {
- conv.startOtrSession(getApplicationContext(),
- message.getPresence(), false);
- } else if (message.getPresence() == null) {
- message.setStatus(Message.STATUS_WAITING);
- }
+ if (message.getType() == Message.TYPE_IMAGE) {
+ message.setStatus(Message.STATUS_WAITING);
saveInDb = true;
addToConversation = true;
} else {
- saveInDb = true;
- addToConversation = true;
+ if (message.getEncryption() == Message.ENCRYPTION_PGP) {
+ String pgpBody = message.getEncryptedBody();
+ String decryptedBody = message.getBody();
+ message.setBody(pgpBody);
+ databaseBackend.createMessage(message);
+ message.setEncryption(Message.ENCRYPTION_DECRYPTED);
+ message.setBody(decryptedBody);
+ addToConversation = true;
+ } else if (message.getEncryption() == Message.ENCRYPTION_OTR) {
+ if (conv.hasValidOtrSession()) {
+ message.setPresence(conv.getOtrSession().getSessionID()
+ .getUserID());
+ } 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;
+ } else {
+ saveInDb = true;
+ addToConversation = true;
+ }
}
}
diff --git a/src/eu/siacs/conversations/ui/ConversationFragment.java b/src/eu/siacs/conversations/ui/ConversationFragment.java
index 9d4f6008..b5c5f592 100644
--- a/src/eu/siacs/conversations/ui/ConversationFragment.java
+++ b/src/eu/siacs/conversations/ui/ConversationFragment.java
@@ -193,6 +193,8 @@ public class ConversationFragment extends Fragment {
String filesize = null;
String info = null;
boolean error = false;
+ boolean multiReceived = message.getConversation().getMode() == Conversation.MODE_MULTI
+ && message.getStatus() <= Message.STATUS_RECIEVED;
if (message.getType() == Message.TYPE_IMAGE) {
String[] fileParams = message.getBody().split(",");
try {
@@ -221,8 +223,7 @@ public class ConversationFragment extends Fragment {
error = true;
break;
default:
- if ((message.getConversation().getMode() == Conversation.MODE_MULTI)
- && (message.getStatus() <= Message.STATUS_RECIEVED)) {
+ if (multiReceived) {
info = message.getCounterpart();
}
break;
@@ -256,8 +257,12 @@ public class ConversationFragment extends Fragment {
if ((filesize != null) && (info != null)) {
viewHolder.time.setText(filesize + " \u00B7 " + info);
} else if ((filesize == null) && (info != null)) {
- viewHolder.time.setText(info + " \u00B7 "
+ if (error) {
+ viewHolder.time.setText(info + " \u00B7 "
+ formatedTime);
+ } else {
+ viewHolder.time.setText(info);
+ }
} else if ((filesize != null) && (info == null)) {
viewHolder.time.setText(filesize + " \u00B7 "
+ formatedTime);