aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger/entities
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/de/pixart/messenger/entities')
-rw-r--r--src/main/java/de/pixart/messenger/entities/Conversation.java26
-rw-r--r--src/main/java/de/pixart/messenger/entities/MucOptions.java2
2 files changed, 15 insertions, 13 deletions
diff --git a/src/main/java/de/pixart/messenger/entities/Conversation.java b/src/main/java/de/pixart/messenger/entities/Conversation.java
index ee882ebec..65d9de107 100644
--- a/src/main/java/de/pixart/messenger/entities/Conversation.java
+++ b/src/main/java/de/pixart/messenger/entities/Conversation.java
@@ -64,9 +64,10 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
private static final String ATTRIBUTE_NEXT_MESSAGE_TIMESTAMP = "next_message_timestamp";
private static final String ATTRIBUTE_CRYPTO_TARGETS = "crypto_targets";
private static final String ATTRIBUTE_NEXT_ENCRYPTION = "next_encryption";
- public static final String ATTRIBUTE_MEMBERS_ONLY = "members_only";
- public static final String ATTRIBUTE_MODERATED = "moderated";
- public static final String ATTRIBUTE_NON_ANONYMOUS = "non_anonymous";
+ static final String ATTRIBUTE_MEMBERS_ONLY = "members_only";
+ static final String ATTRIBUTE_MODERATED = "moderated";
+ static final String ATTRIBUTE_NON_ANONYMOUS = "non_anonymous";
+ public static final String ATTRIBUTE_FORMERLY_PRIVATE_NON_ANONYMOUS = "formerly_private_non_anonymous";
protected final ArrayList<Message> messages = new ArrayList<>();
public AtomicBoolean messagesLoaded = new AtomicBoolean(true);
protected Account account = null;
@@ -78,7 +79,7 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
private int status;
private long created;
private int mode;
- private JSONObject attributes = new JSONObject();
+ private JSONObject attributes;
private Jid nextCounterpart;
private transient SessionImpl otrSession;
private transient String otrFingerprint = null;
@@ -811,7 +812,7 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
}
- private static boolean suitableForOmemoByDefault(final Conversation conversation) {
+ public static boolean suitableForOmemoByDefault(final Conversation conversation) {
if (conversation.getJid().asBareJid().equals(Config.BUG_REPORTS)) {
return false;
}
@@ -823,12 +824,11 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
if (Config.OMEMO_EXCEPTIONS.CONTACT_DOMAINS.contains(contact) || Config.OMEMO_EXCEPTIONS.ACCOUNT_DOMAINS.contains(account)) {
return false;
}
- final AxolotlService axolotlService = conversation.getAccount().getAxolotlService();
- return axolotlService != null && axolotlService.isConversationAxolotlCapable(conversation);
+ return conversation.isSingleOrPrivateAndNonAnonymous() || conversation.getBooleanAttribute(ATTRIBUTE_FORMERLY_PRIVATE_NON_ANONYMOUS, false);
}
- public void setNextEncryption(int encryption) {
- this.setAttribute(ATTRIBUTE_NEXT_ENCRYPTION, String.valueOf(encryption));
+ public boolean setNextEncryption(int encryption) {
+ return this.setAttribute(ATTRIBUTE_NEXT_ENCRYPTION, encryption);
}
public String getNextMessage() {
@@ -954,15 +954,17 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
}
public boolean setAttribute(String key, boolean value) {
- boolean prev = getBooleanAttribute(key, false);
- setAttribute(key, Boolean.toString(value));
- return prev != value;
+ return setAttribute(key, String.valueOf(value));
}
private boolean setAttribute(String key, long value) {
return setAttribute(key, Long.toString(value));
}
+ private boolean setAttribute(String key, int value) {
+ return setAttribute(key, String.valueOf(value));
+ }
+
public boolean setAttribute(String key, String value) {
synchronized (this.attributes) {
try {
diff --git a/src/main/java/de/pixart/messenger/entities/MucOptions.java b/src/main/java/de/pixart/messenger/entities/MucOptions.java
index 3ab763632..c3050f3fa 100644
--- a/src/main/java/de/pixart/messenger/entities/MucOptions.java
+++ b/src/main/java/de/pixart/messenger/entities/MucOptions.java
@@ -511,7 +511,7 @@ public class MucOptions {
return users;
}
- public String createNameFromParticipants() {
+ String createNameFromParticipants() {
List<User> users = getUsersRelevantForNameAndAvatar();
if (users.size() >= 2) {
StringBuilder builder = new StringBuilder();