MCPcopy Create free account
hub / github.com/TDesktop-x64/tdesktop / create

Method create

Telegram/SourceFiles/api/api_todo_lists.cpp:36–138  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34}
35
36void TodoLists::create(
37 const TodoListData &data,
38 SendAction action,
39 Fn<void()> done,
40 Fn<void(QString)> fail) {
41 _session->api().sendAction(action);
42
43 const auto history = action.history;
44 const auto peer = history->peer;
45 const auto topicRootId = action.replyTo.messageId
46 ? action.replyTo.topicRootId
47 : 0;
48 const auto monoforumPeerId = action.replyTo.monoforumPeerId;
49 auto sendFlags = MTPmessages_SendMedia::Flags(0);
50 if (action.replyTo) {
51 sendFlags |= MTPmessages_SendMedia::Flag::f_reply_to;
52 }
53 const auto clearCloudDraft = action.clearDraft;
54 if (clearCloudDraft) {
55 sendFlags |= MTPmessages_SendMedia::Flag::f_clear_draft;
56 history->clearLocalDraft(topicRootId, monoforumPeerId);
57 history->clearCloudDraft(topicRootId, monoforumPeerId);
58 history->startSavingCloudDraft(topicRootId, monoforumPeerId);
59 }
60 const auto silentPost = ShouldSendSilent(peer, action.options);
61 const auto starsPaid = std::min(
62 peer->starsPerMessageChecked(),
63 action.options.starsApproved);
64 if (silentPost) {
65 sendFlags |= MTPmessages_SendMedia::Flag::f_silent;
66 }
67 if (action.options.scheduled) {
68 sendFlags |= MTPmessages_SendMedia::Flag::f_schedule_date;
69 if (action.options.scheduleRepeatPeriod) {
70 sendFlags |= MTPmessages_SendMedia::Flag::f_schedule_repeat_period;
71 }
72 }
73 if (action.options.shortcutId) {
74 sendFlags |= MTPmessages_SendMedia::Flag::f_quick_reply_shortcut;
75 }
76 if (action.options.effectId) {
77 sendFlags |= MTPmessages_SendMedia::Flag::f_effect;
78 }
79 if (action.options.suggest) {
80 sendFlags |= MTPmessages_SendMedia::Flag::f_suggested_post;
81 }
82 if (starsPaid) {
83 action.options.starsApproved -= starsPaid;
84 sendFlags |= MTPmessages_SendMedia::Flag::f_allow_paid_stars;
85 }
86 const auto sendAs = action.options.sendAs;
87 if (sendAs) {
88 sendFlags |= MTPmessages_SendMedia::Flag::f_send_as;
89 }
90 auto &histories = history->owner().histories();
91 const auto randomId = base::RandomValue<uint64>();
92 histories.sendPreparedMessage(
93 history,

Callers

nothing calls this directly

Calls 15

ShouldSendSilentFunction · 0.85
MTP_flagsFunction · 0.85
ReplyToPlaceholderClass · 0.85
TodoListDataToInputMediaFunction · 0.85
MTP_stringFunction · 0.85
MTP_longFunction · 0.85
ShortcutIdToMTPFunction · 0.85
SuggestToMTPFunction · 0.85
UnixtimeFromMsgIdFunction · 0.85
sendActionMethod · 0.80
apiMethod · 0.80
clearLocalDraftMethod · 0.80

Tested by

no test coverage detected