aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger/crypto
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2018-01-27 22:03:15 +0100
committerChristian Schneppe <christian@pix-art.de>2018-01-27 22:03:15 +0100
commit7ba79653b17284ac5d6c2e8ca6287dad1cc9bb06 (patch)
treeb7b9d90751fdae65e75993adf75b4622b6627748 /src/main/java/de/pixart/messenger/crypto
parentff1b7567d122aaa22a191f0fc7a1cc270bd57a0e (diff)
improvements for self messages
* fix omemo in group chats w/o participants * don't create two axolotl messages when messaging self * fix read marker for self messages
Diffstat (limited to 'src/main/java/de/pixart/messenger/crypto')
-rw-r--r--src/main/java/de/pixart/messenger/crypto/axolotl/AxolotlService.java9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/main/java/de/pixart/messenger/crypto/axolotl/AxolotlService.java b/src/main/java/de/pixart/messenger/crypto/axolotl/AxolotlService.java
index 6721a7975..cece60c5a 100644
--- a/src/main/java/de/pixart/messenger/crypto/axolotl/AxolotlService.java
+++ b/src/main/java/de/pixart/messenger/crypto/axolotl/AxolotlService.java
@@ -334,6 +334,10 @@ public class AxolotlService implements OnAdvancedStreamFeaturesLoaded {
}
private Set<XmppAxolotlSession> findSessionsForConversation(Conversation conversation) {
+ if (conversation.getContact().isSelf()) {
+ //will be added in findOwnSessions()
+ return Collections.emptySet();
+ }
HashSet<XmppAxolotlSession> sessions = new HashSet<>();
for (Jid jid : conversation.getAcceptedCryptoTargets()) {
sessions.addAll(this.sessions.getAll(getAddressForJid(jid).getName()).values());
@@ -1179,7 +1183,8 @@ public class AxolotlService implements OnAdvancedStreamFeaturesLoaded {
}
public boolean trustedSessionVerified(final Conversation conversation) {
- Set<XmppAxolotlSession> sessions = findSessionsForConversation(conversation);
+ final Set<XmppAxolotlSession> sessions = new HashSet<>();
+ sessions.addAll(findSessionsForConversation(conversation));
sessions.addAll(findOwnSessions());
boolean verified = false;
for (XmppAxolotlSession session : sessions) {
@@ -1213,7 +1218,7 @@ public class AxolotlService implements OnAdvancedStreamFeaturesLoaded {
@Nullable
private boolean buildHeader(XmppAxolotlMessage axolotlMessage, Conversation c) {
Set<XmppAxolotlSession> remoteSessions = findSessionsForConversation(c);
- final boolean acceptEmpty = c.getMode() == Conversation.MODE_MULTI && c.getMucOptions().getUserCount() == 0;
+ final boolean acceptEmpty = (c.getMode() == Conversation.MODE_MULTI && c.getMucOptions().getUserCount() == 0) || c.getContact().isSelf();
Collection<XmppAxolotlSession> ownSessions = findOwnSessions();
if (remoteSessions.isEmpty() && !acceptEmpty) {
return false;