解决清除数据库后拉取历史消息时,无法获取自己发送消息问题
This commit is contained in:
@@ -560,9 +560,13 @@ public class MemoryMessagesStore implements IMessagesStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
boolean noRoaming = false;
|
boolean noRoaming = false;
|
||||||
if (pullType == ProtoConstants.PullType.Pull_Normal && fromMessageId == 0 && !IS_MESSAGE_ROAMING) {
|
if (pullType == ProtoConstants.PullType.Pull_Normal && fromMessageId == 0) {
|
||||||
noRoaming = true;
|
if(!IS_MESSAGE_ROAMING) {
|
||||||
|
noRoaming = true;
|
||||||
|
}
|
||||||
|
session.setPullHistoryMsg(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
Map.Entry<Long, Long> entry = maps.higherEntry(current);
|
Map.Entry<Long, Long> entry = maps.higherEntry(current);
|
||||||
if (entry == null) {
|
if (entry == null) {
|
||||||
@@ -574,7 +578,7 @@ public class MemoryMessagesStore implements IMessagesStore {
|
|||||||
MessageBundle bundle = mIMap.get(targetMessageId);
|
MessageBundle bundle = mIMap.get(targetMessageId);
|
||||||
|
|
||||||
if (bundle != null) {
|
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 (pullType == ProtoConstants.PullType.Pull_ChatRoom) {
|
||||||
if (!bundle.getMessage().getConversation().getTarget().equals(chatroomId)) {
|
if (!bundle.getMessage().getConversation().getTarget().equals(chatroomId)) {
|
||||||
@@ -608,6 +612,9 @@ public class MemoryMessagesStore implements IMessagesStore {
|
|||||||
if (lastEntry != null) {
|
if (lastEntry != null) {
|
||||||
head = lastEntry.getKey();
|
head = lastEntry.getKey();
|
||||||
}
|
}
|
||||||
|
if (pullType == ProtoConstants.PullType.Pull_Normal && current == head) {
|
||||||
|
session.setPullHistoryMsg(false);
|
||||||
|
}
|
||||||
} finally {
|
} finally {
|
||||||
mReadLock.unlock();
|
mReadLock.unlock();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,6 +57,8 @@ public class MemorySessionStore implements ISessionsStore {
|
|||||||
|
|
||||||
private int deleted;
|
private int deleted;
|
||||||
|
|
||||||
|
private boolean pullHistoryMsg;
|
||||||
|
|
||||||
public int getDeleted() {
|
public int getDeleted() {
|
||||||
return deleted;
|
return deleted;
|
||||||
}
|
}
|
||||||
@@ -139,6 +141,14 @@ public class MemorySessionStore implements ISessionsStore {
|
|||||||
this.carrierName = carrierName;
|
this.carrierName = carrierName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isPullHistoryMsg() {
|
||||||
|
return pullHistoryMsg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPullHistoryMsg(boolean pullHistoryMsg) {
|
||||||
|
this.pullHistoryMsg = pullHistoryMsg;
|
||||||
|
}
|
||||||
|
|
||||||
public long getUpdateDt() {
|
public long getUpdateDt() {
|
||||||
return updateDt;
|
return updateDt;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user