fixed bug that prevented newly opened conversations to load the entire history via mam. fixes #1328
This commit is contained in:
parent
8f4b7686c9
commit
b0c19d6bac
|
@ -673,6 +673,10 @@ public class Conversation extends AbstractEntity implements Blockable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void resetLastMessageTransmitted() {
|
||||||
|
this.setAttribute(ATTRIBUTE_LAST_MESSAGE_TRANSMITTED,String.valueOf(-1));
|
||||||
|
}
|
||||||
|
|
||||||
public boolean setLastMessageTransmitted(long value) {
|
public boolean setLastMessageTransmitted(long value) {
|
||||||
long before = getLastMessageTransmitted();
|
long before = getLastMessageTransmitted();
|
||||||
if (value - before > 1000) {
|
if (value - before > 1000) {
|
||||||
|
|
|
@ -68,7 +68,15 @@ public class MessageArchiveService implements OnAdvancedStreamFeaturesLoaded {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Query query(final Conversation conversation) {
|
public Query query(final Conversation conversation) {
|
||||||
return query(conversation,conversation.getAccount().getXmppConnection().getLastSessionEstablished());
|
if (conversation.getLastMessageTransmitted() < 0 && conversation.countMessages() == 0) {
|
||||||
|
return query(conversation,
|
||||||
|
0,
|
||||||
|
System.currentTimeMillis());
|
||||||
|
} else {
|
||||||
|
return query(conversation,
|
||||||
|
conversation.getLastMessageTransmitted(),
|
||||||
|
conversation.getAccount().getXmppConnection().getLastSessionEstablished());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Query query(final Conversation conversation, long end) {
|
public Query query(final Conversation conversation, long end) {
|
||||||
|
|
|
@ -2545,6 +2545,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
|
||||||
public void clearConversationHistory(final Conversation conversation) {
|
public void clearConversationHistory(final Conversation conversation) {
|
||||||
conversation.clearMessages();
|
conversation.clearMessages();
|
||||||
conversation.setHasMessagesLeftOnServer(false); //avoid messages getting loaded through mam
|
conversation.setHasMessagesLeftOnServer(false); //avoid messages getting loaded through mam
|
||||||
|
conversation.resetLastMessageTransmitted();
|
||||||
new Thread(new Runnable() {
|
new Thread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
Loading…
Reference in a new issue