Update message index map after message exchange, fixes #407
This commit is contained in:
parent
9339a2cdf5
commit
29719c0764
1 changed files with 3 additions and 1 deletions
|
@ -520,6 +520,8 @@ void ChatModel::handleMessageSendSucceeded(qlonglong messageId, qlonglong oldMes
|
||||||
MessageData* oldMessage = messages.at(pos);
|
MessageData* oldMessage = messages.at(pos);
|
||||||
MessageData* newMessage = new MessageData(message, messageId);
|
MessageData* newMessage = new MessageData(message, messageId);
|
||||||
messages.replace(pos, newMessage);
|
messages.replace(pos, newMessage);
|
||||||
|
messageIndexMap.remove(oldMessageId);
|
||||||
|
messageIndexMap.insert(messageId, pos);
|
||||||
const QVector<int> changedRoles(newMessage->diff(oldMessage));
|
const QVector<int> changedRoles(newMessage->diff(oldMessage));
|
||||||
delete oldMessage;
|
delete oldMessage;
|
||||||
LOG("Message was replaced at index" << pos);
|
LOG("Message was replaced at index" << pos);
|
||||||
|
@ -766,7 +768,7 @@ int ChatModel::calculateLastKnownMessageId()
|
||||||
}
|
}
|
||||||
LOG("Last known message is at position" << listInboxPosition);
|
LOG("Last known message is at position" << listInboxPosition);
|
||||||
LOG("Last own message is at position" << listOwnPosition);
|
LOG("Last own message is at position" << listOwnPosition);
|
||||||
return (listInboxPosition > listOwnPosition) ? listInboxPosition : listOwnPosition ;
|
return (listInboxPosition > listOwnPosition) ? listInboxPosition : listOwnPosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ChatModel::calculateLastReadSentMessageId()
|
int ChatModel::calculateLastReadSentMessageId()
|
||||||
|
|
Loading…
Reference in a new issue