aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
diff options
context:
space:
mode:
authorAndreas Straub <andy@strb.org>2015-07-20 23:13:28 +0200
committerAndreas Straub <andy@strb.org>2015-07-20 23:13:28 +0200
commitd2845e9ac1040a269401ef9d59e27bac9e7b7d5a (patch)
tree4b7f769f361e46a9a183da62077c815644703213 /src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
parent8be0e8a27ddd4d55a48a38efc5434a581be6f1b3 (diff)
Refactor axolotl send processing/caching flow
Diffstat (limited to 'src/main/java/eu/siacs/conversations/services/XmppConnectionService.java')
-rw-r--r--src/main/java/eu/siacs/conversations/services/XmppConnectionService.java11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
index e43b2536..e7df9e6a 100644
--- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
+++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
@@ -52,6 +52,7 @@ import de.duenndns.ssl.MemorizingTrustManager;
import eu.siacs.conversations.Config;
import eu.siacs.conversations.R;
import eu.siacs.conversations.crypto.PgpEngine;
+import eu.siacs.conversations.crypto.axolotl.XmppAxolotlMessage;
import eu.siacs.conversations.entities.Account;
import eu.siacs.conversations.entities.Blockable;
import eu.siacs.conversations.entities.Bookmark;
@@ -765,10 +766,12 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
break;
}
} else {
- packet = account.getAxolotlService().fetchPacketFromCache(message);
- if (packet == null) {
+ XmppAxolotlMessage axolotlMessage = account.getAxolotlService().fetchAxolotlMessageFromCache(message);
+ if (axolotlMessage == null) {
account.getAxolotlService().prepareMessage(message,delay);
message.setAxolotlFingerprint(account.getAxolotlService().getOwnPublicKey().getFingerprint().replaceAll("\\s", ""));
+ } else {
+ packet = mMessageGenerator.generateAxolotlChat(message, axolotlMessage);
}
}
break;
@@ -839,7 +842,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
@Override
public void onMessageFound(Message message) {
- resendMessage(message,true);
+ resendMessage(message, true);
}
});
}
@@ -1851,7 +1854,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
} else {
MessagePacket outPacket = mMessageGenerator.generateOtrChat(message);
if (outPacket != null) {
- mMessageGenerator.addDelay(outPacket,message.getTimeSent());
+ mMessageGenerator.addDelay(outPacket, message.getTimeSent());
message.setStatus(Message.STATUS_SEND);
databaseBackend.updateMessage(message);
sendMessagePacket(account, outPacket);