Add source to get_*_id_object.

GitOrigin-RevId: 4d3016274a22be4a59ee088ad6f3d9c297128a08
This commit is contained in:
levlam 2018-02-03 02:05:11 +03:00
parent c9c1586d0a
commit a9ed429205
9 changed files with 131 additions and 103 deletions

View File

@ -565,7 +565,7 @@ void CallActor::flush_call_state() {
call_state_need_flush_ = false;
// can't call const function
// send_closure(G()->contacts_manager(), &ContactsManager::get_user_id_object, user_id_);
// send_closure(G()->contacts_manager(), &ContactsManager::get_user_id_object, user_id_, "flush_call_state");
send_closure(G()->td(), &Td::send_update,
make_tl_object<td_api::updateCall>(
make_tl_object<td_api::call>(local_call_id_.get(), is_outgoing_ ? user_id_.get() : call_admin_id_,

View File

@ -177,10 +177,11 @@ void CallbackQueriesManager::on_new_query(int32 flags, int64 callback_query_id,
}
td_->messages_manager_->force_create_dialog(dialog_id, "on_new_callback_query");
send_closure(G()->td(), &Td::send_update,
make_tl_object<td_api::updateNewCallbackQuery>(
callback_query_id, td_->contacts_manager_->get_user_id_object(sender_user_id), dialog_id.get(),
message_id.get(), chat_instance, std::move(payload)));
send_closure(
G()->td(), &Td::send_update,
make_tl_object<td_api::updateNewCallbackQuery>(
callback_query_id, td_->contacts_manager_->get_user_id_object(sender_user_id, "updateNewCallbackQuery"),
dialog_id.get(), message_id.get(), chat_instance, std::move(payload)));
}
void CallbackQueriesManager::on_new_inline_query(
@ -202,11 +203,12 @@ void CallbackQueriesManager::on_new_inline_query(
if (payload == nullptr) {
return;
}
send_closure(G()->td(), &Td::send_update,
make_tl_object<td_api::updateNewInlineCallbackQuery>(
callback_query_id, td_->contacts_manager_->get_user_id_object(sender_user_id),
InlineQueriesManager::get_inline_message_id(std::move(inline_message_id)), chat_instance,
std::move(payload)));
send_closure(
G()->td(), &Td::send_update,
make_tl_object<td_api::updateNewInlineCallbackQuery>(
callback_query_id, td_->contacts_manager_->get_user_id_object(sender_user_id, "updateNewInlineCallbackQuery"),
InlineQueriesManager::get_inline_message_id(std::move(inline_message_id)), chat_instance,
std::move(payload)));
}
int64 CallbackQueriesManager::send_callback_query(FullMessageId full_message_id,

View File

@ -3243,7 +3243,7 @@ void ContactsManager::on_load_imported_contacts_finished() {
LOG(INFO) << "Finished to load " << all_imported_contacts_.size() << " imported contacts";
for (const auto &contact : all_imported_contacts_) {
get_user_id_object(contact.get_user_id()); // to ensure updateUser
get_user_id_object(contact.get_user_id(), "on_load_imported_contacts_finished"); // to ensure updateUser
}
are_imported_contacts_loaded_ = true;
@ -4328,7 +4328,7 @@ void ContactsManager::on_imported_contacts(int64 random_id, vector<UserId> impor
std::unordered_map<size_t, int32> unique_id_to_unimported_contact_invites;
for (size_t i = 0; i < add_size; i++) {
auto unique_id = imported_contacts_pos_[i];
get_user_id_object(imported_contact_user_ids[i]); // to ensure updateUser
get_user_id_object(imported_contact_user_ids[i], "on_imported_contacts"); // to ensure updateUser
all_imported_contacts_[unique_id].set_user_id(imported_contact_user_ids[i]);
unique_id_to_unimported_contact_invites[unique_id] = unimported_contact_invites[i];
}
@ -5823,7 +5823,7 @@ void ContactsManager::update_user_full(UserFull *user_full, UserId user_id) {
user_full->is_changed = false;
if (user_full->is_inited) {
send_closure(G()->td(), &Td::send_update,
make_tl_object<td_api::updateUserFullInfo>(get_user_id_object(user_id),
make_tl_object<td_api::updateUserFullInfo>(get_user_id_object(user_id, "updateUserFullInfo"),
get_user_full_info_object(user_id, user_full)));
}
}
@ -5841,9 +5841,10 @@ void ContactsManager::update_chat_full(ChatFull *chat_full, ChatId chat_id) {
on_update_dialog_administrators(DialogId(chat_id), std::move(administrator_user_ids), chat_full->version != -1);
chat_full->is_changed = false;
send_closure(G()->td(), &Td::send_update,
make_tl_object<td_api::updateBasicGroupFullInfo>(get_basic_group_id_object(chat_id),
get_basic_group_full_info_object(chat_full)));
send_closure(
G()->td(), &Td::send_update,
make_tl_object<td_api::updateBasicGroupFullInfo>(get_basic_group_id_object(chat_id, "update_chat_full"),
get_basic_group_full_info_object(chat_full)));
}
}
@ -5854,9 +5855,10 @@ void ContactsManager::update_channel_full(ChannelFull *channel_full, ChannelId c
channel_full->administrator_count = channel_full->participant_count;
}
channel_full->is_changed = false;
send_closure(G()->td(), &Td::send_update,
make_tl_object<td_api::updateSupergroupFullInfo>(get_supergroup_id_object(channel_id),
get_channel_full_info_object(channel_full)));
send_closure(
G()->td(), &Td::send_update,
make_tl_object<td_api::updateSupergroupFullInfo>(get_supergroup_id_object(channel_id, "update_channel_full"),
get_channel_full_info_object(channel_full)));
}
}
@ -6604,7 +6606,8 @@ tl_object_ptr<td_api::chatMember> ContactsManager::get_chat_member_object(
const DialogParticipant &dialog_participant) const {
UserId participant_user_id = dialog_participant.user_id;
return make_tl_object<td_api::chatMember>(
get_user_id_object(participant_user_id), get_user_id_object(dialog_participant.inviter_user_id),
get_user_id_object(participant_user_id, "chatMember.user_id"),
get_user_id_object(dialog_participant.inviter_user_id, "chatMember.inviter_user_id"),
dialog_participant.joined_date, dialog_participant.status.get_chat_member_status_object(),
get_bot_info_object(participant_user_id));
}
@ -8948,9 +8951,9 @@ tl_object_ptr<td_api::UserStatus> ContactsManager::get_user_status_object(const
}
}
int32 ContactsManager::get_user_id_object(UserId user_id) const {
int32 ContactsManager::get_user_id_object(UserId user_id, const char *source) const {
if (user_id.is_valid() && get_user(user_id) == nullptr && unknown_users_.count(user_id) == 0) {
LOG(ERROR) << "Have no info about " << user_id;
LOG(ERROR) << "Have no info about " << user_id << " from " << source;
unknown_users_.insert(user_id);
send_closure(G()->td(), &Td::send_update,
td_api::make_object<td_api::updateUser>(td_api::make_object<td_api::user>(
@ -8988,7 +8991,7 @@ tl_object_ptr<td_api::user> ContactsManager::get_user_object(UserId user_id, con
}
vector<int32> ContactsManager::get_user_ids_object(const vector<UserId> &user_ids) const {
return transform(user_ids, [this](UserId user_id) { return get_user_id_object(user_id); });
return transform(user_ids, [this](UserId user_id) { return get_user_id_object(user_id, "get_user_ids_object"); });
}
tl_object_ptr<td_api::users> ContactsManager::get_users_object(int32 total_count,
@ -9013,9 +9016,9 @@ tl_object_ptr<td_api::userFullInfo> ContactsManager::get_user_full_info_object(U
get_bot_info_object(user_full->bot_info.get()));
}
int32 ContactsManager::get_basic_group_id_object(ChatId chat_id) const {
int32 ContactsManager::get_basic_group_id_object(ChatId chat_id, const char *source) const {
if (chat_id.is_valid() && get_chat(chat_id) == nullptr && unknown_chats_.count(chat_id) == 0) {
LOG(ERROR) << "Have no info about " << chat_id;
LOG(ERROR) << "Have no info about " << chat_id << " from " << source;
unknown_chats_.insert(chat_id);
send_closure(
G()->td(), &Td::send_update,
@ -9035,7 +9038,8 @@ tl_object_ptr<td_api::basicGroup> ContactsManager::get_basic_group_object(ChatId
}
return make_tl_object<td_api::basicGroup>(
chat_id.get(), chat->participant_count, get_chat_status(chat).get_chat_member_status_object(),
chat->everyone_is_administrator, chat->is_active, get_supergroup_id_object(chat->migrated_to_channel_id));
chat->everyone_is_administrator, chat->is_active,
get_supergroup_id_object(chat->migrated_to_channel_id, "get_basic_group_object"));
}
tl_object_ptr<td_api::basicGroupFullInfo> ContactsManager::get_basic_group_full_info_object(ChatId chat_id) const {
@ -9046,15 +9050,15 @@ tl_object_ptr<td_api::basicGroupFullInfo> ContactsManager::get_basic_group_full_
const ChatFull *chat_full) const {
CHECK(chat_full != nullptr);
return make_tl_object<td_api::basicGroupFullInfo>(
get_user_id_object(chat_full->creator_user_id),
get_user_id_object(chat_full->creator_user_id, "basicGroupFullInfo"),
transform(chat_full->participants,
[this](const DialogParticipant &chat_participant) { return get_chat_member_object(chat_participant); }),
chat_full->invite_link);
}
int32 ContactsManager::get_supergroup_id_object(ChannelId channel_id) const {
int32 ContactsManager::get_supergroup_id_object(ChannelId channel_id, const char *source) const {
if (channel_id.is_valid() && get_channel(channel_id) == nullptr && unknown_channels_.count(channel_id) == 0) {
LOG(ERROR) << "Have no info about " << channel_id;
LOG(ERROR) << "Have no info about " << channel_id << " received from " << source;
unknown_channels_.insert(channel_id);
send_closure(G()->td(), &Td::send_update,
td_api::make_object<td_api::updateSupergroup>(td_api::make_object<td_api::supergroup>(
@ -9091,7 +9095,8 @@ tl_object_ptr<td_api::supergroupFullInfo> ContactsManager::get_channel_full_info
channel_full->restricted_count, channel_full->banned_count, channel_full->can_get_participants,
channel_full->can_set_username, channel_full->can_set_sticker_set, channel_full->is_all_history_available,
channel_full->sticker_set_id, channel_full->invite_link, channel_full->pinned_message_id.get(),
get_basic_group_id_object(channel_full->migrated_from_chat_id), channel_full->migrated_from_max_message_id.get());
get_basic_group_id_object(channel_full->migrated_from_chat_id, "get_channel_full_info_object"),
channel_full->migrated_from_max_message_id.get());
}
tl_object_ptr<td_api::SecretChatState> ContactsManager::get_secret_chat_state_object(SecretChatState state) {
@ -9109,10 +9114,10 @@ tl_object_ptr<td_api::SecretChatState> ContactsManager::get_secret_chat_state_ob
}
}
int32 ContactsManager::get_secret_chat_id_object(SecretChatId secret_chat_id) const {
int32 ContactsManager::get_secret_chat_id_object(SecretChatId secret_chat_id, const char *source) const {
if (secret_chat_id.is_valid() && get_secret_chat(secret_chat_id) == nullptr &&
unknown_secret_chats_.count(secret_chat_id) == 0) {
LOG(ERROR) << "Have no info about " << secret_chat_id;
LOG(ERROR) << "Have no info about " << secret_chat_id << " from " << source;
unknown_secret_chats_.insert(secret_chat_id);
send_closure(
G()->td(), &Td::send_update,
@ -9133,8 +9138,9 @@ tl_object_ptr<td_api::secretChat> ContactsManager::get_secret_chat_object(Secret
}
get_user_force(secret_chat->user_id);
return td_api::make_object<td_api::secretChat>(
secret_chat_id.get(), get_user_id_object(secret_chat->user_id), get_secret_chat_state_object(secret_chat->state),
secret_chat->is_outbound, secret_chat->ttl, secret_chat->key_hash, secret_chat->layer);
secret_chat_id.get(), get_user_id_object(secret_chat->user_id, "secretChat"),
get_secret_chat_state_object(secret_chat->state), secret_chat->is_outbound, secret_chat->ttl,
secret_chat->key_hash, secret_chat->layer);
}
tl_object_ptr<td_api::LinkState> ContactsManager::get_link_state_object(LinkState link) {
@ -9205,7 +9211,8 @@ tl_object_ptr<td_api::chatInviteLinkInfo> ContactsManager::get_chat_invite_link_
} else {
LOG(ERROR) << "Have no information about " << chat_id;
}
chat_type = td_api::make_object<td_api::chatTypeBasicGroup>(get_basic_group_id_object(chat_id));
chat_type = td_api::make_object<td_api::chatTypeBasicGroup>(
get_basic_group_id_object(chat_id, "get_chat_invite_link_info_object"));
} else if (invite_link_info->channel_id != ChannelId()) {
CHECK(invite_link_info->chat_id == ChatId());
auto channel_id = invite_link_info->channel_id;
@ -9223,7 +9230,8 @@ tl_object_ptr<td_api::chatInviteLinkInfo> ContactsManager::get_chat_invite_link_
} else {
LOG(ERROR) << "Have no information about " << channel_id;
}
chat_type = td_api::make_object<td_api::chatTypeSupergroup>(get_supergroup_id_object(channel_id), !is_megagroup);
chat_type = td_api::make_object<td_api::chatTypeSupergroup>(
get_supergroup_id_object(channel_id, "get_chat_invite_link_info_object"), !is_megagroup);
} else {
title = invite_link_info->title;
photo = &invite_link_info->photo;

View File

@ -364,7 +364,7 @@ class ContactsManager : public Actor {
vector<UserId> get_dialog_administrators(DialogId chat_id, int left_tries, Promise<Unit> &&promise);
int32 get_user_id_object(UserId user_id) const;
int32 get_user_id_object(UserId user_id, const char *source) const;
tl_object_ptr<td_api::user> get_user_object(UserId user_id) const;
@ -374,19 +374,19 @@ class ContactsManager : public Actor {
tl_object_ptr<td_api::userFullInfo> get_user_full_info_object(UserId user_id) const;
int32 get_basic_group_id_object(ChatId chat_id) const;
int32 get_basic_group_id_object(ChatId chat_id, const char *source) const;
tl_object_ptr<td_api::basicGroup> get_basic_group_object(ChatId chat_id) const;
tl_object_ptr<td_api::basicGroupFullInfo> get_basic_group_full_info_object(ChatId chat_id) const;
int32 get_supergroup_id_object(ChannelId channel_id) const;
int32 get_supergroup_id_object(ChannelId channel_id, const char *source) const;
tl_object_ptr<td_api::supergroup> get_supergroup_object(ChannelId channel_id) const;
tl_object_ptr<td_api::supergroupFullInfo> get_channel_full_info_object(ChannelId channel_id) const;
int32 get_secret_chat_id_object(SecretChatId secret_chat_id) const;
int32 get_secret_chat_id_object(SecretChatId secret_chat_id, const char *source) const;
tl_object_ptr<td_api::secretChat> get_secret_chat_object(SecretChatId secret_chat_id);

View File

@ -1728,10 +1728,10 @@ void InlineQueriesManager::on_new_query(int64 query_id, UserId sender_user_id, L
LOG(ERROR) << "Receive new inline query";
return;
}
send_closure(
G()->td(), &Td::send_update,
make_tl_object<td_api::updateNewInlineQuery>(query_id, td_->contacts_manager_->get_user_id_object(sender_user_id),
user_location.get_location_object(), query, offset));
send_closure(G()->td(), &Td::send_update,
make_tl_object<td_api::updateNewInlineQuery>(
query_id, td_->contacts_manager_->get_user_id_object(sender_user_id, "updateNewInlineQuery"),
user_location.get_location_object(), query, offset));
}
void InlineQueriesManager::on_chosen_result(
@ -1748,8 +1748,9 @@ void InlineQueriesManager::on_chosen_result(
}
send_closure(G()->td(), &Td::send_update,
make_tl_object<td_api::updateNewChosenInlineResult>(
td_->contacts_manager_->get_user_id_object(user_id), user_location.get_location_object(), query,
result_id, get_inline_message_id(std::move(input_bot_inline_message_id))));
td_->contacts_manager_->get_user_id_object(user_id, "updateNewChosenInlineResult"),
user_location.get_location_object(), query, result_id,
get_inline_message_id(std::move(input_bot_inline_message_id))));
}
bool InlineQueriesManager::update_bot_usage(UserId bot_user_id) {

View File

@ -1772,6 +1772,11 @@ class SendSecretMessageActor : public NetActor {
void send(DialogId dialog_id, int64 reply_to_random_id, int32 ttl, const string &message, SecretInputMedia media,
vector<tl_object_ptr<secret_api::MessageEntity>> &&entities, UserId via_bot_user_id, int64 media_album_id,
int64 random_id) {
if (false && !media.empty()) {
td->messages_manager_->on_send_secret_message_error(random_id, Status::Error(400, "FILE_PART_1_MISSING"), Auto());
return;
}
CHECK(dialog_id.get_type() == DialogType::SecretChat);
random_id_ = random_id;
@ -8205,12 +8210,13 @@ tl_object_ptr<td_api::MessageContent> MessagesManager::get_message_content_objec
return make_tl_object<td_api::messageChatJoinByLink>();
case MessageChatDeleteUser::ID: {
const MessageChatDeleteUser *m = static_cast<const MessageChatDeleteUser *>(content);
return make_tl_object<td_api::messageChatDeleteMember>(td_->contacts_manager_->get_user_id_object(m->user_id));
return make_tl_object<td_api::messageChatDeleteMember>(
td_->contacts_manager_->get_user_id_object(m->user_id, "messageChatDeleteMember"));
}
case MessageChatMigrateTo::ID: {
const MessageChatMigrateTo *m = static_cast<const MessageChatMigrateTo *>(content);
return make_tl_object<td_api::messageChatUpgradeTo>(
td_->contacts_manager_->get_supergroup_id_object(m->migrated_to_channel_id));
td_->contacts_manager_->get_supergroup_id_object(m->migrated_to_channel_id, "messageChatUpgradeTo"));
}
case MessageChannelCreate::ID: {
const MessageChannelCreate *m = static_cast<const MessageChannelCreate *>(content);
@ -8219,7 +8225,8 @@ tl_object_ptr<td_api::MessageContent> MessagesManager::get_message_content_objec
case MessageChannelMigrateFrom::ID: {
const MessageChannelMigrateFrom *m = static_cast<const MessageChannelMigrateFrom *>(content);
return make_tl_object<td_api::messageChatUpgradeFrom>(
m->title, td_->contacts_manager_->get_basic_group_id_object(m->migrated_from_chat_id));
m->title,
td_->contacts_manager_->get_basic_group_id_object(m->migrated_from_chat_id, "messageChatUpgradeFrom"));
}
case MessagePinMessage::ID: {
const MessagePinMessage *m = static_cast<const MessagePinMessage *>(content);
@ -11923,21 +11930,23 @@ tl_object_ptr<td_api::ChatType> MessagesManager::get_chat_type_object(DialogId d
switch (dialog_id.get_type()) {
case DialogType::User:
return make_tl_object<td_api::chatTypePrivate>(
td_->contacts_manager_->get_user_id_object(dialog_id.get_user_id()));
td_->contacts_manager_->get_user_id_object(dialog_id.get_user_id(), "chatTypePrivate"));
case DialogType::Chat:
return make_tl_object<td_api::chatTypeBasicGroup>(
td_->contacts_manager_->get_basic_group_id_object(dialog_id.get_chat_id()));
td_->contacts_manager_->get_basic_group_id_object(dialog_id.get_chat_id(), "chatTypeBasicGroup"));
case DialogType::Channel: {
auto channel_id = dialog_id.get_channel_id();
auto channel_type = td_->contacts_manager_->get_channel_type(channel_id);
return make_tl_object<td_api::chatTypeSupergroup>(td_->contacts_manager_->get_supergroup_id_object(channel_id),
channel_type != ChannelType::Megagroup);
return make_tl_object<td_api::chatTypeSupergroup>(
td_->contacts_manager_->get_supergroup_id_object(channel_id, "chatTypeSupergroup"),
channel_type != ChannelType::Megagroup);
}
case DialogType::SecretChat: {
auto secret_chat_id = dialog_id.get_secret_chat_id();
auto user_id = td_->contacts_manager_->get_secret_chat_user_id(secret_chat_id);
return make_tl_object<td_api::chatTypeSecret>(td_->contacts_manager_->get_secret_chat_id_object(secret_chat_id),
td_->contacts_manager_->get_user_id_object(user_id));
return make_tl_object<td_api::chatTypeSecret>(
td_->contacts_manager_->get_secret_chat_id_object(secret_chat_id, "chatTypeSecret"),
td_->contacts_manager_->get_user_id_object(user_id, "chatTypeSecret"));
}
case DialogType::None:
default:
@ -13495,15 +13504,15 @@ tl_object_ptr<td_api::message> MessagesManager::get_message_object(DialogId dial
}
}
return make_tl_object<td_api::message>(
message->message_id.get(), td_->contacts_manager_->get_user_id_object(message->sender_user_id), dialog_id.get(),
std::move(sending_state), is_outgoing, can_edit_message(dialog_id, message, false, true),
message->message_id.get(), td_->contacts_manager_->get_user_id_object(message->sender_user_id, "sender_user_id"),
dialog_id.get(), std::move(sending_state), is_outgoing, can_edit_message(dialog_id, message, false, true),
can_forward_message(dialog_id, message), can_delete_for_self, can_delete_for_all_users, message->is_channel_post,
message->contains_unread_mention, message->date, message->edit_date,
get_message_forward_info_object(message->forward_info), message->reply_to_message_id.get(), message->ttl,
message->ttl_expires_at != 0 ? std::max(message->ttl_expires_at - Time::now(), 1e-3) : message->ttl,
td_->contacts_manager_->get_user_id_object(message->via_bot_user_id), message->author_signature, message->views,
message->media_album_id, get_message_content_object(message->content.get()),
get_reply_markup_object(message->reply_markup));
td_->contacts_manager_->get_user_id_object(message->via_bot_user_id, "via_bot_user_id"),
message->author_signature, message->views, message->media_album_id,
get_message_content_object(message->content.get()), get_reply_markup_object(message->reply_markup));
}
tl_object_ptr<td_api::messages> MessagesManager::get_messages_object(int32 total_count, DialogId dialog_id,
@ -17012,8 +17021,8 @@ void MessagesManager::on_get_game_high_scores(int64 random_id,
LOG(ERROR) << "Receive wrong score = " << score;
continue;
}
result->scores_.push_back(
make_tl_object<td_api::gameHighScore>(position, td_->contacts_manager_->get_user_id_object(user_id), score));
result->scores_.push_back(make_tl_object<td_api::gameHighScore>(
position, td_->contacts_manager_->get_user_id_object(user_id, "gameHighScore"), score));
}
}
@ -17117,8 +17126,8 @@ tl_object_ptr<td_api::MessageForwardInfo> MessagesManager::get_message_forward_i
forward_info->message_id.get(), forward_info->from_dialog_id.get(), forward_info->from_message_id.get());
}
return make_tl_object<td_api::messageForwardedFromUser>(
td_->contacts_manager_->get_user_id_object(forward_info->sender_user_id), forward_info->date,
forward_info->from_dialog_id.get(), forward_info->from_message_id.get());
td_->contacts_manager_->get_user_id_object(forward_info->sender_user_id, "messageForwardedFromUser"),
forward_info->date, forward_info->from_dialog_id.get(), forward_info->from_message_id.get());
}
Result<unique_ptr<ReplyMarkup>> MessagesManager::get_dialog_reply_markup(
@ -19424,8 +19433,9 @@ tl_object_ptr<td_api::ChatEventAction> MessagesManager::get_chat_event_action_ob
case telegram_api::channelAdminLogEventActionParticipantInvite::ID: {
auto action = move_tl_object_as<telegram_api::channelAdminLogEventActionParticipantInvite>(action_ptr);
auto member = td_->contacts_manager_->get_dialog_participant(ChannelId(), std::move(action->participant_));
return make_tl_object<td_api::chatEventMemberInvited>(td_->contacts_manager_->get_user_id_object(member.user_id),
member.status.get_chat_member_status_object());
return make_tl_object<td_api::chatEventMemberInvited>(
td_->contacts_manager_->get_user_id_object(member.user_id, "chatEventMemberInvited"),
member.status.get_chat_member_status_object());
}
case telegram_api::channelAdminLogEventActionParticipantToggleBan::ID: {
auto action = move_tl_object_as<telegram_api::channelAdminLogEventActionParticipantToggleBan>(action_ptr);
@ -19438,7 +19448,7 @@ tl_object_ptr<td_api::ChatEventAction> MessagesManager::get_chat_event_action_ob
return nullptr;
}
return make_tl_object<td_api::chatEventMemberRestricted>(
td_->contacts_manager_->get_user_id_object(old_member.user_id),
td_->contacts_manager_->get_user_id_object(old_member.user_id, "chatEventMemberRestricted"),
old_member.status.get_chat_member_status_object(), new_member.status.get_chat_member_status_object());
}
case telegram_api::channelAdminLogEventActionParticipantToggleAdmin::ID: {
@ -19452,7 +19462,7 @@ tl_object_ptr<td_api::ChatEventAction> MessagesManager::get_chat_event_action_ob
return nullptr;
}
return make_tl_object<td_api::chatEventMemberPromoted>(
td_->contacts_manager_->get_user_id_object(old_member.user_id),
td_->contacts_manager_->get_user_id_object(old_member.user_id, "chatEventMemberPromoted"),
old_member.status.get_chat_member_status_object(), new_member.status.get_chat_member_status_object());
}
case telegram_api::channelAdminLogEventActionChangeTitle::ID: {
@ -19568,7 +19578,7 @@ void MessagesManager::on_get_event_log(int64 random_id,
continue;
}
result->events_.push_back(make_tl_object<td_api::chatEvent>(
event->id_, event->date_, td_->contacts_manager_->get_user_id_object(user_id), std::move(action)));
event->id_, event->date_, td_->contacts_manager_->get_user_id_object(user_id, "chatEvent"), std::move(action)));
}
}
@ -20290,7 +20300,8 @@ unique_ptr<MessageContent> MessagesManager::get_message_content(FormattedText me
case telegram_api::messageMediaContact::ID: {
auto message_contact = move_tl_object_as<telegram_api::messageMediaContact>(media);
if (message_contact->user_id_ != 0) {
td_->contacts_manager_->get_user_id_object(UserId(message_contact->user_id_)); // to ensure updateUser
td_->contacts_manager_->get_user_id_object(UserId(message_contact->user_id_),
"messageMediaContact"); // to ensure updateUser
}
return make_unique<MessageContact>(Contact(message_contact->phone_number_, message_contact->first_name_,
message_contact->last_name_, message_contact->user_id_));

View File

@ -416,7 +416,8 @@ class GetPaymentReceiptQuery : public Td::ResultHandler {
promise_.set_value(make_tl_object<td_api::paymentReceipt>(
payment_receipt->date_,
G()->td().get_actor_unsafe()->contacts_manager_->get_user_id_object(payments_provider_user_id),
G()->td().get_actor_unsafe()->contacts_manager_->get_user_id_object(payments_provider_user_id,
"paymentReceipt"),
convert_invoice(std::move(payment_receipt->invoice_)), convert_order_info(std::move(payment_receipt->info_)),
convert_shipping_option(std::move(payment_receipt->shipping_)),
std::move(payment_receipt->credentials_title_)));

View File

@ -229,7 +229,8 @@ class GetRecentMeUrlsQuery : public Td::ResultHandler {
result = nullptr;
break;
}
result->type_ = make_tl_object<td_api::tMeUrlTypeUser>(td->contacts_manager_->get_user_id_object(user_id));
result->type_ = make_tl_object<td_api::tMeUrlTypeUser>(
td->contacts_manager_->get_user_id_object(user_id, "tMeUrlTypeUser"));
break;
}
case telegram_api::recentMeUrlChat::ID: {
@ -241,8 +242,8 @@ class GetRecentMeUrlsQuery : public Td::ResultHandler {
result = nullptr;
break;
}
result->type_ =
make_tl_object<td_api::tMeUrlTypeSupergroup>(td->contacts_manager_->get_supergroup_id_object(channel_id));
result->type_ = make_tl_object<td_api::tMeUrlTypeSupergroup>(
td->contacts_manager_->get_supergroup_id_object(channel_id, "tMeUrlTypeSupergroup"));
break;
}
case telegram_api::recentMeUrlChatInvite::ID: {
@ -2077,10 +2078,12 @@ class ImportContactsRequest : public RequestActor<> {
void do_send_result() override {
CHECK(imported_contacts_.first.size() == contacts_.size());
CHECK(imported_contacts_.second.size() == contacts_.size());
send_result(make_tl_object<td_api::importedContacts>(
transform(imported_contacts_.first,
[this](UserId user_id) { return td->contacts_manager_->get_user_id_object(user_id); }),
std::move(imported_contacts_.second)));
send_result(make_tl_object<td_api::importedContacts>(transform(imported_contacts_.first,
[this](UserId user_id) {
return td->contacts_manager_->get_user_id_object(
user_id, "ImportContactsRequest");
}),
std::move(imported_contacts_.second)));
}
public:
@ -2158,10 +2161,12 @@ class ChangeImportedContactsRequest : public RequestActor<> {
void do_send_result() override {
CHECK(imported_contacts_.first.size() == contacts_size_);
CHECK(imported_contacts_.second.size() == contacts_size_);
send_result(make_tl_object<td_api::importedContacts>(
transform(imported_contacts_.first,
[this](UserId user_id) { return td->contacts_manager_->get_user_id_object(user_id); }),
std::move(imported_contacts_.second)));
send_result(make_tl_object<td_api::importedContacts>(transform(imported_contacts_.first,
[this](UserId user_id) {
return td->contacts_manager_->get_user_id_object(
user_id, "ChangeImportedContactsRequest");
}),
std::move(imported_contacts_.second)));
}
public:

View File

@ -1464,10 +1464,10 @@ void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateUserTyping> upd
LOG(DEBUG) << "Ignore user typing in unknown " << dialog_id;
return;
}
send_closure(
G()->td(), &Td::send_update,
make_tl_object<td_api::updateUserChatAction>(dialog_id.get(), td_->contacts_manager_->get_user_id_object(user_id),
convertSendMessageAction(std::move(update->action_))));
send_closure(G()->td(), &Td::send_update,
make_tl_object<td_api::updateUserChatAction>(
dialog_id.get(), td_->contacts_manager_->get_user_id_object(user_id, "updateUserTyping"),
convertSendMessageAction(std::move(update->action_))));
}
void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateChatUserTyping> update, bool /*force_apply*/) {
@ -1486,10 +1486,10 @@ void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateChatUserTyping>
return;
}
}
send_closure(
G()->td(), &Td::send_update,
make_tl_object<td_api::updateUserChatAction>(dialog_id.get(), td_->contacts_manager_->get_user_id_object(user_id),
convertSendMessageAction(std::move(update->action_))));
send_closure(G()->td(), &Td::send_update,
make_tl_object<td_api::updateUserChatAction>(
dialog_id.get(), td_->contacts_manager_->get_user_id_object(user_id, "updateChatUserTyping"),
convertSendMessageAction(std::move(update->action_))));
}
void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateEncryptedChatTyping> update, bool /*force_apply*/) {
@ -1507,10 +1507,10 @@ void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateEncryptedChatTy
return;
}
send_closure(
G()->td(), &Td::send_update,
make_tl_object<td_api::updateUserChatAction>(dialog_id.get(), td_->contacts_manager_->get_user_id_object(user_id),
make_tl_object<td_api::chatActionTyping>()));
send_closure(G()->td(), &Td::send_update,
make_tl_object<td_api::updateUserChatAction>(
dialog_id.get(), td_->contacts_manager_->get_user_id_object(user_id, "updateEncryptedChatTyping"),
make_tl_object<td_api::chatActionTyping>()));
}
void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateUserStatus> update, bool /*force_apply*/) {
@ -1666,12 +1666,12 @@ void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateBotShippingQuer
}
CHECK(update->shipping_address_ != nullptr);
send_closure(
G()->td(), &Td::send_update,
make_tl_object<td_api::updateNewShippingQuery>(
update->query_id_, td_->contacts_manager_->get_user_id_object(user_id), update->payload_.as_slice().str(),
get_shipping_address_object(
get_shipping_address(std::move(update->shipping_address_))))); // TODO use convert_shipping_address
send_closure(G()->td(), &Td::send_update,
make_tl_object<td_api::updateNewShippingQuery>(
update->query_id_, td_->contacts_manager_->get_user_id_object(user_id, "updateNewShippingQuery"),
update->payload_.as_slice().str(),
get_shipping_address_object(get_shipping_address(
std::move(update->shipping_address_))))); // TODO use convert_shipping_address
}
void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateBotPrecheckoutQuery> update, bool /*force_apply*/) {
@ -1683,9 +1683,9 @@ void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateBotPrecheckoutQ
send_closure(G()->td(), &Td::send_update,
make_tl_object<td_api::updateNewPreCheckoutQuery>(
update->query_id_, td_->contacts_manager_->get_user_id_object(user_id), update->currency_,
update->total_amount_, update->payload_.as_slice().str(), update->shipping_option_id_,
get_order_info_object(get_order_info(std::move(update->info_)))));
update->query_id_, td_->contacts_manager_->get_user_id_object(user_id, "updateNewPreCheckoutQuery"),
update->currency_, update->total_amount_, update->payload_.as_slice().str(),
update->shipping_option_id_, get_order_info_object(get_order_info(std::move(update->info_)))));
}
void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateBotWebhookJSON> update, bool /*force_apply*/) {