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

Method requestReactions

Telegram/SourceFiles/api/api_unread_things.cpp:152–187  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

150}
151
152void UnreadThings::requestReactions(
153 not_null<Data::Thread*> thread,
154 int loaded) {
155 if (_reactionsRequests.contains(thread)) {
156 return;
157 }
158 const auto offsetId = loaded
159 ? std::max(thread->unreadReactions().maxLoaded(), MsgId(1))
160 : MsgId(1);
161 const auto limit = loaded ? kNextRequestLimit : kFirstRequestLimit;
162 const auto addOffset = loaded ? -(limit + 1) : -limit;
163 const auto maxId = 0;
164 const auto minId = 0;
165 const auto history = thread->owningHistory();
166 const auto sublist = thread->asSublist();
167 const auto topic = thread->asTopic();
168 using Flag = MTPmessages_GetUnreadReactions::Flag;
169 const auto requestId = _api->request(MTPmessages_GetUnreadReactions(
170 MTP_flags((topic ? Flag::f_top_msg_id : Flag())
171 | (sublist ? Flag::f_saved_peer_id : Flag())),
172 history->peer->input(),
173 MTP_int(topic ? topic->rootId() : 0),
174 (sublist ? sublist->sublistPeer()->input() : MTPInputPeer()),
175 MTP_int(offsetId),
176 MTP_int(addOffset),
177 MTP_int(limit),
178 MTP_int(maxId),
179 MTP_int(minId)
180 )).done([=](const MTPmessages_Messages &result) {
181 _reactionsRequests.remove(thread);
182 thread->unreadReactions().addSlice(result, loaded);
183 }).fail([=] {
184 _reactionsRequests.remove(thread);
185 }).send();
186 _reactionsRequests.emplace(thread, requestId);
187}
188
189void UnreadThings::requestPollVotes(
190 not_null<Data::Thread*> thread,

Callers

nothing calls this directly

Calls 15

MTP_flagsFunction · 0.85
unreadReactionsMethod · 0.80
asSublistMethod · 0.80
asTopicMethod · 0.80
rootIdMethod · 0.80
sublistPeerMethod · 0.80
emplaceMethod · 0.80
MsgIdClass · 0.50
FlagEnum · 0.50
MTP_intFunction · 0.50
containsMethod · 0.45
maxLoadedMethod · 0.45

Tested by

no test coverage detected