解决清除数据库后拉取历史消息时,无法获取自己发送消息问题

This commit is contained in:
imhao183
2020-12-31 20:14:23 +08:00
parent c63cc74028
commit 772940e50d
2 changed files with 20 additions and 3 deletions
@@ -560,9 +560,13 @@ public class MemoryMessagesStore implements IMessagesStore {
}
boolean noRoaming = false;
if (pullType == ProtoConstants.PullType.Pull_Normal && fromMessageId == 0 && !IS_MESSAGE_ROAMING) {
noRoaming = true;
if (pullType == ProtoConstants.PullType.Pull_Normal && fromMessageId == 0) {
if(!IS_MESSAGE_ROAMING) {
noRoaming = true;
}
session.setPullHistoryMsg(true);
}
while (true) {
Map.Entry<Long, Long> entry = maps.higherEntry(current);
if (entry == null) {
@@ -574,7 +578,7 @@ public class MemoryMessagesStore implements IMessagesStore {
MessageBundle bundle = mIMap.get(targetMessageId);
if (bundle != null) {
if (exceptClientId == null || !exceptClientId.equals(bundle.getFromClientId()) || !user.equals(bundle.getFromUser())) {
if (exceptClientId == null || session.isPullHistoryMsg() || !exceptClientId.equals(bundle.getFromClientId()) || !user.equals(bundle.getFromUser())) {
if (pullType == ProtoConstants.PullType.Pull_ChatRoom) {
if (!bundle.getMessage().getConversation().getTarget().equals(chatroomId)) {
@@ -608,6 +612,9 @@ public class MemoryMessagesStore implements IMessagesStore {
if (lastEntry != null) {
head = lastEntry.getKey();
}
if (pullType == ProtoConstants.PullType.Pull_Normal && current == head) {
session.setPullHistoryMsg(false);
}
} finally {
mReadLock.unlock();
}
@@ -57,6 +57,8 @@ public class MemorySessionStore implements ISessionsStore {
private int deleted;
private boolean pullHistoryMsg;
public int getDeleted() {
return deleted;
}
@@ -139,6 +141,14 @@ public class MemorySessionStore implements ISessionsStore {
this.carrierName = carrierName;
}
public boolean isPullHistoryMsg() {
return pullHistoryMsg;
}
public void setPullHistoryMsg(boolean pullHistoryMsg) {
this.pullHistoryMsg = pullHistoryMsg;
}
public long getUpdateDt() {
return updateDt;
}