aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger/parser/MessageParser.java
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2017-04-13 21:11:35 +0200
committerChristian Schneppe <christian@pix-art.de>2017-04-13 21:11:35 +0200
commit522538e2acbc104346f8669e61cdb35731481837 (patch)
tree7c4444511f2053b67be58b628ff11f4b88e8ccf8 /src/main/java/de/pixart/messenger/parser/MessageParser.java
parent09d7b611af577fb920f032521cc8f1603cb5ec40 (diff)
send urls pointing to pgp encrypted files directly in body+oob
Diffstat (limited to 'src/main/java/de/pixart/messenger/parser/MessageParser.java')
-rw-r--r--src/main/java/de/pixart/messenger/parser/MessageParser.java14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/main/java/de/pixart/messenger/parser/MessageParser.java b/src/main/java/de/pixart/messenger/parser/MessageParser.java
index b621ef79b..90b4254f4 100644
--- a/src/main/java/de/pixart/messenger/parser/MessageParser.java
+++ b/src/main/java/de/pixart/messenger/parser/MessageParser.java
@@ -414,7 +414,7 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
}
if ((body != null || pgpEncrypted != null || axolotlEncrypted != null || oobUrl != null) && !isMucStatusMessage) {
- Conversation conversation = mXmppConnectionService.findOrCreateConversation(account, counterpart.toBareJid(), isTypeGroupChat, false, query);
+ final Conversation conversation = mXmppConnectionService.findOrCreateConversation(account, counterpart.toBareJid(), isTypeGroupChat, false, query);
final boolean conversationMultiMode = conversation.getMode() == Conversation.MODE_MULTI;
if (serverMsgId == null) {
serverMsgId = extractStanzaId(packet, isTypeGroupChat, conversation);
@@ -471,6 +471,9 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
} else if (body == null && oobUrl != null) {
message = new Message(conversation, oobUrl, Message.ENCRYPTION_NONE, status);
message.setOob(true);
+ if (CryptoHelper.isPgpEncryptedUrl(oobUrl)) {
+ message.setEncryption(Message.ENCRYPTION_DECRYPTED);
+ }
} else {
message = new Message(conversation, body, Message.ENCRYPTION_NONE, status);
}
@@ -480,7 +483,12 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
message.setServerMsgId(serverMsgId);
message.setCarbon(isCarbon);
message.setTime(timestamp);
- message.setOob(body != null && body.equals(oobUrl));
+ if (body != null && body.equals(oobUrl)) {
+ message.setOob(true);
+ if (CryptoHelper.isPgpEncryptedUrl(oobUrl)) {
+ message.setEncryption(Message.ENCRYPTION_DECRYPTED);
+ }
+ }
message.markable = packet.hasChild("markable", "urn:xmpp:chat-markers:0");
if (conversationMultiMode) {
final Jid fallback = conversation.getMucOptions().getTrueCounterpart(counterpart);
@@ -613,7 +621,7 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
}
}
} else if (!packet.hasChild("body")) { //no body
- Conversation conversation = mXmppConnectionService.find(account, from.toBareJid());
+ final Conversation conversation = mXmppConnectionService.find(account, from.toBareJid());
if (isTypeGroupChat) {
if (packet.hasChild("subject")) {
if (conversation != null && conversation.getMode() == Conversation.MODE_MULTI) {