Fix inputChannelFromMessage support.

This commit is contained in:
levlam 2023-05-15 11:47:05 +03:00
parent aa52648565
commit c7b9d54fdb
2 changed files with 9 additions and 7 deletions

View File

@ -3479,6 +3479,9 @@ class GetChannelsQuery final : public Td::ResultHandler {
CHECK(input_channel != nullptr); CHECK(input_channel != nullptr);
if (input_channel->get_id() == telegram_api::inputChannel::ID) { if (input_channel->get_id() == telegram_api::inputChannel::ID) {
channel_id_ = ChannelId(static_cast<const telegram_api::inputChannel *>(input_channel.get())->channel_id_); channel_id_ = ChannelId(static_cast<const telegram_api::inputChannel *>(input_channel.get())->channel_id_);
} else if (input_channel->get_id() == telegram_api::inputChannelFromMessage::ID) {
channel_id_ =
ChannelId(static_cast<const telegram_api::inputChannelFromMessage *>(input_channel.get())->channel_id_);
} }
vector<tl_object_ptr<telegram_api::InputChannel>> input_channels; vector<tl_object_ptr<telegram_api::InputChannel>> input_channels;
@ -14084,8 +14087,7 @@ bool ContactsManager::on_get_channel_error(ChannelId channel_id, const Status &s
auto c = get_channel(channel_id); auto c = get_channel(channel_id);
if (c == nullptr) { if (c == nullptr) {
if (Slice(source) == Slice("GetChannelDifferenceQuery") || if (Slice(source) == Slice("GetChannelDifferenceQuery") || Slice(source) == Slice("GetChannelsQuery")) {
(td_->auth_manager_->is_bot() && Slice(source) == Slice("GetChannelsQuery"))) {
// get channel difference after restart // get channel difference after restart
// get channel from server by its identifier // get channel from server by its identifier
return true; return true;
@ -18034,10 +18036,10 @@ void ContactsManager::on_chat_update(telegram_api::chat &chat, const char *sourc
ChannelId migrated_to_channel_id; ChannelId migrated_to_channel_id;
if (chat.flags_ & CHAT_FLAG_WAS_MIGRATED) { if (chat.flags_ & CHAT_FLAG_WAS_MIGRATED) {
switch (chat.migrated_to_->get_id()) { switch (chat.migrated_to_->get_id()) {
case telegram_api::inputChannelEmpty::ID: { case telegram_api::inputChannelFromMessage::ID:
LOG(ERROR) << "Receive empty upgraded to supergroup for " << chat_id << debug_str; case telegram_api::inputChannelEmpty::ID:
LOG(ERROR) << "Receive invalid information about upgraded supergroup for " << chat_id << debug_str;
break; break;
}
case telegram_api::inputChannel::ID: { case telegram_api::inputChannel::ID: {
auto input_channel = move_tl_object_as<telegram_api::inputChannel>(chat.migrated_to_); auto input_channel = move_tl_object_as<telegram_api::inputChannel>(chat.migrated_to_);
migrated_to_channel_id = ChannelId(input_channel->channel_id_); migrated_to_channel_id = ChannelId(input_channel->channel_id_);

View File

@ -37993,9 +37993,9 @@ void MessagesManager::get_channel_difference(DialogId dialog_id, int32 pts, bool
return; return;
} }
if (force && get_channel_difference_to_log_event_id_.count(dialog_id) == 0 && !td_->ignore_background_updates()) { if (force && get_channel_difference_to_log_event_id_.count(dialog_id) == 0 && !td_->ignore_background_updates() &&
input_channel->get_id() == telegram_api::inputChannel::ID) {
auto channel_id = dialog_id.get_channel_id(); auto channel_id = dialog_id.get_channel_id();
CHECK(input_channel->get_id() == telegram_api::inputChannel::ID);
auto access_hash = static_cast<const telegram_api::inputChannel &>(*input_channel).access_hash_; auto access_hash = static_cast<const telegram_api::inputChannel &>(*input_channel).access_hash_;
auto log_event = GetChannelDifferenceLogEvent(channel_id, access_hash); auto log_event = GetChannelDifferenceLogEvent(channel_id, access_hash);
auto log_event_id = binlog_add(G()->td_db()->get_binlog(), LogEvent::HandlerType::GetChannelDifference, auto log_event_id = binlog_add(G()->td_db()->get_binlog(), LogEvent::HandlerType::GetChannelDifference,