mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-08-13 15:03:36 +00:00
Cloud stored message drafts support added.
This commit is contained in:
@@ -21,13 +21,31 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||
#include "stdafx.h"
|
||||
#include "data/drafts.h"
|
||||
|
||||
#include "historywidget.h"
|
||||
#include "mainwidget.h"
|
||||
|
||||
namespace Data {
|
||||
namespace {
|
||||
|
||||
} // namespace
|
||||
|
||||
void applyPeerCloudDraft(PeerId peerId, const MTPDdraftMessage &draft) {
|
||||
auto history = App::history(peerId);
|
||||
auto text = qs(draft.vmessage);
|
||||
auto entities = draft.has_entities() ? entitiesFromMTP(draft.ventities.c_vector().v) : EntitiesInText();
|
||||
TextWithTags textWithTags = { textApplyEntities(text, entities), textTagsFromEntities(entities) };
|
||||
MsgId replyTo = draft.has_reply_to_msg_id() ? draft.vreply_to_msg_id.v : 0;
|
||||
auto cloudDraft = std_::make_unique<HistoryDraft>(textWithTags, replyTo, MessageCursor(QFIXED_MAX, QFIXED_MAX, QFIXED_MAX), draft.is_no_webpage());
|
||||
cloudDraft->date = ::date(draft.vdate);
|
||||
|
||||
history->setCloudDraft(std_::move(cloudDraft));
|
||||
history->createLocalDraftFromCloud();
|
||||
history->updateChatListSortPosition();
|
||||
history->updateChatListEntry();
|
||||
|
||||
if (auto main = App::main()) {
|
||||
main->applyCloudDraft(history);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Data
|
||||
|
||||
Reference in New Issue
Block a user