Get available message reactions
This commit is contained in:
parent
4445be3302
commit
6d6b07b9a9
5 changed files with 34 additions and 2 deletions
|
@ -105,6 +105,7 @@ ListItem {
|
||||||
} else if (webPagePreviewLoader.item) {
|
} else if (webPagePreviewLoader.item) {
|
||||||
webPagePreviewLoader.item.clicked()
|
webPagePreviewLoader.item.clicked()
|
||||||
}
|
}
|
||||||
|
tdLibWrapper.getMessageAvailableReactions(messageListItem.chatId, messageListItem.messageId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -224,6 +225,11 @@ ListItem {
|
||||||
messageInReplyToLoader.inReplyToMessageDeleted = true;
|
messageInReplyToLoader.inReplyToMessageDeleted = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
onAvailableReactionsReceived: {
|
||||||
|
if (messageListItem.messageId === messageId) {
|
||||||
|
Debug.log("Available reactions for this message: " + reactions);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
|
|
|
@ -162,6 +162,7 @@ TDLibReceiver::TDLibReceiver(void *tdLibClient, QObject *parent) : QThread(paren
|
||||||
handlers.insert("updateUserPrivacySettingRules", &TDLibReceiver::processUpdateUserPrivacySettingRules);
|
handlers.insert("updateUserPrivacySettingRules", &TDLibReceiver::processUpdateUserPrivacySettingRules);
|
||||||
handlers.insert("updateMessageInteractionInfo", &TDLibReceiver::processUpdateMessageInteractionInfo);
|
handlers.insert("updateMessageInteractionInfo", &TDLibReceiver::processUpdateMessageInteractionInfo);
|
||||||
handlers.insert("sessions", &TDLibReceiver::processSessions);
|
handlers.insert("sessions", &TDLibReceiver::processSessions);
|
||||||
|
handlers.insert("availableReactions", &TDLibReceiver::processAvailableReactions);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TDLibReceiver::setActive(bool active)
|
void TDLibReceiver::setActive(bool active)
|
||||||
|
@ -688,6 +689,15 @@ void TDLibReceiver::processSessions(const QVariantMap &receivedInformation)
|
||||||
emit sessionsReceived(sessions);
|
emit sessionsReceived(sessions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TDLibReceiver::processAvailableReactions(const QVariantMap &receivedInformation)
|
||||||
|
{
|
||||||
|
const qlonglong messageId = receivedInformation.value(_EXTRA).toLongLong();
|
||||||
|
const QStringList reactions = receivedInformation.value("reactions").toStringList();
|
||||||
|
if (!reactions.isEmpty()) {
|
||||||
|
emit availableReactionsReceived(messageId, reactions);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Recursively removes (some) unused entries from QVariantMaps to reduce
|
// Recursively removes (some) unused entries from QVariantMaps to reduce
|
||||||
// memory usage. QStrings allocated by QVariantMaps are the top consumers
|
// memory usage. QStrings allocated by QVariantMaps are the top consumers
|
||||||
// of memory. The biggest saving is achieved by removing "outline" from
|
// of memory. The biggest saving is achieved by removing "outline" from
|
||||||
|
|
|
@ -102,6 +102,7 @@ signals:
|
||||||
void messageInteractionInfoUpdated(qlonglong chatId, qlonglong messageId, const QVariantMap &updatedInfo);
|
void messageInteractionInfoUpdated(qlonglong chatId, qlonglong messageId, const QVariantMap &updatedInfo);
|
||||||
void okReceived(const QString &request);
|
void okReceived(const QString &request);
|
||||||
void sessionsReceived(const QVariantList &sessions);
|
void sessionsReceived(const QVariantList &sessions);
|
||||||
|
void availableReactionsReceived(qlonglong messageId, const QStringList &reactions);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef void (TDLibReceiver::*Handler)(const QVariantMap &);
|
typedef void (TDLibReceiver::*Handler)(const QVariantMap &);
|
||||||
|
@ -180,6 +181,7 @@ private:
|
||||||
void processUpdateUserPrivacySettingRules(const QVariantMap &receivedInformation);
|
void processUpdateUserPrivacySettingRules(const QVariantMap &receivedInformation);
|
||||||
void processUpdateMessageInteractionInfo(const QVariantMap &receivedInformation);
|
void processUpdateMessageInteractionInfo(const QVariantMap &receivedInformation);
|
||||||
void processSessions(const QVariantMap &receivedInformation);
|
void processSessions(const QVariantMap &receivedInformation);
|
||||||
|
void processAvailableReactions(const QVariantMap &receivedInformation);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TDLIBRECEIVER_H
|
#endif // TDLIBRECEIVER_H
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (C) 2020 Sebastian J. Wolf and other contributors
|
Copyright (C) 2020-22 Sebastian J. Wolf and other contributors
|
||||||
|
|
||||||
This file is part of Fernschreiber.
|
This file is part of Fernschreiber.
|
||||||
|
|
||||||
|
@ -165,6 +165,7 @@ void TDLibWrapper::initializeTDLibReceiver() {
|
||||||
connect(this->tdLibReceiver, SIGNAL(messageInteractionInfoUpdated(qlonglong, qlonglong, QVariantMap)), this, SIGNAL(messageInteractionInfoUpdated(qlonglong, qlonglong, QVariantMap)));
|
connect(this->tdLibReceiver, SIGNAL(messageInteractionInfoUpdated(qlonglong, qlonglong, QVariantMap)), this, SIGNAL(messageInteractionInfoUpdated(qlonglong, qlonglong, QVariantMap)));
|
||||||
connect(this->tdLibReceiver, SIGNAL(okReceived(QString)), this, SIGNAL(okReceived(QString)));
|
connect(this->tdLibReceiver, SIGNAL(okReceived(QString)), this, SIGNAL(okReceived(QString)));
|
||||||
connect(this->tdLibReceiver, SIGNAL(sessionsReceived(QVariantList)), this, SIGNAL(sessionsReceived(QVariantList)));
|
connect(this->tdLibReceiver, SIGNAL(sessionsReceived(QVariantList)), this, SIGNAL(sessionsReceived(QVariantList)));
|
||||||
|
connect(this->tdLibReceiver, SIGNAL(availableReactionsReceived(qlonglong, QStringList)), this, SIGNAL(availableReactionsReceived(qlonglong, QStringList)));
|
||||||
|
|
||||||
this->tdLibReceiver->start();
|
this->tdLibReceiver->start();
|
||||||
}
|
}
|
||||||
|
@ -1394,6 +1395,17 @@ void TDLibWrapper::terminateSession(const QString &sessionId)
|
||||||
this->sendRequest(requestObject);
|
this->sendRequest(requestObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TDLibWrapper::getMessageAvailableReactions(qlonglong chatId, qlonglong messageId)
|
||||||
|
{
|
||||||
|
LOG("Get available reactions for message" << chatId << messageId);
|
||||||
|
QVariantMap requestObject;
|
||||||
|
requestObject.insert(_TYPE, "getMessageAvailableReactions");
|
||||||
|
requestObject.insert(_EXTRA, QString::number(messageId));
|
||||||
|
requestObject.insert("chat_id", chatId);
|
||||||
|
requestObject.insert("message_id", messageId);
|
||||||
|
this->sendRequest(requestObject);
|
||||||
|
}
|
||||||
|
|
||||||
void TDLibWrapper::searchEmoji(const QString &queryString)
|
void TDLibWrapper::searchEmoji(const QString &queryString)
|
||||||
{
|
{
|
||||||
LOG("Searching emoji" << queryString);
|
LOG("Searching emoji" << queryString);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (C) 2020 Sebastian J. Wolf and other contributors
|
Copyright (C) 2020-22 Sebastian J. Wolf and other contributors
|
||||||
|
|
||||||
This file is part of Fernschreiber.
|
This file is part of Fernschreiber.
|
||||||
|
|
||||||
|
@ -230,6 +230,7 @@ public:
|
||||||
Q_INVOKABLE void changeStickerSet(const QString &stickerSetId, bool isInstalled);
|
Q_INVOKABLE void changeStickerSet(const QString &stickerSetId, bool isInstalled);
|
||||||
Q_INVOKABLE void getActiveSessions();
|
Q_INVOKABLE void getActiveSessions();
|
||||||
Q_INVOKABLE void terminateSession(const QString &sessionId);
|
Q_INVOKABLE void terminateSession(const QString &sessionId);
|
||||||
|
Q_INVOKABLE void getMessageAvailableReactions(qlonglong chatId, qlonglong messageId);
|
||||||
|
|
||||||
// Others (candidates for extraction ;))
|
// Others (candidates for extraction ;))
|
||||||
Q_INVOKABLE void searchEmoji(const QString &queryString);
|
Q_INVOKABLE void searchEmoji(const QString &queryString);
|
||||||
|
@ -312,6 +313,7 @@ signals:
|
||||||
void okReceived(const QString &request);
|
void okReceived(const QString &request);
|
||||||
void sessionsReceived(const QVariantList &sessions);
|
void sessionsReceived(const QVariantList &sessions);
|
||||||
void openFileExternally(const QString &filePath);
|
void openFileExternally(const QString &filePath);
|
||||||
|
void availableReactionsReceived(qlonglong messageId, const QStringList &reactions);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void handleVersionDetected(const QString &version);
|
void handleVersionDetected(const QString &version);
|
||||||
|
|
Loading…
Reference in a new issue