Restore search in chats

This commit is contained in:
Sebastian Wolf 2023-11-20 21:27:55 +01:00
parent acfcfd3ca4
commit 8d59ee4c00
No known key found for this signature in database
GPG key ID: CEA9522B5F38A90A
3 changed files with 11 additions and 0 deletions

View file

@ -133,8 +133,10 @@ ListItem {
if (messageListItem.messageReactions) { if (messageListItem.messageReactions) {
messageListItem.messageReactions = null; messageListItem.messageReactions = null;
} else if (messageListItem.chatReactions) { } else if (messageListItem.chatReactions) {
Debug.log("Using chat reactions")
messageListItem.messageReactions = chatReactions messageListItem.messageReactions = chatReactions
} else { } else {
Debug.log("Obtaining message reactions")
tdLibWrapper.getMessageAvailableReactions(messageListItem.chatId, messageListItem.messageId); tdLibWrapper.getMessageAvailableReactions(messageListItem.chatId, messageListItem.messageId);
} }
} }

View file

@ -127,6 +127,7 @@ TDLibReceiver::TDLibReceiver(void *tdLibClient, QObject *parent) : QThread(paren
handlers.insert("updateSupergroup", &TDLibReceiver::processUpdateSuperGroup); handlers.insert("updateSupergroup", &TDLibReceiver::processUpdateSuperGroup);
handlers.insert("updateChatOnlineMemberCount", &TDLibReceiver::processChatOnlineMemberCountUpdated); handlers.insert("updateChatOnlineMemberCount", &TDLibReceiver::processChatOnlineMemberCountUpdated);
handlers.insert("messages", &TDLibReceiver::processMessages); handlers.insert("messages", &TDLibReceiver::processMessages);
handlers.insert("foundChatMessages", &TDLibReceiver::processFoundChatMessages);
handlers.insert("sponsoredMessage", &TDLibReceiver::processSponsoredMessage); // TdLib <= 1.8.7 handlers.insert("sponsoredMessage", &TDLibReceiver::processSponsoredMessage); // TdLib <= 1.8.7
handlers.insert("sponsoredMessages", &TDLibReceiver::processSponsoredMessages); // TdLib >= 1.8.8 handlers.insert("sponsoredMessages", &TDLibReceiver::processSponsoredMessages); // TdLib >= 1.8.8
handlers.insert("updateNewMessage", &TDLibReceiver::processUpdateNewMessage); handlers.insert("updateNewMessage", &TDLibReceiver::processUpdateNewMessage);
@ -390,6 +391,13 @@ void TDLibReceiver::processMessages(const QVariantMap &receivedInformation)
emit messagesReceived(cleanupList(receivedInformation.value(MESSAGES).toList()), total_count); emit messagesReceived(cleanupList(receivedInformation.value(MESSAGES).toList()), total_count);
} }
void TDLibReceiver::processFoundChatMessages(const QVariantMap &receivedInformation)
{
const int total_count = receivedInformation.value(TOTAL_COUNT).toInt();
LOG("Received found chat messages, amount: " << total_count);
emit messagesReceived(cleanupList(receivedInformation.value(MESSAGES).toList()), total_count);
}
void TDLibReceiver::processSponsoredMessage(const QVariantMap &receivedInformation) void TDLibReceiver::processSponsoredMessage(const QVariantMap &receivedInformation)
{ {
// TdLib <= 1.8.7 // TdLib <= 1.8.7

View file

@ -139,6 +139,7 @@ private:
void processUpdateSuperGroup(const QVariantMap &receivedInformation); void processUpdateSuperGroup(const QVariantMap &receivedInformation);
void processChatOnlineMemberCountUpdated(const QVariantMap &receivedInformation); void processChatOnlineMemberCountUpdated(const QVariantMap &receivedInformation);
void processMessages(const QVariantMap &receivedInformation); void processMessages(const QVariantMap &receivedInformation);
void processFoundChatMessages(const QVariantMap &receivedInformation);
void processSponsoredMessage(const QVariantMap &receivedInformation); void processSponsoredMessage(const QVariantMap &receivedInformation);
void processSponsoredMessages(const QVariantMap &receivedInformation); void processSponsoredMessages(const QVariantMap &receivedInformation);
void processUpdateNewMessage(const QVariantMap &receivedInformation); void processUpdateNewMessage(const QVariantMap &receivedInformation);