aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/siacs/conversations/entities
diff options
context:
space:
mode:
authoriNPUTmice <daniel@gultsch.de>2014-10-07 15:18:09 +0200
committeriNPUTmice <daniel@gultsch.de>2014-10-07 15:18:09 +0200
commit919c98207bb317e2283084dcbaa34a5216997d85 (patch)
tree170d7ca434756cbe679fe89154b56b4c321bfb34 /src/eu/siacs/conversations/entities
parentd5227e5c253658eb9d6bc1f7bf85397f072125d4 (diff)
made disabled notifications permanent across restarts
Diffstat (limited to 'src/eu/siacs/conversations/entities')
-rw-r--r--src/eu/siacs/conversations/entities/Conversation.java23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/eu/siacs/conversations/entities/Conversation.java b/src/eu/siacs/conversations/entities/Conversation.java
index fedb0893..39e54a8f 100644
--- a/src/eu/siacs/conversations/entities/Conversation.java
+++ b/src/eu/siacs/conversations/entities/Conversation.java
@@ -43,6 +43,7 @@ public class Conversation extends AbstractEntity {
public static final String ATTRIBUTE_NEXT_ENCRYPTION = "next_encryption";
public static final String ATTRIBUTE_MUC_PASSWORD = "muc_password";
+ public static final String ATTRIBUTE_MUTED_TILL = "muted_till";
private String name;
private String contactUuid;
@@ -54,8 +55,6 @@ public class Conversation extends AbstractEntity {
private JSONObject attributes = new JSONObject();
- private long mutedTill = 0;
-
private String nextPresence;
private transient CopyOnWriteArrayList<Message> messages = null;
@@ -452,12 +451,13 @@ public class Conversation extends AbstractEntity {
return false;
}
- public void setMutedTill(long mutedTill) {
- this.mutedTill = mutedTill;
+ public void setMutedTill(long value) {
+ this.setAttribute(ATTRIBUTE_MUTED_TILL, String.valueOf(value));
}
public boolean isMuted() {
- return SystemClock.elapsedRealtime() < this.mutedTill;
+ return SystemClock.elapsedRealtime() < this.getLongAttribute(
+ ATTRIBUTE_MUTED_TILL, 0);
}
public boolean setAttribute(String key, String value) {
@@ -489,4 +489,17 @@ public class Conversation extends AbstractEntity {
}
}
}
+
+ public long getLongAttribute(String key, long defaultValue) {
+ String value = this.getAttribute(key);
+ if (value == null) {
+ return defaultValue;
+ } else {
+ try {
+ return Long.parseLong(value);
+ } catch (NumberFormatException e) {
+ return defaultValue;
+ }
+ }
+ }
}