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

Handle ttl_period locally.

This commit is contained in:
John Preston
2021-02-02 20:38:30 +04:00
parent 046a3906c4
commit 6a6e355af4
13 changed files with 282 additions and 69 deletions

View File

@@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "history/history_message.h"
#include "base/openssl_help.h"
#include "base/unixtime.h"
#include "lang/lang_keys.h"
#include "mainwidget.h"
#include "mainwindow.h"
@@ -50,9 +51,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "styles/style_chat.h"
#include "styles/style_window.h"
#include "base/call_delayed.h" // #TODO ttl
#include "base/unixtime.h"
#include <QtGui/QGuiApplication>
#include <QtGui/QClipboard>
@@ -976,6 +974,29 @@ bool HistoryMessage::updateDependencyItem() {
return true;
}
void HistoryMessage::applySentMessage(const MTPDmessage &data) {
HistoryItem::applySentMessage(data);
if (const auto period = data.vttl_period(); period && period->v > 0) {
applyTTL(data.vdate().v + period->v);
} else {
applyTTL(0);
}
}
void HistoryMessage::applySentMessage(
const QString &text,
const MTPDupdateShortSentMessage &data,
bool wasAlready) {
HistoryItem::applySentMessage(text, data, wasAlready);
if (const auto period = data.vttl_period(); period && period->v > 0) {
applyTTL(data.vdate().v + period->v);
} else {
applyTTL(0);
}
}
bool HistoryMessage::allowsForward() const {
if (id < 0 || !isHistoryEntry()) {
return false;