aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger/entities
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2018-04-24 21:53:43 +0200
committerChristian Schneppe <christian@pix-art.de>2018-04-24 21:53:43 +0200
commit5527909775a4db91a2187435bbf1b5f3e31417f4 (patch)
tree162d314e19fc4eb5a1c805c4e92e4a1eda6115b2 /src/main/java/de/pixart/messenger/entities
parente6b210030da617f264fda02aacb51242db03be56 (diff)
keep track of user object in messages
Diffstat (limited to 'src/main/java/de/pixart/messenger/entities')
-rw-r--r--src/main/java/de/pixart/messenger/entities/Message.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/main/java/de/pixart/messenger/entities/Message.java b/src/main/java/de/pixart/messenger/entities/Message.java
index 7a3e12073..5df54861f 100644
--- a/src/main/java/de/pixart/messenger/entities/Message.java
+++ b/src/main/java/de/pixart/messenger/entities/Message.java
@@ -5,6 +5,7 @@ import android.database.Cursor;
import android.text.SpannableStringBuilder;
import android.util.Log;
+import java.lang.ref.WeakReference;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Collections;
@@ -105,6 +106,7 @@ public class Message extends AbstractEntity {
private Boolean treatAsDownloadable = null;
private FileParams fileParams = null;
private List<MucOptions.User> counterparts;
+ private WeakReference<MucOptions.User> user;
private Message(Conversation conversation) {
this.conversation = conversation;
@@ -317,6 +319,16 @@ public class Message extends AbstractEntity {
this.fileParams = null;
}
+ public void setMucUser(MucOptions.User user) {
+ this.user = new WeakReference<>(user);
+ }
+
+ public boolean sameMucUser(Message otherMessage) {
+ final MucOptions.User thisUser = this.user == null ? null : this.user.get();
+ final MucOptions.User otherUser = otherMessage.user == null ? null : otherMessage.user.get();
+ return thisUser != null && thisUser == otherUser;
+ }
+
public String getErrorMessage() {
return errorMessage;
}