Use get_channel_full_const in get methods to avoid unneeded getChannelFull requests.
GitOrigin-RevId: 1959c781b6c85667065e38af125a87186746a233
This commit is contained in:
parent
d28a7245ea
commit
98ff412f7a
@ -12986,18 +12986,24 @@ bool ContactsManager::get_channel_has_linked_channel(const Channel *c) {
|
||||
}
|
||||
|
||||
ChannelId ContactsManager::get_channel_linked_channel_id(ChannelId channel_id) {
|
||||
auto channel_full = get_channel_full_force(channel_id, "get_channel_linked_channel_id");
|
||||
auto channel_full = get_channel_full_const(channel_id);
|
||||
if (channel_full == nullptr) {
|
||||
channel_full = get_channel_full_force(channel_id, "get_channel_linked_channel_id");
|
||||
if (channel_full == nullptr) {
|
||||
return ChannelId();
|
||||
}
|
||||
}
|
||||
return channel_full->linked_channel_id;
|
||||
}
|
||||
|
||||
int32 ContactsManager::get_channel_slow_mode_delay(ChannelId channel_id) {
|
||||
auto channel_full = get_channel_full_force(channel_id, "get_channel_slow_mode_delay");
|
||||
auto channel_full = get_channel_full_const(channel_id);
|
||||
if (channel_full == nullptr) {
|
||||
channel_full = get_channel_full_force(channel_id, "get_channel_slow_mode_delay");
|
||||
if (channel_full == nullptr) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return channel_full->slow_mode_delay;
|
||||
}
|
||||
|
||||
@ -13078,7 +13084,7 @@ void ContactsManager::reload_channel(ChannelId channel_id, Promise<Unit> &&promi
|
||||
td_->create_handler<GetChannelsQuery>(std::move(promise))->send(std::move(input_channel));
|
||||
}
|
||||
|
||||
const ContactsManager::ChannelFull *ContactsManager::get_channel_full(ChannelId channel_id) const {
|
||||
const ContactsManager::ChannelFull *ContactsManager::get_channel_full_const(ChannelId channel_id) const {
|
||||
auto p = channels_full_.find(channel_id);
|
||||
if (p == channels_full_.end()) {
|
||||
return nullptr;
|
||||
@ -13087,6 +13093,10 @@ const ContactsManager::ChannelFull *ContactsManager::get_channel_full(ChannelId
|
||||
}
|
||||
}
|
||||
|
||||
const ContactsManager::ChannelFull *ContactsManager::get_channel_full(ChannelId channel_id) const {
|
||||
return get_channel_full_const(channel_id);
|
||||
}
|
||||
|
||||
ContactsManager::ChannelFull *ContactsManager::get_channel_full(ChannelId channel_id, const char *source) {
|
||||
auto p = channels_full_.find(channel_id);
|
||||
if (p == channels_full_.end()) {
|
||||
|
@ -1105,6 +1105,7 @@ class ContactsManager : public Actor {
|
||||
Channel *add_channel(ChannelId channel_id, const char *source);
|
||||
|
||||
const ChannelFull *get_channel_full(ChannelId channel_id) const;
|
||||
const ChannelFull *get_channel_full_const(ChannelId channel_id) const;
|
||||
ChannelFull *get_channel_full(ChannelId channel_id, const char *source);
|
||||
ChannelFull *get_channel_full_force(ChannelId channel_id, const char *source);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user