diff options
Diffstat (limited to 'src/eu/siacs/conversations/entities')
-rw-r--r-- | src/eu/siacs/conversations/entities/Conversation.java | 30 | ||||
-rw-r--r-- | src/eu/siacs/conversations/entities/Downloadable.java | 1 |
2 files changed, 17 insertions, 14 deletions
diff --git a/src/eu/siacs/conversations/entities/Conversation.java b/src/eu/siacs/conversations/entities/Conversation.java index c984933f..600b9d38 100644 --- a/src/eu/siacs/conversations/entities/Conversation.java +++ b/src/eu/siacs/conversations/entities/Conversation.java @@ -1,8 +1,8 @@ package eu.siacs.conversations.entities; import java.security.interfaces.DSAPublicKey; +import java.util.ArrayList; import java.util.List; -import java.util.concurrent.CopyOnWriteArrayList; import org.json.JSONException; import org.json.JSONObject; @@ -57,7 +57,7 @@ public class Conversation extends AbstractEntity { private String nextPresence; - private transient CopyOnWriteArrayList<Message> messages = null; + private transient ArrayList<Message> messages = new ArrayList<Message>(); private transient Account account = null; private transient SessionImpl otrSession; @@ -104,17 +104,6 @@ public class Conversation extends AbstractEntity { } public List<Message> getMessages() { - if (messages == null) { - this.messages = new CopyOnWriteArrayList<Message>(); // prevent null - // pointer - } - - // populate with Conversation (this) - - for (Message msg : messages) { - msg.setConversation(this); - } - return messages; } @@ -165,7 +154,7 @@ public class Conversation extends AbstractEntity { } } - public void setMessages(CopyOnWriteArrayList<Message> msgs) { + public void setMessages(ArrayList<Message> msgs) { this.messages = msgs; } @@ -507,4 +496,17 @@ public class Conversation extends AbstractEntity { } } } + + public void add(Message message) { + message.setConversation(this); + synchronized (this.messages) { + this.messages.add(message); + } + } + + public void addAll(int index, List<Message> messages) { + synchronized (this.messages) { + this.messages.addAll(index, messages); + } + } } diff --git a/src/eu/siacs/conversations/entities/Downloadable.java b/src/eu/siacs/conversations/entities/Downloadable.java index 36584ab0..70516b20 100644 --- a/src/eu/siacs/conversations/entities/Downloadable.java +++ b/src/eu/siacs/conversations/entities/Downloadable.java @@ -11,6 +11,7 @@ public interface Downloadable { public static final int STATUS_OFFER = 0x203; public static final int STATUS_DOWNLOADING = 0x204; public static final int STATUS_DELETED = 0x205; + public static final int STATUS_OFFER_CHECK_FILESIZE = 0x206; public boolean start(); |