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

Method add

Telegram/SourceFiles/api/api_todo_lists.cpp:157–180  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

155}
156
157void TodoLists::add(
158 not_null<HistoryItem*> item,
159 const std::vector<TodoListItem> &items,
160 Fn<void()> done,
161 Fn<void(QString)> fail) {
162 if (items.empty()) {
163 return;
164 }
165 const auto session = _session;
166 _session->api().request(MTPmessages_AppendTodoList(
167 item->history()->peer->input(),
168 MTP_int(item->id.bare),
169 TodoListItemsToMTP(&item->history()->session(), items)
170 )).done([=](const MTPUpdates &result) {
171 session->api().applyUpdates(result);
172 if (const auto onstack = done) {
173 onstack();
174 }
175 }).fail([=](const MTP::Error &error) {
176 if (const auto onstack = fail) {
177 onstack(error.type());
178 }
179 }).send();
180}
181
182void TodoLists::toggleCompletion(FullMsgId itemId, int id, bool completed) {
183 auto &entry = _toggles[itemId];

Callers 8

ConfirmSubscriptionBoxFunction · 0.45
ConfirmInviteBoxFunction · 0.45
clearMethod · 0.45
readyMethod · 0.45
requestUserPhotosMethod · 0.45
rightActionAddRippleMethod · 0.45
setupAboveWidgetMethod · 0.45
setupBelowWidgetMethod · 0.45

Calls 13

TodoListItemsToMTPFunction · 0.85
apiMethod · 0.80
MTP_intFunction · 0.50
emptyMethod · 0.45
sendMethod · 0.45
failMethod · 0.45
doneMethod · 0.45
requestMethod · 0.45
inputMethod · 0.45
historyMethod · 0.45
sessionMethod · 0.45
applyUpdatesMethod · 0.45

Tested by

no test coverage detected