ApiWrap::MessageIds ApiWrap::collectMessageIds(const ReplyToRequests &requests) { MessageIds result; result.reserve(requests.size()); for (ReplyToRequests::const_iterator i = requests.cbegin(), e = requests.cend(); i != e; ++i) { if (i.value().req > 0) continue; result.push_back(MTP_int(i.key())); } return result; }
void ApiWrap::resolveReplyTo() { if (_replyToRequests.isEmpty()) return; QVector<MTPint> ids; ids.reserve(_replyToRequests.size()); for (ReplyToRequests::const_iterator i = _replyToRequests.cbegin(), e = _replyToRequests.cend(); i != e; ++i) { if (!i.value().req) { ids.push_back(MTP_int(i.key())); } } if (!ids.isEmpty()) { mtpRequestId req = MTP::send(MTPmessages_GetMessages(MTP_vector<MTPint>(ids)), rpcDone(&ApiWrap::gotReplyTo)); for (ReplyToRequests::iterator i = _replyToRequests.begin(), e = _replyToRequests.end(); i != e; ++i) { i.value().req = req; } } }