diff options
author | Christian Schneppe <christian@pix-art.de> | 2018-04-13 23:11:28 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2018-04-13 23:11:28 +0200 |
commit | 1b6bf807de1b442687ec5f9982e551bb16923f04 (patch) | |
tree | 69f18a6c9e78c8e622c316c1016f27639a9dee9e /src/main/java/de/pixart/messenger/entities/Conversation.java | |
parent | bcbc0006a171c06e896e6430d239e7a57357b016 (diff) |
persist some muc configurations
Diffstat (limited to '')
-rw-r--r-- | src/main/java/de/pixart/messenger/entities/Conversation.java | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/main/java/de/pixart/messenger/entities/Conversation.java b/src/main/java/de/pixart/messenger/entities/Conversation.java index a010a3799..fa5e5ef60 100644 --- a/src/main/java/de/pixart/messenger/entities/Conversation.java +++ b/src/main/java/de/pixart/messenger/entities/Conversation.java @@ -62,6 +62,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_ALLOW_PM = "allow_pm"; + 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"; protected final ArrayList<Message> messages = new ArrayList<>(); public AtomicBoolean messagesLoaded = new AtomicBoolean(true); protected Account account = null; @@ -895,6 +899,12 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl return mode == MODE_SINGLE || getBooleanAttribute(ATTRIBUTE_ALWAYS_NOTIFY, Config.ALWAYS_NOTIFY_BY_DEFAULT || isPrivateAndNonAnonymous()); } + public boolean setAttribute(String key, boolean value) { + boolean prev = getBooleanAttribute(key, false); + setAttribute(key, Boolean.toString(value)); + return prev != value; + } + private boolean setAttribute(String key, long value) { return setAttribute(key, Long.toString(value)); } @@ -981,7 +991,7 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl } } - private boolean getBooleanAttribute(String key, boolean defaultValue) { + public boolean getBooleanAttribute(String key, boolean defaultValue) { String value = this.getAttribute(key); if (value == null) { return defaultValue; |