aboutsummaryrefslogtreecommitdiffstats
path: root/src/de/gultsch/chat/entities
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/de/gultsch/chat/entities/AbstractEntity.java4
-rw-r--r--src/de/gultsch/chat/entities/Conversation.java10
-rw-r--r--src/de/gultsch/chat/entities/Message.java7
3 files changed, 20 insertions, 1 deletions
diff --git a/src/de/gultsch/chat/entities/AbstractEntity.java b/src/de/gultsch/chat/entities/AbstractEntity.java
index d62385a6..31a19fc0 100644
--- a/src/de/gultsch/chat/entities/AbstractEntity.java
+++ b/src/de/gultsch/chat/entities/AbstractEntity.java
@@ -18,4 +18,8 @@ public abstract class AbstractEntity implements Serializable {
public abstract ContentValues getContentValues();
+ public boolean equals(AbstractEntity entity) {
+ return this.getUuid().equals(entity.getUuid());
+ }
+
}
diff --git a/src/de/gultsch/chat/entities/Conversation.java b/src/de/gultsch/chat/entities/Conversation.java
index 10eb7079..ca359477 100644
--- a/src/de/gultsch/chat/entities/Conversation.java
+++ b/src/de/gultsch/chat/entities/Conversation.java
@@ -32,11 +32,13 @@ public class Conversation extends AbstractEntity {
private long created;
private transient List<Message> messages = null;
+ private transient Account account = null;
public Conversation(String name, String profilePhoto, Account account,
String contactJid) {
this(java.util.UUID.randomUUID().toString(), name, profilePhoto, account.getUuid(), contactJid, System
.currentTimeMillis(), STATUS_AVAILABLE);
+ this.account = account;
}
public Conversation(String uuid, String name, String profilePhoto,
@@ -93,7 +95,15 @@ public class Conversation extends AbstractEntity {
public String getAccountUuid() {
return this.accountUuid;
}
+
+ public Account getAccount() {
+ return this.account;
+ }
+ public void setAccount(Account account) {
+ this.account = account;
+ }
+
public String getContactJid() {
return this.contactJid;
}
diff --git a/src/de/gultsch/chat/entities/Message.java b/src/de/gultsch/chat/entities/Message.java
index 130435b9..530a4db4 100644
--- a/src/de/gultsch/chat/entities/Message.java
+++ b/src/de/gultsch/chat/entities/Message.java
@@ -39,7 +39,12 @@ public class Message extends AbstractEntity {
Message.STATUS_UNSEND);
this.conversation = conversation;
}
-
+
+ public Message(Conversation conversation, String counterpart, String body, int encryption, int status) {
+ this(java.util.UUID.randomUUID().toString(), conversation.getUuid(),counterpart, body, System.currentTimeMillis(), encryption,status);
+ this.conversation = conversation;
+ }
+
public Message(String uuid, String conversationUUid, String counterpart,
String body, long timeSent, int encryption, int status) {
this.uuid = uuid;