status waiting for images sent offline
This commit is contained in:
parent
eb7ed78605
commit
76f3894107
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue