aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations/crypto/axolotl
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/crypto/axolotl
parent8be0e8a27ddd4d55a48a38efc5434a581be6f1b3 (diff)
Refactor axolotl send processing/caching flow
Diffstat (limited to 'src/main/java/eu/siacs/conversations/crypto/axolotl')
-rw-r--r--src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlService.java17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlService.java b/src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlService.java
index 72d1d14a..882ead3c 100644
--- a/src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlService.java
+++ b/src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlService.java
@@ -68,7 +68,7 @@ public class AxolotlService {
private final SQLiteAxolotlStore axolotlStore;
private final SessionMap sessions;
private final Map<Jid, Set<Integer>> deviceIds;
- private final Map<String, MessagePacket> messageCache;
+ private final Map<String, XmppAxolotlMessage> messageCache;
private final FetchStatusMap fetchStatusMap;
private final SerialSingleThreadExecutor executor;
@@ -1085,14 +1085,13 @@ public class AxolotlService {
executor.execute(new Runnable() {
@Override
public void run() {
- MessagePacket packet = mXmppConnectionService.getMessageGenerator()
- .generateAxolotlChat(message);
- if (packet == null) {
+ XmppAxolotlMessage axolotlMessage = encrypt(message);
+ if (axolotlMessage == null) {
mXmppConnectionService.markMessage(message, Message.STATUS_SEND_FAILED);
//mXmppConnectionService.updateConversationUi();
} else {
Log.d(Config.LOGTAG, AxolotlService.getLogprefix(account)+"Generated message, caching: " + message.getUuid());
- messageCache.put(message.getUuid(), packet);
+ messageCache.put(message.getUuid(), axolotlMessage);
mXmppConnectionService.resendMessage(message,delay);
}
}
@@ -1108,15 +1107,15 @@ public class AxolotlService {
}
}
- public MessagePacket fetchPacketFromCache(Message message) {
- MessagePacket packet = messageCache.get(message.getUuid());
- if (packet != null) {
+ public XmppAxolotlMessage fetchAxolotlMessageFromCache(Message message) {
+ XmppAxolotlMessage axolotlMessage = messageCache.get(message.getUuid());
+ if (axolotlMessage != null) {
Log.d(Config.LOGTAG, AxolotlService.getLogprefix(account)+"Cache hit: " + message.getUuid());
messageCache.remove(message.getUuid());
} else {
Log.d(Config.LOGTAG, AxolotlService.getLogprefix(account)+"Cache miss: " + message.getUuid());
}
- return packet;
+ return axolotlMessage;
}
public XmppAxolotlMessage.XmppAxolotlPlaintextMessage processReceiving(XmppAxolotlMessage message) {