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;
if (account.getStatus() == Account.STATUS_ONLINE) {
if (message.getType() == Message.TYPE_IMAGE) {
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)) {
@ -692,6 +698,11 @@ public class XmppConnectionService extends Service {
addToConversation = true;
}
}
} else {
if (message.getType() == Message.TYPE_IMAGE) {
message.setStatus(Message.STATUS_WAITING);
saveInDb = true;
addToConversation = true;
} else {
if (message.getEncryption() == Message.ENCRYPTION_PGP) {
String pgpBody = message.getEncryptedBody();
@ -717,6 +728,7 @@ public class XmppConnectionService extends Service {
saveInDb = true;
addToConversation = true;
}
}
}
if (saveInDb) {

View File

@ -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)) {
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);