status waiting for images sent offline

This commit is contained in:
iNPUTmice 2014-06-13 15:05:35 +02:00
parent eb7ed78605
commit 76f3894107
2 changed files with 41 additions and 24 deletions

View File

@ -650,7 +650,13 @@ public class XmppConnectionService extends Service {
boolean send = false; boolean send = false;
if (account.getStatus() == Account.STATUS_ONLINE) { if (account.getStatus() == Account.STATUS_ONLINE) {
if (message.getType() == Message.TYPE_IMAGE) { if (message.getType() == Message.TYPE_IMAGE) {
if (message.getPresence() !=null ) {
mJingleConnectionManager.createNewConnection(message); mJingleConnectionManager.createNewConnection(message);
} else {
message.setStatus(Message.STATUS_WAITING);
saveInDb = true;
addToConversation = true;
}
} else { } else {
if (message.getEncryption() == Message.ENCRYPTION_OTR) { if (message.getEncryption() == Message.ENCRYPTION_OTR) {
if (!conv.hasValidOtrSession()&&(message.getPresence() != null)) { if (!conv.hasValidOtrSession()&&(message.getPresence() != null)) {
@ -692,6 +698,11 @@ public class XmppConnectionService extends Service {
addToConversation = true; addToConversation = true;
} }
} }
} else {
if (message.getType() == Message.TYPE_IMAGE) {
message.setStatus(Message.STATUS_WAITING);
saveInDb = true;
addToConversation = true;
} else { } else {
if (message.getEncryption() == Message.ENCRYPTION_PGP) { if (message.getEncryption() == Message.ENCRYPTION_PGP) {
String pgpBody = message.getEncryptedBody(); String pgpBody = message.getEncryptedBody();
@ -717,6 +728,7 @@ public class XmppConnectionService extends Service {
saveInDb = true; saveInDb = true;
addToConversation = true; addToConversation = true;
} }
}
} }
if (saveInDb) { if (saveInDb) {

View File

@ -193,6 +193,8 @@ public class ConversationFragment extends Fragment {
String filesize = null; String filesize = null;
String info = null; String info = null;
boolean error = false; boolean error = false;
boolean multiReceived = message.getConversation().getMode() == Conversation.MODE_MULTI
&& message.getStatus() <= Message.STATUS_RECIEVED;
if (message.getType() == Message.TYPE_IMAGE) { if (message.getType() == Message.TYPE_IMAGE) {
String[] fileParams = message.getBody().split(","); String[] fileParams = message.getBody().split(",");
try { try {
@ -221,8 +223,7 @@ public class ConversationFragment extends Fragment {
error = true; error = true;
break; break;
default: default:
if ((message.getConversation().getMode() == Conversation.MODE_MULTI) if (multiReceived) {
&& (message.getStatus() <= Message.STATUS_RECIEVED)) {
info = message.getCounterpart(); info = message.getCounterpart();
} }
break; break;
@ -256,8 +257,12 @@ public class ConversationFragment extends Fragment {
if ((filesize != null) && (info != null)) { if ((filesize != null) && (info != null)) {
viewHolder.time.setText(filesize + " \u00B7 " + info); viewHolder.time.setText(filesize + " \u00B7 " + info);
} else if ((filesize == null) && (info != null)) { } else if ((filesize == null) && (info != null)) {
if (error) {
viewHolder.time.setText(info + " \u00B7 " viewHolder.time.setText(info + " \u00B7 "
+ formatedTime); + formatedTime);
} else {
viewHolder.time.setText(info);
}
} else if ((filesize != null) && (info == null)) { } else if ((filesize != null) && (info == null)) {
viewHolder.time.setText(filesize + " \u00B7 " viewHolder.time.setText(filesize + " \u00B7 "
+ formatedTime); + formatedTime);