Various improvements.

This commit is contained in:
levlam 2022-10-20 13:28:07 +03:00
parent bd78d57e56
commit e079b684f0
11 changed files with 23 additions and 21 deletions

View File

@ -749,6 +749,7 @@ set(TDLIB_SOURCE
td/telegram/files/FileLocation.hpp
td/telegram/files/FileManager.hpp
td/telegram/files/FileSourceId.hpp
td/telegram/ForumTopicEditedData.hpp
td/telegram/ForumTopicIcon.hpp
td/telegram/Game.hpp
td/telegram/InputInvoice.hpp

View File

@ -1303,7 +1303,7 @@ messageThreadInfo chat_id:int53 message_thread_id:int53 reply_info:messageReplyI
//@edit_icon_custom_emoji_id True, if icon's custom_emoji_id is changed
//@icon_custom_emoji_id New unique identifier of the custom emoji shown on the topic icon; 0 if none. Ignored if edit_icon_custom_emoji_id is false
//@edit_is_closed True, if the topic is reopened or closed
//@is_closed True, if the topic is closed, or false if it is reopened. Ignored if edit_is_closed is false
//@is_closed True, if the topic is closed; false if it is reopened. Ignored if edit_is_closed is false
forumTopicEditedData title:string edit_icon_custom_emoji_id:Bool icon_custom_emoji_id:int64 edit_is_closed:Bool is_closed:Bool = ForumTopicEditedData;
//@description Describes a forum topic icon @color Color of the topic icon in RGB format @custom_emoji_id Unique identifier of the custom emoji shown on the topic icon; 0 if none
@ -6247,7 +6247,7 @@ setBio bio:string = Ok;
//@description Changes the editable username of the current user @username The new value of the username. Use an empty string to remove the username. The username can't be completely removed if there is another active or disabled username
setUsername username:string = Ok;
//@description Changes active state for a username of the current user. The editable username can't be disabled. May return an error with a message "USERNAMES_ACTIVE_TOO_MUCH" if the maximum number of active usernames has been reached @username The username to change @is_active True, if the username must be activated, or false, if it must be disabled
//@description Changes active state for a username of the current user. The editable username can't be disabled. May return an error with a message "USERNAMES_ACTIVE_TOO_MUCH" if the maximum number of active usernames has been reached @username The username to change @is_active Pass true to activate the username; pass false to disable it
toggleUsernameIsActive username:string is_active:Bool = Ok;
//@description Changes order of active usernames of the current user @usernames The new order of active usernames. All currently active usernames must be specified
@ -6335,7 +6335,7 @@ disconnectAllWebsites = Ok;
//@description Changes the editable username of a supergroup or channel, requires owner privileges in the supergroup or channel @supergroup_id Identifier of the supergroup or channel @username New value of the username. Use an empty string to remove the username. The username can't be completely removed if there is another active or disabled username
setSupergroupUsername supergroup_id:int53 username:string = Ok;
//@description Changes active state for a username of a supergroup or channel, requires owner privileges in the supergroup or channel. The editable username can't be disabled. May return an error with a message "USERNAMES_ACTIVE_TOO_MUCH" if the maximum number of active usernames has been reached @supergroup_id Identifier of the supergroup or channel @username The username to change @is_active True, if the username must be activated, or false, if it must be disabled
//@description Changes active state for a username of a supergroup or channel, requires owner privileges in the supergroup or channel. The editable username can't be disabled. May return an error with a message "USERNAMES_ACTIVE_TOO_MUCH" if the maximum number of active usernames has been reached @supergroup_id Identifier of the supergroup or channel @username The username to change @is_active Pass true to activate the username; pass false to disable it
toggleSupergroupUsernameIsActive supergroup_id:int53 username:string is_active:Bool = Ok;
//@description Disables all active non-editable usernames of a supergroup or channel, requires owner privileges in the supergroup or channel @supergroup_id Identifier of the supergroup or channel

View File

@ -12067,7 +12067,7 @@ void ContactsManager::on_update_user_usernames(User *u, UserId user_id, Username
if (u->usernames != usernames) {
u->usernames = std::move(usernames);
u->is_username_changed = true;
LOG(DEBUG) << "Usernames has changed for " << user_id;
LOG(DEBUG) << "Usernames have changed for " << user_id;
u->is_changed = true;
}
}

View File

@ -364,7 +364,7 @@ static td_api::object_ptr<td_api::ChatEventAction> get_chat_event_action_object(
}
case telegram_api::channelAdminLogEventActionCreateTopic::ID: {
auto action = move_tl_object_as<telegram_api::channelAdminLogEventActionCreateTopic>(action_ptr);
auto topic_info = ForumTopicInfo(td, action->topic_);
auto topic_info = ForumTopicInfo(action->topic_);
if (topic_info.is_empty()) {
return nullptr;
}
@ -372,8 +372,8 @@ static td_api::object_ptr<td_api::ChatEventAction> get_chat_event_action_object(
}
case telegram_api::channelAdminLogEventActionEditTopic::ID: {
auto action = move_tl_object_as<telegram_api::channelAdminLogEventActionEditTopic>(action_ptr);
auto old_topic_info = ForumTopicInfo(td, action->prev_topic_);
auto new_topic_info = ForumTopicInfo(td, action->new_topic_);
auto old_topic_info = ForumTopicInfo(action->prev_topic_);
auto new_topic_info = ForumTopicInfo(action->new_topic_);
if (old_topic_info.is_empty() || new_topic_info.is_empty()) {
return nullptr;
}
@ -382,7 +382,7 @@ static td_api::object_ptr<td_api::ChatEventAction> get_chat_event_action_object(
}
case telegram_api::channelAdminLogEventActionDeleteTopic::ID: {
auto action = move_tl_object_as<telegram_api::channelAdminLogEventActionDeleteTopic>(action_ptr);
auto topic_info = ForumTopicInfo(td, action->topic_);
auto topic_info = ForumTopicInfo(action->topic_);
if (topic_info.is_empty()) {
return nullptr;
}
@ -393,10 +393,10 @@ static td_api::object_ptr<td_api::ChatEventAction> get_chat_event_action_object(
ForumTopicInfo old_topic_info;
ForumTopicInfo new_topic_info;
if (action->prev_topic_ != nullptr) {
old_topic_info = ForumTopicInfo(td, action->prev_topic_);
old_topic_info = ForumTopicInfo(action->prev_topic_);
}
if (action->new_topic_ != nullptr) {
new_topic_info = ForumTopicInfo(td, action->new_topic_);
new_topic_info = ForumTopicInfo(action->new_topic_);
}
if (old_topic_info.is_empty() && new_topic_info.is_empty()) {
return nullptr;

View File

@ -6,8 +6,6 @@
//
#include "td/telegram/ForumTopicEditedData.h"
#include "td/utils/logging.h"
namespace td {
td_api::object_ptr<td_api::forumTopicEditedData> ForumTopicEditedData::get_forum_topic_edited_data_object() const {

View File

@ -8,13 +8,12 @@
#include "td/telegram/MessageSender.h"
#include "td/telegram/ServerMessageId.h"
#include "td/telegram/Td.h"
#include "td/utils/logging.h"
namespace td {
ForumTopicInfo::ForumTopicInfo(Td *td, const tl_object_ptr<telegram_api::ForumTopic> &forum_topic_ptr) {
ForumTopicInfo::ForumTopicInfo(const tl_object_ptr<telegram_api::ForumTopic> &forum_topic_ptr) {
CHECK(forum_topic_ptr != nullptr);
if (forum_topic_ptr->get_id() != telegram_api::forumTopic::ID) {
LOG(ERROR) << "Receive " << to_string(forum_topic_ptr);

View File

@ -33,7 +33,7 @@ class ForumTopicInfo {
public:
ForumTopicInfo() = default;
ForumTopicInfo(Td *td, const tl_object_ptr<telegram_api::ForumTopic> &forum_topic_ptr);
explicit ForumTopicInfo(const tl_object_ptr<telegram_api::ForumTopic> &forum_topic_ptr);
bool is_empty() const {
return !top_thread_message_id_.is_valid();

View File

@ -6278,10 +6278,10 @@ void StickersManager::timeout_expired() {
}
void StickersManager::flush_pending_animated_emoji_clicks() {
if (pending_animated_emoji_clicks_.empty()) {
if (G()->close_flag()) {
return;
}
if (G()->close_flag()) {
if (pending_animated_emoji_clicks_.empty()) {
return;
}
auto clicks = std::move(pending_animated_emoji_clicks_);

View File

@ -6,9 +6,12 @@
//
#include "td/telegram/TranscriptionInfo.h"
#include "td/telegram/AccessRights.h"
#include "td/telegram/DialogId.h"
#include "td/telegram/Global.h"
#include "td/telegram/MessagesManager.h"
#include "td/telegram/Td.h"
#include "td/telegram/telegram_api.h"
#include "td/utils/buffer.h"
#include "td/utils/logging.h"

View File

@ -6,11 +6,11 @@
//
#include "td/telegram/Usernames.h"
#include "td/telegram/misc.h"
#include "td/telegram/secret_api.h"
#include "td/utils/algorithm.h"
#include "td/utils/FlatHashSet.h"
#include "td/utils/logging.h"
#include "td/utils/misc.h"
#include "td/utils/utf8.h"
namespace td {
@ -133,7 +133,7 @@ Usernames Usernames::deactivate_all() const {
result.disabled_usernames_.push_back(active_usernames_[i]);
}
}
td::append(result.disabled_usernames_, disabled_usernames_);
append(result.disabled_usernames_, disabled_usernames_);
CHECK(result.has_editable_username() == has_editable_username());
return result;
}

View File

@ -16,6 +16,7 @@
#include "td/utils/buffer.h"
#include "td/utils/common.h"
#include "td/utils/FlatHashMap.h"
#include "td/utils/FlatHashSet.h"
#include "td/utils/WaitFreeHashMap.h"