2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 22:46:10 +00:00

Allow sending scheduled messages.

This commit is contained in:
John Preston
2019-08-12 17:33:36 +01:00
parent caef7dde24
commit 03cdddfe18
18 changed files with 336 additions and 180 deletions

View File

@@ -3899,19 +3899,25 @@ void MainWidget::feedUpdate(const MTPUpdate &update) {
const auto &d = update.c_updateMessageID();
const auto randomId = d.vrandom_id().v;
if (const auto id = session().data().messageIdByRandomId(randomId)) {
const auto channel = id.channel;
const auto newId = d.vid().v;
if (const auto local = session().data().message(id)) {
const auto existing = session().data().message(channel, newId);
if (existing && !local->mainView()) {
const auto history = local->history();
local->destroy();
history->requestChatListMessage();
if (local->isScheduled()) {
session().data().scheduledMessages().apply(d, local);
} else {
if (existing) {
existing->destroy();
const auto channel = id.channel;
const auto existing = session().data().message(
channel,
newId);
if (existing && !local->mainView()) {
const auto history = local->history();
local->destroy();
history->requestChatListMessage();
} else {
if (existing) {
existing->destroy();
}
local->setRealId(d.vid().v);
}
local->setRealId(d.vid().v);
}
}
session().data().unregisterMessageRandomId(randomId);