Use DialogManager::get_my_dialog_id.
This commit is contained in:
parent
eb5a37e927
commit
ebda6f1364
@ -53,7 +53,7 @@ class CreateForumTopicQuery final : public Td::ResultHandler {
|
|||||||
void send(ChannelId channel_id, const string &title, int32 icon_color, CustomEmojiId icon_custom_emoji_id,
|
void send(ChannelId channel_id, const string &title, int32 icon_color, CustomEmojiId icon_custom_emoji_id,
|
||||||
DialogId as_dialog_id) {
|
DialogId as_dialog_id) {
|
||||||
channel_id_ = channel_id;
|
channel_id_ = channel_id;
|
||||||
creator_dialog_id_ = DialogId(td_->contacts_manager_->get_my_id());
|
creator_dialog_id_ = td_->dialog_manager_->get_my_dialog_id();
|
||||||
|
|
||||||
int32 flags = 0;
|
int32 flags = 0;
|
||||||
if (icon_color != -1) {
|
if (icon_color != -1) {
|
||||||
|
@ -1305,7 +1305,7 @@ void GroupCallManager::set_group_call_default_join_as(DialogId dialog_id, Dialog
|
|||||||
|
|
||||||
switch (as_dialog_id.get_type()) {
|
switch (as_dialog_id.get_type()) {
|
||||||
case DialogType::User:
|
case DialogType::User:
|
||||||
if (as_dialog_id != DialogId(td_->contacts_manager_->get_my_id())) {
|
if (as_dialog_id != td_->dialog_manager_->get_my_dialog_id()) {
|
||||||
return promise.set_error(Status::Error(400, "Can't join voice chat as another user"));
|
return promise.set_error(Status::Error(400, "Can't join voice chat as another user"));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1723,7 +1723,7 @@ GroupCallParticipant *GroupCallManager::get_group_call_participant(GroupCallPart
|
|||||||
if (!dialog_id.is_valid()) {
|
if (!dialog_id.is_valid()) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
if (dialog_id == DialogId(td_->contacts_manager_->get_my_id())) {
|
if (dialog_id == td_->dialog_manager_->get_my_dialog_id()) {
|
||||||
for (auto &group_call_participant : group_call_participants->participants) {
|
for (auto &group_call_participant : group_call_participants->participants) {
|
||||||
if (group_call_participant.is_self) {
|
if (group_call_participant.is_self) {
|
||||||
return &group_call_participant;
|
return &group_call_participant;
|
||||||
@ -2242,7 +2242,7 @@ void GroupCallManager::process_my_group_call_participant(InputGroupCallId input_
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto my_participant = get_group_call_participant(add_group_call_participants(input_group_call_id),
|
auto my_participant = get_group_call_participant(add_group_call_participants(input_group_call_id),
|
||||||
DialogId(td_->contacts_manager_->get_my_id()));
|
td_->dialog_manager_->get_my_dialog_id());
|
||||||
if (my_participant == nullptr || my_participant->is_fake || my_participant->joined_date < participant.joined_date ||
|
if (my_participant == nullptr || my_participant->is_fake || my_participant->joined_date < participant.joined_date ||
|
||||||
(my_participant->joined_date <= participant.joined_date &&
|
(my_participant->joined_date <= participant.joined_date &&
|
||||||
my_participant->audio_source != participant.audio_source)) {
|
my_participant->audio_source != participant.audio_source)) {
|
||||||
@ -2631,7 +2631,7 @@ void GroupCallManager::join_group_call(GroupCallId group_call_id, DialogId as_di
|
|||||||
|
|
||||||
bool have_as_dialog_id = true;
|
bool have_as_dialog_id = true;
|
||||||
{
|
{
|
||||||
auto my_dialog_id = DialogId(td_->contacts_manager_->get_my_id());
|
auto my_dialog_id = td_->dialog_manager_->get_my_dialog_id();
|
||||||
if (!as_dialog_id.is_valid()) {
|
if (!as_dialog_id.is_valid()) {
|
||||||
as_dialog_id = my_dialog_id;
|
as_dialog_id = my_dialog_id;
|
||||||
}
|
}
|
||||||
@ -2844,7 +2844,7 @@ void GroupCallManager::finish_load_group_call_administrators(InputGroupCallId in
|
|||||||
auto participants = result.move_as_ok();
|
auto participants = result.move_as_ok();
|
||||||
for (auto &administrator : participants.participants_) {
|
for (auto &administrator : participants.participants_) {
|
||||||
if (administrator.status_.can_manage_calls() &&
|
if (administrator.status_.can_manage_calls() &&
|
||||||
administrator.dialog_id_ != DialogId(td_->contacts_manager_->get_my_id())) {
|
administrator.dialog_id_ != td_->dialog_manager_->get_my_dialog_id()) {
|
||||||
administrator_dialog_ids.push_back(administrator.dialog_id_);
|
administrator_dialog_ids.push_back(administrator.dialog_id_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -377,7 +377,7 @@ Result<tl_object_ptr<telegram_api::InputBotInlineMessage>> InlineQueriesManager:
|
|||||||
|
|
||||||
auto constructor_id = input_message_content->get_id();
|
auto constructor_id = input_message_content->get_id();
|
||||||
if (constructor_id == td_api::inputMessageText::ID) {
|
if (constructor_id == td_api::inputMessageText::ID) {
|
||||||
TRY_RESULT(input_message_text, process_input_message_text(td_, DialogId(td_->contacts_manager_->get_my_id()),
|
TRY_RESULT(input_message_text, process_input_message_text(td_, td_->dialog_manager_->get_my_dialog_id(),
|
||||||
std::move(input_message_content), true));
|
std::move(input_message_content), true));
|
||||||
auto entities = get_input_message_entities(td_->contacts_manager_.get(), input_message_text.text.entities,
|
auto entities = get_input_message_entities(td_->contacts_manager_.get(), input_message_text.text.entities,
|
||||||
"get_inline_message");
|
"get_inline_message");
|
||||||
@ -453,7 +453,7 @@ Result<tl_object_ptr<telegram_api::InputBotInlineMessage>> InlineQueriesManager:
|
|||||||
return venue.get_input_bot_inline_message_media_venue(std::move(input_reply_markup));
|
return venue.get_input_bot_inline_message_media_venue(std::move(input_reply_markup));
|
||||||
}
|
}
|
||||||
if (constructor_id == allowed_media_content_id) {
|
if (constructor_id == allowed_media_content_id) {
|
||||||
TRY_RESULT(caption, get_formatted_text(td_, DialogId(td_->contacts_manager_->get_my_id()),
|
TRY_RESULT(caption, get_formatted_text(td_, td_->dialog_manager_->get_my_dialog_id(),
|
||||||
extract_input_caption(input_message_content), true, true, true, false));
|
extract_input_caption(input_message_content), true, true, true, false));
|
||||||
int32 flags = 0;
|
int32 flags = 0;
|
||||||
if (input_reply_markup != nullptr) {
|
if (input_reply_markup != nullptr) {
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#include "td/telegram/ContactsManager.h"
|
#include "td/telegram/ContactsManager.h"
|
||||||
#include "td/telegram/Dependencies.h"
|
#include "td/telegram/Dependencies.h"
|
||||||
|
#include "td/telegram/DialogManager.h"
|
||||||
#include "td/telegram/LinkManager.h"
|
#include "td/telegram/LinkManager.h"
|
||||||
#include "td/telegram/misc.h"
|
#include "td/telegram/misc.h"
|
||||||
#include "td/telegram/OptionManager.h"
|
#include "td/telegram/OptionManager.h"
|
||||||
@ -4725,8 +4726,7 @@ void remove_unallowed_entities(const Td *td, FormattedText &text, DialogId dialo
|
|||||||
remove_intersecting_entities(text.entities);
|
remove_intersecting_entities(text.entities);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (dialog_id != DialogId(td->contacts_manager_->get_my_id()) &&
|
if (dialog_id != td->dialog_manager_->get_my_dialog_id() && !td->contacts_manager_->can_use_premium_custom_emoji()) {
|
||||||
!td->contacts_manager_->can_use_premium_custom_emoji()) {
|
|
||||||
remove_premium_custom_emoji_entities(td, text.entities, false);
|
remove_premium_custom_emoji_entities(td, text.entities, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24732,7 +24732,7 @@ void MessagesManager::set_dialog_default_send_message_as_dialog_id(DialogId dial
|
|||||||
bool is_anonymous = td_->dialog_manager_->is_anonymous_administrator(dialog_id, nullptr);
|
bool is_anonymous = td_->dialog_manager_->is_anonymous_administrator(dialog_id, nullptr);
|
||||||
switch (message_sender_dialog_id.get_type()) {
|
switch (message_sender_dialog_id.get_type()) {
|
||||||
case DialogType::User:
|
case DialogType::User:
|
||||||
if (message_sender_dialog_id != DialogId(td_->contacts_manager_->get_my_id())) {
|
if (message_sender_dialog_id != td_->dialog_manager_->get_my_dialog_id()) {
|
||||||
return promise.set_error(Status::Error(400, "Can't send messages as another user"));
|
return promise.set_error(Status::Error(400, "Can't send messages as another user"));
|
||||||
}
|
}
|
||||||
if (is_anonymous) {
|
if (is_anonymous) {
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
//
|
//
|
||||||
#include "td/telegram/RepliedMessageInfo.h"
|
#include "td/telegram/RepliedMessageInfo.h"
|
||||||
|
|
||||||
#include "td/telegram/ContactsManager.h"
|
|
||||||
#include "td/telegram/Dependencies.h"
|
#include "td/telegram/Dependencies.h"
|
||||||
|
#include "td/telegram/DialogManager.h"
|
||||||
#include "td/telegram/MessageContent.h"
|
#include "td/telegram/MessageContent.h"
|
||||||
#include "td/telegram/MessageContentType.h"
|
#include "td/telegram/MessageContentType.h"
|
||||||
#include "td/telegram/MessageCopyOptions.h"
|
#include "td/telegram/MessageCopyOptions.h"
|
||||||
@ -180,7 +180,7 @@ RepliedMessageInfo RepliedMessageInfo::clone(Td *td) const {
|
|||||||
result.origin_date_ = origin_date_;
|
result.origin_date_ = origin_date_;
|
||||||
result.origin_ = origin_;
|
result.origin_ = origin_;
|
||||||
if (content_ != nullptr) {
|
if (content_ != nullptr) {
|
||||||
result.content_ = dup_message_content(td, DialogId(td->contacts_manager_->get_my_id()), content_.get(),
|
result.content_ = dup_message_content(td, td->dialog_manager_->get_my_dialog_id(), content_.get(),
|
||||||
MessageContentDupType::Forward, MessageCopyOptions());
|
MessageContentDupType::Forward, MessageCopyOptions());
|
||||||
}
|
}
|
||||||
result.quote_ = quote_;
|
result.quote_ = quote_;
|
||||||
|
@ -621,7 +621,7 @@ void StatisticsManager::get_story_public_forwards(StoryFullId story_full_id, str
|
|||||||
}
|
}
|
||||||
auto dialog_id = story_full_id.get_dialog_id();
|
auto dialog_id = story_full_id.get_dialog_id();
|
||||||
if (dialog_id.get_type() == DialogType::User) {
|
if (dialog_id.get_type() == DialogType::User) {
|
||||||
if (dialog_id != DialogId(td_->contacts_manager_->get_my_id())) {
|
if (dialog_id != td_->dialog_manager_->get_my_dialog_id()) {
|
||||||
return promise.set_error(Status::Error(400, "Have no access to story statistics"));
|
return promise.set_error(Status::Error(400, "Have no access to story statistics"));
|
||||||
}
|
}
|
||||||
return send_get_story_public_forwards_query(DcId::main(), story_full_id, std::move(offset), limit,
|
return send_get_story_public_forwards_query(DcId::main(), story_full_id, std::move(offset), limit,
|
||||||
@ -646,7 +646,7 @@ void StatisticsManager::send_get_story_public_forwards_query(
|
|||||||
return promise.set_error(Status::Error(400, "Story not found"));
|
return promise.set_error(Status::Error(400, "Story not found"));
|
||||||
}
|
}
|
||||||
if (!td_->story_manager_->can_get_story_statistics(story_full_id) &&
|
if (!td_->story_manager_->can_get_story_statistics(story_full_id) &&
|
||||||
story_full_id.get_dialog_id() != DialogId(td_->contacts_manager_->get_my_id())) {
|
story_full_id.get_dialog_id() != td_->dialog_manager_->get_my_dialog_id()) {
|
||||||
return promise.set_error(Status::Error(400, "Story forwards are inaccessible"));
|
return promise.set_error(Status::Error(400, "Story forwards are inaccessible"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1581,7 +1581,7 @@ void StoryManager::on_load_expired_database_stories(vector<StoryDbStory> stories
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool StoryManager::is_my_story(DialogId owner_dialog_id) const {
|
bool StoryManager::is_my_story(DialogId owner_dialog_id) const {
|
||||||
return owner_dialog_id == DialogId(td_->contacts_manager_->get_my_id());
|
return owner_dialog_id == td_->dialog_manager_->get_my_dialog_id();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool StoryManager::can_access_expired_story(DialogId owner_dialog_id, const Story *story) const {
|
bool StoryManager::can_access_expired_story(DialogId owner_dialog_id, const Story *story) const {
|
||||||
@ -2880,7 +2880,7 @@ void StoryManager::get_story_interactions(StoryId story_id, const string &query,
|
|||||||
bool prefer_forwards, bool prefer_with_reaction, const string &offset,
|
bool prefer_forwards, bool prefer_with_reaction, const string &offset,
|
||||||
int32 limit,
|
int32 limit,
|
||||||
Promise<td_api::object_ptr<td_api::storyInteractions>> &&promise) {
|
Promise<td_api::object_ptr<td_api::storyInteractions>> &&promise) {
|
||||||
DialogId owner_dialog_id(td_->contacts_manager_->get_my_id());
|
auto owner_dialog_id = td_->dialog_manager_->get_my_dialog_id();
|
||||||
StoryFullId story_full_id{owner_dialog_id, story_id};
|
StoryFullId story_full_id{owner_dialog_id, story_id};
|
||||||
const Story *story = get_story(story_full_id);
|
const Story *story = get_story(story_full_id);
|
||||||
if (story == nullptr) {
|
if (story == nullptr) {
|
||||||
@ -2913,7 +2913,7 @@ void StoryManager::on_get_story_interactions(
|
|||||||
}
|
}
|
||||||
auto view_list = r_view_list.move_as_ok();
|
auto view_list = r_view_list.move_as_ok();
|
||||||
|
|
||||||
DialogId owner_dialog_id(td_->contacts_manager_->get_my_id());
|
auto owner_dialog_id = td_->dialog_manager_->get_my_dialog_id();
|
||||||
CHECK(story_id.is_server());
|
CHECK(story_id.is_server());
|
||||||
StoryFullId story_full_id{owner_dialog_id, story_id};
|
StoryFullId story_full_id{owner_dialog_id, story_id};
|
||||||
Story *story = get_story_editable(story_full_id);
|
Story *story = get_story_editable(story_full_id);
|
||||||
@ -4033,7 +4033,7 @@ bool StoryManager::update_active_stories_order(DialogId owner_dialog_id, ActiveS
|
|||||||
if (active_stories->max_read_story_id_.get() < last_story_id.get()) {
|
if (active_stories->max_read_story_id_.get() < last_story_id.get()) {
|
||||||
new_private_order += static_cast<int64>(1) << 35;
|
new_private_order += static_cast<int64>(1) << 35;
|
||||||
}
|
}
|
||||||
if (owner_dialog_id == DialogId(td_->contacts_manager_->get_my_id())) {
|
if (owner_dialog_id == td_->dialog_manager_->get_my_dialog_id()) {
|
||||||
new_private_order += static_cast<int64>(1) << 36;
|
new_private_order += static_cast<int64>(1) << 36;
|
||||||
}
|
}
|
||||||
CHECK(new_private_order != 0);
|
CHECK(new_private_order != 0);
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#include "td/telegram/ContactsManager.h"
|
#include "td/telegram/ContactsManager.h"
|
||||||
#include "td/telegram/DialogId.h"
|
#include "td/telegram/DialogId.h"
|
||||||
|
#include "td/telegram/DialogManager.h"
|
||||||
#include "td/telegram/Global.h"
|
#include "td/telegram/Global.h"
|
||||||
#include "td/telegram/MessageEntity.h"
|
#include "td/telegram/MessageEntity.h"
|
||||||
#include "td/telegram/Td.h"
|
#include "td/telegram/Td.h"
|
||||||
@ -129,9 +130,9 @@ void get_user_info(Td *td, UserId user_id, Promise<td_api::object_ptr<td_api::us
|
|||||||
|
|
||||||
void set_user_info(Td *td, UserId user_id, td_api::object_ptr<td_api::formattedText> &&message,
|
void set_user_info(Td *td, UserId user_id, td_api::object_ptr<td_api::formattedText> &&message,
|
||||||
Promise<td_api::object_ptr<td_api::userSupportInfo>> &&promise) {
|
Promise<td_api::object_ptr<td_api::userSupportInfo>> &&promise) {
|
||||||
TRY_RESULT_PROMISE(promise, formatted_text,
|
TRY_RESULT_PROMISE(
|
||||||
get_formatted_text(td, DialogId(td->contacts_manager_->get_my_id()), std::move(message), false,
|
promise, formatted_text,
|
||||||
true, true, false));
|
get_formatted_text(td, td->dialog_manager_->get_my_dialog_id(), std::move(message), false, true, true, false));
|
||||||
td->create_handler<EditUserInfoQuery>(std::move(promise))->send(user_id, std::move(formatted_text));
|
td->create_handler<EditUserInfoQuery>(std::move(promise))->send(user_id, std::move(formatted_text));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6889,7 +6889,7 @@ void Td::on_request(uint64 id, const td_api::leaveChat &request) {
|
|||||||
td_api::make_object<td_api::chatMemberStatusCreator>(status.get_rank(), status.is_anonymous(), false);
|
td_api::make_object<td_api::chatMemberStatusCreator>(status.get_rank(), status.is_anonymous(), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
contacts_manager_->set_dialog_participant_status(dialog_id, DialogId(contacts_manager_->get_my_id()),
|
contacts_manager_->set_dialog_participant_status(dialog_id, dialog_manager_->get_my_dialog_id(),
|
||||||
std::move(new_status), std::move(promise));
|
std::move(new_status), std::move(promise));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user