prepend instead off append mam messages to conversations when going in reverse

This commit is contained in:
Daniel Gultsch 2016-02-04 16:40:18 +01:00
parent 28733e052f
commit 91ec4839ac
2 changed files with 13 additions and 2 deletions

View file

@ -814,6 +814,13 @@ public class Conversation extends AbstractEntity implements Blockable {
}
}
public void prepend(Message message) {
message.setConversation(this);
synchronized (this.messages) {
this.messages.add(0,message);
}
}
public void addAll(int index, List<Message> messages) {
synchronized (this.messages) {
this.messages.addAll(index, messages);

View file

@ -398,7 +398,11 @@ public class MessageParser extends AbstractParser implements
return;
}
if (query != null && query.getPagingOrder() == MessageArchiveService.PagingOrder.REVERSE) {
conversation.prepend(message);
} else {
conversation.add(message);
}
if (query == null || query.getWith() == null) { //either no mam or catchup
if (status == Message.STATUS_SEND || status == Message.STATUS_SEND_RECEIVED) {