aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations/generator
diff options
context:
space:
mode:
authorAndreas Straub <andy@strb.org>2015-06-29 14:22:26 +0200
committerAndreas Straub <andy@strb.org>2015-07-19 21:32:26 +0200
commit3815d4efa378846c8aef840ad659268a0bef1536 (patch)
treeb13fffaeb22e0b4fcfb3b362319569f89fd6641d /src/main/java/eu/siacs/conversations/generator
parentcb7980c65ed5d91296e3ad571298dbed434707c0 (diff)
Fetch bundles on-demand, encrypt in background
Bundles are now fetched on demand when a session needs to be established. This should lessen the chance of changes to the bundles occuring before they're used, as well as lessen the load of fetching bundles. Also, the message encryption is now done in a background thread, as this can be somewhat costly if many sessions are present. This is probably not going to be an issue in real use, but it's good practice anyway.
Diffstat (limited to 'src/main/java/eu/siacs/conversations/generator')
-rw-r--r--src/main/java/eu/siacs/conversations/generator/MessageGenerator.java10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/main/java/eu/siacs/conversations/generator/MessageGenerator.java b/src/main/java/eu/siacs/conversations/generator/MessageGenerator.java
index 0b6a7c61..b0727690 100644
--- a/src/main/java/eu/siacs/conversations/generator/MessageGenerator.java
+++ b/src/main/java/eu/siacs/conversations/generator/MessageGenerator.java
@@ -66,16 +66,18 @@ public class MessageGenerator extends AbstractGenerator {
delay.setAttribute("stamp", mDateFormat.format(date));
}
- public MessagePacket generateAxolotlChat(Message message) throws NoSessionsCreatedException{
+ public MessagePacket generateAxolotlChat(Message message) {
return generateAxolotlChat(message, false);
}
- public MessagePacket generateAxolotlChat(Message message, boolean addDelay) throws NoSessionsCreatedException{
+ public MessagePacket generateAxolotlChat(Message message, boolean addDelay) {
MessagePacket packet = preparePacket(message, addDelay);
AxolotlService service = message.getConversation().getAccount().getAxolotlService();
Log.d(Config.LOGTAG, "Submitting message to axolotl service for send processing...");
- XmppAxolotlMessage axolotlMessage = service.processSending(message.getContact(),
- message.getBody());
+ XmppAxolotlMessage axolotlMessage = service.encrypt(message);
+ if (axolotlMessage == null) {
+ return null;
+ }
packet.setAxolotlMessage(axolotlMessage.toXml());
return packet;
}