2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 14:45:14 +00:00

Some internal HistoryItem refactoring.

Replace most IsServerMsgId / id <=> 0 with isRegular().
Track isLocal / isHistoryEntry in flags.
Remove toHistoryMessage.
This commit is contained in:
John Preston
2021-11-07 12:06:00 +04:00
parent 22b37c4bf8
commit c534f3f22e
52 changed files with 460 additions and 524 deletions

View File

@@ -114,7 +114,7 @@ EmojiPtr EmojiInteractions::chooseInteractionEmoji(
void EmojiInteractions::startOutgoing(
not_null<const HistoryView::Element*> view) {
const auto item = view->data();
if (!IsServerMsgId(item->id) || !item->history()->peer->isUser()) {
if (!item->isRegular() || !item->history()->peer->isUser()) {
return;
}
const auto emoticon = item->originalText().text;
@@ -161,13 +161,11 @@ void EmojiInteractions::startIncoming(
MsgId messageId,
const QString &emoticon,
EmojiInteractionsBunch &&bunch) {
if (!peer->isUser()
|| bunch.interactions.empty()
|| !IsServerMsgId(messageId)) {
if (!peer->isUser() || bunch.interactions.empty()) {
return;
}
const auto item = _session->data().message(nullptr, messageId);
if (!item) {
if (!item || !item->isRegular()) {
return;
}
const auto emoji = chooseInteractionEmoji(item);