aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger/entities
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2017-10-06 22:42:17 +0200
committerChristian Schneppe <christian@pix-art.de>2017-10-06 22:42:17 +0200
commitfa5082e6827b90fb11bf5917f9bbb388f8fe88cf (patch)
tree33f184a5d2846cd41e75134ce3d66dc9b3eb6e8c /src/main/java/de/pixart/messenger/entities
parentae2ee6ef16f48518d09cc1ec52c852205d785af7 (diff)
save message drafts across restarts
Diffstat (limited to 'src/main/java/de/pixart/messenger/entities')
-rw-r--r--src/main/java/de/pixart/messenger/entities/Conversation.java16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/main/java/de/pixart/messenger/entities/Conversation.java b/src/main/java/de/pixart/messenger/entities/Conversation.java
index 5744d67a7..833b1eb3b 100644
--- a/src/main/java/de/pixart/messenger/entities/Conversation.java
+++ b/src/main/java/de/pixart/messenger/entities/Conversation.java
@@ -58,6 +58,7 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
public static final String ATTRIBUTE_ALWAYS_NOTIFY = "always_notify";
private static final String ATTRIBUTE_CRYPTO_TARGETS = "crypto_targets";
public static final String ATTRIBUTE_LAST_CLEAR_HISTORY = "last_clear_history";
+ public static final String ATTRIBUTE_NEXT_MESSAGE = "next_message";
private String draftMessage;
private String name;
@@ -80,8 +81,6 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
private transient String otrFingerprint = null;
private Smp mSmp = new Smp();
- private String nextMessage;
-
private transient MucOptions mucOptions = null;
private byte[] symmetricKey;
@@ -788,19 +787,18 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
}
public String getNextMessage() {
- if (this.nextMessage == null) {
- return "";
- } else {
- return this.nextMessage;
- }
+ final String nextMessage = getAttribute(ATTRIBUTE_NEXT_MESSAGE);
+ return nextMessage == null ? "" : nextMessage;
}
public boolean smpRequested() {
return smp().status == Smp.STATUS_CONTACT_REQUESTED;
}
- public void setNextMessage(String message) {
- this.nextMessage = message;
+ public boolean setNextMessage(String message) {
+ boolean changed = !getNextMessage().equals(message);
+ this.setAttribute(ATTRIBUTE_NEXT_MESSAGE, message);
+ return changed;
}
public void setSymmetricKey(byte[] key) {