@@ -1090,21 +1090,21 @@ PollManager::PollOptionVoters &PollManager::get_poll_option_voters(const Poll *p
10901090 return poll_voters[index];
10911091}
10921092
1093- td_api::object_ptr<td_api::messageSenders > PollManager::get_poll_voters_object (
1094- int32 total_count, const vector<DialogId> &voter_dialog_ids ) const {
1095- auto result = td_api::make_object<td_api::messageSenders >();
1093+ td_api::object_ptr<td_api::pollVoters > PollManager::get_poll_voters_object (
1094+ int32 total_count, const vector<std::pair< DialogId, int32>> &voters ) const {
1095+ auto result = td_api::make_object<td_api::pollVoters >();
10961096 result->total_count_ = total_count;
1097- for (auto dialog_id : voter_dialog_ids ) {
1098- auto message_sender = get_min_message_sender_object (td_, dialog_id , " get_poll_voters_object" );
1097+ for (auto &voter : voters ) {
1098+ auto message_sender = get_min_message_sender_object (td_, voter. first , " get_poll_voters_object" );
10991099 if (message_sender != nullptr ) {
1100- result->senders_ .push_back (std::move (message_sender));
1100+ result->voters_ .push_back (td_api::make_object<td_api::pollVoter>( std::move (message_sender), voter. second ));
11011101 }
11021102 }
11031103 return result;
11041104}
11051105
11061106void PollManager::get_poll_voters (PollId poll_id, MessageFullId message_full_id, int32 option_id, int32 offset,
1107- int32 limit, Promise<td_api::object_ptr<td_api::messageSenders >> &&promise) {
1107+ int32 limit, Promise<td_api::object_ptr<td_api::pollVoters >> &&promise) {
11081108 if (is_local_poll_id (poll_id)) {
11091109 return promise.set_error (400 , " Poll results can't be received" );
11101110 }
@@ -1129,27 +1129,27 @@ void PollManager::get_poll_voters(PollId poll_id, MessageFullId message_full_id,
11291129
11301130 auto &voters = get_poll_option_voters (poll, poll_id, option_id);
11311131 if (voters.pending_queries_ .empty () && voters.was_invalidated_ && offset == 0 ) {
1132- voters.voter_dialog_ids_ .clear ();
1132+ voters.voters_ .clear ();
11331133 voters.next_offset_ .clear ();
11341134 voters.was_invalidated_ = false ;
11351135 }
11361136
1137- auto cur_offset = narrow_cast<int32>(voters.voter_dialog_ids_ .size ());
1137+ auto cur_offset = narrow_cast<int32>(voters.voters_ .size ());
11381138
11391139 if (offset > cur_offset) {
11401140 return promise.set_error (400 , " Too big offset specified; voters can be received only consequently" );
11411141 }
11421142 if (offset < cur_offset) {
1143- vector<DialogId> result;
1143+ vector<std::pair< DialogId, int32> > result;
11441144 for (int32 i = offset; i != cur_offset && i - offset < limit; i++) {
1145- result.push_back (voters.voter_dialog_ids_ [i]);
1145+ result.push_back (voters.voters_ [i]);
11461146 }
11471147 return promise.set_value (
11481148 get_poll_voters_object (max (poll->options_ [option_id].voter_count_ , cur_offset), std::move (result)));
11491149 }
11501150
11511151 if (poll->options_ [option_id].voter_count_ == 0 || (voters.next_offset_ .empty () && cur_offset > 0 )) {
1152- return promise.set_value (get_poll_voters_object (0 , vector<DialogId> ()));
1152+ return promise.set_value (get_poll_voters_object (0 , Auto ()));
11531153 }
11541154
11551155 voters.pending_queries_ .push_back (std::move (promise));
@@ -1212,9 +1212,10 @@ void PollManager::on_get_poll_voters(PollId poll_id, int32 option_id, string off
12121212 update_poll_timeout_.set_timeout_in (poll_id.get (), 0.0 );
12131213 }
12141214
1215- vector<DialogId> dialog_ids ;
1215+ vector<std::pair< DialogId, int32>> voter_ids ;
12161216 for (auto &peer_vote : vote_list->votes_ ) {
12171217 DialogId dialog_id;
1218+ int32 date = 0 ;
12181219 switch (peer_vote->get_id ()) {
12191220 case telegram_api::messagePeerVote::ID: {
12201221 auto voter = telegram_api::move_object_as<telegram_api::messagePeerVote>(peer_vote);
@@ -1223,11 +1224,13 @@ void PollManager::on_get_poll_voters(PollId poll_id, int32 option_id, string off
12231224 }
12241225
12251226 dialog_id = DialogId (voter->peer_ );
1227+ date = voter->date_ ;
12261228 break ;
12271229 }
12281230 case telegram_api::messagePeerVoteInputOption::ID: {
12291231 auto voter = telegram_api::move_object_as<telegram_api::messagePeerVoteInputOption>(peer_vote);
12301232 dialog_id = DialogId (voter->peer_ );
1233+ date = voter->date_ ;
12311234 break ;
12321235 }
12331236 case telegram_api::messagePeerVoteMultiple::ID: {
@@ -1237,29 +1240,31 @@ void PollManager::on_get_poll_voters(PollId poll_id, int32 option_id, string off
12371240 }
12381241
12391242 dialog_id = DialogId (voter->peer_ );
1243+ date = voter->date_ ;
12401244 break ;
12411245 }
12421246 default :
12431247 UNREACHABLE ();
12441248 }
12451249 if (dialog_id.is_valid ()) {
1246- dialog_ids. push_back (dialog_id);
1250+ voter_ids. emplace_back (dialog_id, date );
12471251 } else {
12481252 LOG (ERROR) << " Receive " << dialog_id << " as voter in " << poll_id;
12491253 }
12501254 }
1251- append (voters.voter_dialog_ids_ , dialog_ids );
1252- if (static_cast <int32>(dialog_ids .size ()) > limit) {
1253- dialog_ids .resize (limit);
1255+ append (voters.voters_ , voter_ids );
1256+ if (static_cast <int32>(voter_ids .size ()) > limit) {
1257+ voter_ids .resize (limit);
12541258 }
1255- auto known_voter_count = narrow_cast<int32>(voters.voter_dialog_ids_ .size ());
1259+ auto known_voter_count = narrow_cast<int32>(voters.voters_ .size ());
12561260 if (voters.next_offset_ .empty () && known_voter_count != vote_list->count_ ) {
12571261 // invalidate_poll_option_voters(poll, poll_id, option_id);
12581262 voters.was_invalidated_ = true ;
12591263 }
12601264
12611265 for (auto &promise : promises) {
1262- promise.set_value (get_poll_voters_object (max (vote_list->count_ , known_voter_count), vector<DialogId>(dialog_ids)));
1266+ promise.set_value (get_poll_voters_object (max (vote_list->count_ , known_voter_count),
1267+ vector<std::pair<DialogId, int32>>(voter_ids)));
12631268 }
12641269}
12651270
0 commit comments