fix message archive issues
This commit is contained in:
parent
6770f7de61
commit
5d30742a13
|
@ -471,6 +471,10 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
|
|||
nextCounterpart = counterpart;
|
||||
}
|
||||
|
||||
if (nextCounterpart != null && mXmppConnectionService.checkIsArchived(account, counterpart.asBareJid(), nextCounterpart)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ((body != null || pgpEncrypted != null || (axolotlEncrypted != null && axolotlEncrypted.hasChild("payload")) || oobUrl != null) && !isMucStatusMessage) {
|
||||
final Conversation conversation = mXmppConnectionService.findOrCreateConversation(account, counterpart.asBareJid(), null, conversationIsProbablyMuc, nextCounterpart != null, false, nextCounterpart);
|
||||
final boolean conversationMultiMode = conversation.getMode() == Conversation.MODE_MULTI;
|
||||
|
|
|
@ -182,6 +182,10 @@ public class MessageArchiveService implements OnAdvancedStreamFeaturesLoaded {
|
|||
}
|
||||
|
||||
public Query query(Conversation conversation, MamReference start, long end, boolean allowCatchup) {
|
||||
if (conversation.getNextCounterpart() != null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
synchronized (this.queries) {
|
||||
final Query query;
|
||||
final MamReference startActual = MamReference.max(start, mXmppConnectionService.getAutomaticMessageDeletionDate());
|
||||
|
|
|
@ -2170,9 +2170,7 @@ public class XmppConnectionService extends Service {
|
|||
if (messages.size() > 0) {
|
||||
conversation.addAll(0, messages);
|
||||
callback.onMoreMessagesLoaded(messages.size(), conversation);
|
||||
} else if (
|
||||
conversation.getNextCounterpart() == null
|
||||
&& conversation.hasMessagesLeftOnServer()
|
||||
} else if (conversation.hasMessagesLeftOnServer()
|
||||
&& account.isOnlineAndConnected()
|
||||
&& conversation.getLastClearHistory().getTimestamp() == 0) {
|
||||
final boolean mamAvailable;
|
||||
|
@ -2290,6 +2288,17 @@ public class XmppConnectionService extends Service {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean checkIsArchived(Account account, Jid jid, Jid counterpart) {
|
||||
Conversation conversation = find(account, jid, counterpart);
|
||||
if (conversation != null) {
|
||||
return false;
|
||||
}
|
||||
conversation = databaseBackend.findConversation(account, jid, counterpart);
|
||||
|
||||
return conversation != null && conversation.getStatus() == Conversation.STATUS_ARCHIVED;
|
||||
}
|
||||
|
||||
public Conversation findOrCreateConversation(final Account account, final Jid jid, final MessageArchiveService.Query query, final boolean muc, final boolean joinAfterCreate, final boolean async, Jid counterpart) {
|
||||
synchronized (this.conversations) {
|
||||
Conversation conversation = find(account, jid, counterpart);
|
||||
|
@ -2382,6 +2391,7 @@ public class XmppConnectionService extends Service {
|
|||
synchronized (this.conversations) {
|
||||
getMessageArchiveService().kill(conversation);
|
||||
if (conversation.getMode() == Conversation.MODE_MULTI) {
|
||||
if (conversation.getNextCounterpart() == null) {
|
||||
if (conversation.getAccount().getStatus() == Account.State.ONLINE) {
|
||||
final Bookmark bookmark = conversation.getBookmark();
|
||||
if (maySynchronizeWithBookmarks && bookmark != null && synchronizeWithBookmarks()) {
|
||||
|
@ -2396,6 +2406,7 @@ public class XmppConnectionService extends Service {
|
|||
}
|
||||
}
|
||||
leaveMuc(conversation);
|
||||
}
|
||||
} else {
|
||||
if (conversation.getContact().getOption(Contact.Options.PENDING_SUBSCRIPTION_REQUEST)) {
|
||||
stopPresenceUpdatesTo(conversation.getContact());
|
||||
|
|
Loading…
Reference in a new issue