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

Method create

Telegram/SourceFiles/api/api_polls.cpp:220–328  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

218}
219
220void Polls::create(
221 const PollData &data,
222 const TextWithEntities &text,
223 SendAction action,
224 Fn<void()> done,
225 Fn<void(bool fileReferenceExpired)> fail) {
226 _session->api().sendAction(action);
227
228 const auto history = action.history;
229 const auto peer = history->peer;
230 const auto topicRootId = action.replyTo.messageId
231 ? action.replyTo.topicRootId
232 : 0;
233 const auto monoforumPeerId = action.replyTo.monoforumPeerId;
234 auto sendFlags = MTPmessages_SendMedia::Flags(0);
235 if (action.replyTo) {
236 sendFlags |= MTPmessages_SendMedia::Flag::f_reply_to;
237 }
238 const auto clearCloudDraft = action.clearDraft;
239 if (clearCloudDraft) {
240 sendFlags |= MTPmessages_SendMedia::Flag::f_clear_draft;
241 history->clearLocalDraft(topicRootId, monoforumPeerId);
242 history->clearCloudDraft(topicRootId, monoforumPeerId);
243 history->startSavingCloudDraft(topicRootId, monoforumPeerId);
244 }
245 const auto silentPost = ShouldSendSilent(peer, action.options);
246 const auto starsPaid = std::min(
247 peer->starsPerMessageChecked(),
248 action.options.starsApproved);
249 if (silentPost) {
250 sendFlags |= MTPmessages_SendMedia::Flag::f_silent;
251 }
252 if (action.options.scheduled) {
253 sendFlags |= MTPmessages_SendMedia::Flag::f_schedule_date;
254 if (action.options.scheduleRepeatPeriod) {
255 sendFlags |= MTPmessages_SendMedia::Flag::f_schedule_repeat_period;
256 }
257 }
258 if (action.options.shortcutId) {
259 sendFlags |= MTPmessages_SendMedia::Flag::f_quick_reply_shortcut;
260 }
261 if (action.options.effectId) {
262 sendFlags |= MTPmessages_SendMedia::Flag::f_effect;
263 }
264 if (action.options.suggest) {
265 sendFlags |= MTPmessages_SendMedia::Flag::f_suggested_post;
266 }
267 if (starsPaid) {
268 action.options.starsApproved -= starsPaid;
269 sendFlags |= MTPmessages_SendMedia::Flag::f_allow_paid_stars;
270 }
271 const auto sendAs = action.options.sendAs;
272 if (sendAs) {
273 sendFlags |= MTPmessages_SendMedia::Flag::f_send_as;
274 }
275 auto sentEntities = Api::EntitiesToMTP(
276 _session,
277 text.entities,

Callers 9

initResetScaleButtonMethod · 0.45
refreshTitleWidgetMethod · 0.45
PaintBackgroundMethod · 0.45
cacheChatThemeMethod · 0.45
PeerMenuCreatePollFunction · 0.45
PeerMenuCreateTodoListFunction · 0.45
updateGeometryMethod · 0.45
showReplyFieldMethod · 0.45
recreateRowsMethod · 0.45

Calls 15

ShouldSendSilentFunction · 0.85
EntitiesToMTPFunction · 0.85
MTP_flagsFunction · 0.85
ReplyToPlaceholderClass · 0.85
PollDataToInputMediaFunction · 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

Tested by

no test coverage detected