diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index c03fb2674..1d87fb4e9 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -869,9 +869,9 @@ chatInviteLinkCounts invite_link_counts:vector = ChatInvite //@description Describes a chat member joined a chat via an invite link //@user_id User identifier //@joined_chat_date Point in time (Unix timestamp) when the user joined the chat -//@via_chat_filter_invite_link True, if the user has joined the chat using an invite link for a chat filter +//@via_chat_folder_invite_link True, if the user has joined the chat using an invite link for a chat folder //@approver_user_id User identifier of the chat administrator, approved user join request -chatInviteLinkMember user_id:int53 joined_chat_date:int32 via_chat_filter_invite_link:Bool approver_user_id:int53 = ChatInviteLinkMember; +chatInviteLinkMember user_id:int53 joined_chat_date:int32 via_chat_folder_invite_link:Bool approver_user_id:int53 = ChatInviteLinkMember; //@description Contains a list of chat members joined a chat via an invite link @total_count Approximate total number of chat members found @members List of chat members, joined a chat via an invite link chatInviteLinkMembers total_count:int32 members:vector = ChatInviteLinkMembers; @@ -927,7 +927,7 @@ basicGroupFullInfo photo:chatPhoto description:string creator_user_id:int53 memb //@date Point in time (Unix timestamp) when the current user joined, or the point in time when the supergroup or channel was created, in case the user is not a member //@status Status of the current user in the supergroup or channel; custom title will always be empty //@member_count Number of members in the supergroup or channel; 0 if unknown. Currently, it is guaranteed to be known only if the supergroup or channel was received -//-through searchPublicChats, searchChatsNearby, getInactiveSupergroupChats, getSuitableDiscussionChats, getGroupsInCommon, getUserPrivacySettingRules, or in chatFilterInviteLinkInfo.missing_chat_ids +//-through searchPublicChats, searchChatsNearby, getInactiveSupergroupChats, getSuitableDiscussionChats, getGroupsInCommon, getUserPrivacySettingRules, or in chatFolderInviteLinkInfo.missing_chat_ids //@has_linked_chat True, if the channel has a discussion group, or the supergroup is the designated discussion group for a channel //@has_location True, if the supergroup is connected to a location, i.e. the supergroup is a location-based supergroup //@sign_messages True, if messages sent to the channel need to contain information about the sender. This field is only applicable to channels @@ -1294,17 +1294,17 @@ chatTypeSupergroup supergroup_id:int53 is_channel:Bool = ChatType; chatTypeSecret secret_chat_id:int32 user_id:int53 = ChatType; -//@description Represents an icon for a chat filter @name The chosen icon name for short filter representation; one of "All", "Unread", "Unmuted", "Bots", "Channels", "Groups", "Private", "Custom", "Setup", "Cat", "Crown", +//@description Represents an icon for a chat folder @name The chosen icon name for short folder representation; one of "All", "Unread", "Unmuted", "Bots", "Channels", "Groups", "Private", "Custom", "Setup", "Cat", "Crown", //-"Favorite", "Flower", "Game", "Home", "Love", "Mask", "Party", "Sport", "Study", "Trade", "Travel", "Work", "Airplane", "Book", "Light", "Like", "Money", "Note", "Palette" -chatFilterIcon name:string = ChatFilterIcon; +chatFolderIcon name:string = ChatFolderIcon; -//@description Represents a filter of user chats -//@title The title of the filter; 1-12 characters without line feeds -//@icon The chosen icon for the chat filter; may be null. If null, use getChatFilterDefaultIconName to get default icon name for the filter -//@is_shareable True if at least one link has been created for the filter -//@pinned_chat_ids The chat identifiers of pinned chats in the filtered chat list. There can be up to getOption("chat_filter_chosen_chat_count_max") pinned and always included non-secret chats and the same number of secret chats, but the limit can be increased with Telegram Premium -//@included_chat_ids The chat identifiers of always included chats in the filtered chat list. There can be up to getOption("chat_filter_chosen_chat_count_max") pinned and always included non-secret chats and the same number of secret chats, but the limit can be increased with Telegram Premium -//@excluded_chat_ids The chat identifiers of always excluded chats in the filtered chat list. There can be up to getOption("chat_filter_chosen_chat_count_max") always excluded non-secret chats and the same number of secret chats, but the limit can be increased with Telegram Premium +//@description Represents a folder for user chats +//@title The title of the folder; 1-12 characters without line feeds +//@icon The chosen icon for the chat folder; may be null. If null, use getChatFolderDefaultIconName to get default icon name for the folder +//@is_shareable True if at least one link has been created for the folder +//@pinned_chat_ids The chat identifiers of pinned chats in the folder. There can be up to getOption("chat_folder_chosen_chat_count_max") pinned and always included non-secret chats and the same number of secret chats, but the limit can be increased with Telegram Premium +//@included_chat_ids The chat identifiers of always included chats in the folder. There can be up to getOption("chat_folder_chosen_chat_count_max") pinned and always included non-secret chats and the same number of secret chats, but the limit can be increased with Telegram Premium +//@excluded_chat_ids The chat identifiers of always excluded chats in the folder. There can be up to getOption("chat_folder_chosen_chat_count_max") always excluded non-secret chats and the same number of secret chats, but the limit can be increased with Telegram Premium //@exclude_muted True, if muted chats need to be excluded //@exclude_read True, if read chats need to be excluded //@exclude_archived True, if archived chats need to be excluded @@ -1313,35 +1313,35 @@ chatFilterIcon name:string = ChatFilterIcon; //@include_bots True, if bots need to be included //@include_groups True, if basic groups and supergroups need to be included //@include_channels True, if channels need to be included -chatFilter title:string icon:chatFilterIcon is_shareable:Bool pinned_chat_ids:vector included_chat_ids:vector excluded_chat_ids:vector exclude_muted:Bool exclude_read:Bool exclude_archived:Bool include_contacts:Bool include_non_contacts:Bool include_bots:Bool include_groups:Bool include_channels:Bool = ChatFilter; +chatFolder title:string icon:chatFolderIcon is_shareable:Bool pinned_chat_ids:vector included_chat_ids:vector excluded_chat_ids:vector exclude_muted:Bool exclude_read:Bool exclude_archived:Bool include_contacts:Bool include_non_contacts:Bool include_bots:Bool include_groups:Bool include_channels:Bool = ChatFolder; -//@description Contains basic information about a chat filter -//@id Unique chat filter identifier -//@title The title of the filter; 1-12 characters without line feeds -//@icon The chosen or default icon for the chat filter -//@has_my_invite_links True, if the chat filter has invite links created by the current user -chatFilterInfo id:int32 title:string icon:chatFilterIcon has_my_invite_links:Bool = ChatFilterInfo; +//@description Contains basic information about a chat folder +//@id Unique chat folder identifier +//@title The title of the folder; 1-12 characters without line feeds +//@icon The chosen or default icon for the chat folder +//@has_my_invite_links True, if the chat folder has invite links created by the current user +chatFolderInfo id:int32 title:string icon:chatFolderIcon has_my_invite_links:Bool = ChatFolderInfo; -//@description Contains a chat filter invite link -//@invite_link The chat filter invite link +//@description Contains a chat folder invite link +//@invite_link The chat folder invite link //@name Name of the link //@chat_ids Identifiers of chats, included in the link -chatFilterInviteLink invite_link:string name:string chat_ids:vector = ChatFilterInviteLink; +chatFolderInviteLink invite_link:string name:string chat_ids:vector = ChatFolderInviteLink; -//@description Represents a list of chat filter invite links @invite_links List of the invite links -chatFilterInviteLinks invite_links:vector = ChatFilterInviteLinks; +//@description Represents a list of chat folder invite links @invite_links List of the invite links +chatFolderInviteLinks invite_links:vector = ChatFolderInviteLinks; -//@description Contains information about an invite link to a chat filter -//@chat_filter_info Basic information about the chat filter; chat filter identifier will be 0 if the user didn't have the chat filter yet -//@missing_chat_ids Identifiers of the chats from the link, which aren't added to the filter yet -//@added_chat_ids Identifiers of the chats from the link, which are added to the filter already -chatFilterInviteLinkInfo chat_filter_info:chatFilterInfo missing_chat_ids:vector added_chat_ids:vector = ChatFilterInviteLinkInfo; +//@description Contains information about an invite link to a chat folder +//@chat_folder_info Basic information about the chat folder; chat folder identifier will be 0 if the user didn't have the chat folder yet +//@missing_chat_ids Identifiers of the chats from the link, which aren't added to the folder yet +//@added_chat_ids Identifiers of the chats from the link, which are added to the folder already +chatFolderInviteLinkInfo chat_folder_info:chatFolderInfo missing_chat_ids:vector added_chat_ids:vector = ChatFolderInviteLinkInfo; -//@description Describes a recommended chat filter @filter The chat filter @param_description Chat filter description -recommendedChatFilter filter:chatFilter description:string = RecommendedChatFilter; +//@description Describes a recommended chat folder @folder The chat folder @param_description Chat folder description +recommendedChatFolder folder:chatFolder description:string = RecommendedChatFolder; -//@description Contains a list of recommended chat filters @chat_filters List of recommended chat filters -recommendedChatFilters chat_filters:vector = RecommendedChatFilters; +//@description Contains a list of recommended chat folders @chat_folders List of recommended chat folders +recommendedChatFolders chat_folders:vector = RecommendedChatFolders; //@class ChatList @description Describes a list of chats @@ -1352,8 +1352,8 @@ chatListMain = ChatList; //@description A list of chats usually located at the top of the main chat list. Unmuted chats are automatically moved from the Archive to the Main chat list when a new message arrives chatListArchive = ChatList; -//@description A list of chats belonging to a chat filter @chat_filter_id Chat filter identifier -chatListFilter chat_filter_id:int32 = ChatList; +//@description A list of chats added to a chat folder @chat_folder_id Chat folder identifier +chatListFolder chat_folder_id:int32 = ChatList; //@description Contains a list of chat lists @chat_lists List of chat lists chatLists chat_lists:vector = ChatLists; @@ -3668,8 +3668,8 @@ chatEventPollStopped message:message = ChatEventAction; //@description A new member joined the chat chatEventMemberJoined = ChatEventAction; -//@description A new member joined the chat via an invite link @invite_link Invite link used to join the chat @via_chat_filter_invite_link True, if the user has joined the chat using an invite link for a chat filter -chatEventMemberJoinedByInviteLink invite_link:chatInviteLink via_chat_filter_invite_link:Bool = ChatEventAction; +//@description A new member joined the chat via an invite link @invite_link Invite link used to join the chat @via_chat_folder_invite_link True, if the user has joined the chat using an invite link for a chat folder +chatEventMemberJoinedByInviteLink invite_link:chatInviteLink via_chat_folder_invite_link:Bool = ChatEventAction; //@description A new member was accepted to the chat by an administrator @approver_user_id User identifier of the chat administrator, approved user join request @invite_link Invite link used to join the chat; may be null chatEventMemberJoinedByRequest approver_user_id:int53 invite_link:chatInviteLink = ChatEventAction; @@ -3870,11 +3870,11 @@ premiumLimitTypeSavedAnimationCount = PremiumLimitType; //@description The maximum number of favorite stickers premiumLimitTypeFavoriteStickerCount = PremiumLimitType; -//@description The maximum number of chat filters -premiumLimitTypeChatFilterCount = PremiumLimitType; +//@description The maximum number of chat folders +premiumLimitTypeChatFolderCount = PremiumLimitType; -//@description The maximum number of pinned and always included, or always excluded chats in a chat filter -premiumLimitTypeChatFilterChosenChatCount = PremiumLimitType; +//@description The maximum number of pinned and always included, or always excluded chats in a chat folder +premiumLimitTypeChatFolderChosenChatCount = PremiumLimitType; //@description The maximum number of pinned chats in the archive chat list premiumLimitTypePinnedArchivedChatCount = PremiumLimitType; @@ -4653,8 +4653,8 @@ internalLinkTypeBotStartInGroup bot_username:string start_parameter:string admin //@description The link is a link to the change phone number section of the app internalLinkTypeChangePhoneNumber = InternalLinkType; -//@description The link is an invite link to a chat filter. Call checkChatFilterInviteLink with the given invite link to process the link @invite_link Internal representation of the invite link -internalLinkTypeChatFilterInvite invite_link:string = InternalLinkType; +//@description The link is an invite link to a chat folder. Call checkChatFolderInviteLink with the given invite link to process the link @invite_link Internal representation of the invite link +internalLinkTypeChatFolderInvite invite_link:string = InternalLinkType; //@description The link is a chat invite link. Call checkChatInviteLink with the given invite link to process the link @invite_link Internal representation of the invite link internalLinkTypeChatInvite invite_link:string = InternalLinkType; @@ -4665,8 +4665,8 @@ internalLinkTypeDefaultMessageAutoDeleteTimerSettings = InternalLinkType; //@description The link is a link to the edit profile section of the app settings internalLinkTypeEditProfileSettings = InternalLinkType; -//@description The link is a link to the filter section of the app settings -internalLinkTypeFilterSettings = InternalLinkType; +//@description The link is a link to the folder section of the app settings +internalLinkTypeFolderSettings = InternalLinkType; //@description The link is a link to a game. Call searchPublicChat with the given bot username, check that the user is a bot, ask the current user to select a chat to send the game, and then call sendMessage with inputMessageGame //@bot_username Username of the bot that owns the game @@ -5386,8 +5386,8 @@ updateChatIsBlocked chat_id:int53 is_blocked:Bool = Update; //@description A chat's has_scheduled_messages field has changed @chat_id Chat identifier @has_scheduled_messages New value of has_scheduled_messages updateChatHasScheduledMessages chat_id:int53 has_scheduled_messages:Bool = Update; -//@description The list of chat filters or a chat filter has changed @chat_filters The new list of chat filters @main_chat_list_position Position of the main chat list among chat filters, 0-based -updateChatFilters chat_filters:vector main_chat_list_position:int32 = Update; +//@description The list of chat folders or a chat folder has changed @chat_folders The new list of chat folders @main_chat_list_position Position of the main chat list among chat folders, 0-based +updateChatFolders chat_folders:vector main_chat_list_position:int32 = Update; //@description The number of online group members has changed. This update with non-zero number of online group members is sent only for currently opened chats. //-There is no guarantee that it will be sent just after the number of online users has changed @@ -5673,10 +5673,10 @@ updatePollAnswer poll_id:int64 user_id:int53 option_ids:vector = Update; //@actor_user_id Identifier of the user, changing the rights //@date Point in time (Unix timestamp) when the user rights was changed //@invite_link If user has joined the chat using an invite link, the invite link; may be null -//@via_chat_filter_invite_link True, if the user has joined the chat using an invite link for a chat filter +//@via_chat_folder_invite_link True, if the user has joined the chat using an invite link for a chat folder //@old_chat_member Previous chat member //@new_chat_member New chat member -updateChatMember chat_id:int53 actor_user_id:int53 date:int32 invite_link:chatInviteLink via_chat_filter_invite_link:Bool old_chat_member:chatMember new_chat_member:chatMember = Update; +updateChatMember chat_id:int53 actor_user_id:int53 date:int32 invite_link:chatInviteLink via_chat_folder_invite_link:Bool old_chat_member:chatMember new_chat_member:chatMember = Update; //@description A user sent a join request to a chat; for bots only //@chat_id Chat identifier @@ -6791,56 +6791,56 @@ getChatListsToAddChat chat_id:int53 = ChatLists; //@chat_list The chat list. Use getChatListsToAddChat to get suitable chat lists addChatToList chat_id:int53 chat_list:ChatList = Ok; -//@description Returns information about a chat filter by its identifier @chat_filter_id Chat filter identifier -getChatFilter chat_filter_id:int32 = ChatFilter; +//@description Returns information about a chat folder by its identifier @chat_folder_id Chat folder identifier +getChatFolder chat_folder_id:int32 = ChatFolder; -//@description Creates new chat filter. Returns information about the created chat filter. There can be up to getOption("chat_filter_count_max") chat filters, but the limit can be increased with Telegram Premium @filter Chat filter -createChatFilter filter:chatFilter = ChatFilterInfo; +//@description Creates new chat folder. Returns information about the created chat folder. There can be up to getOption("chat_folder_count_max") chat folders, but the limit can be increased with Telegram Premium @folder The new chat folder +createChatFolder folder:chatFolder = ChatFolderInfo; -//@description Edits existing chat filter. Returns information about the edited chat filter @chat_filter_id Chat filter identifier @filter The edited chat filter -editChatFilter chat_filter_id:int32 filter:chatFilter = ChatFilterInfo; +//@description Edits existing chat folder. Returns information about the edited chat folder @chat_folder_id Chat folder identifier @folder The edited chat folder +editChatFolder chat_folder_id:int32 folder:chatFolder = ChatFolderInfo; -//@description Deletes existing chat filter @chat_filter_id Chat filter identifier @leave_chat_ids Identifiers of the chats to leave. The chats must be pinned or always included by the filter -deleteChatFilter chat_filter_id:int32 leave_chat_ids:vector = Ok; +//@description Deletes existing chat folder @chat_folder_id Chat folder identifier @leave_chat_ids Identifiers of the chats to leave. The chats must be pinned or always included in the folder +deleteChatFolder chat_folder_id:int32 leave_chat_ids:vector = Ok; -//@description Returns identifiers of pinned or always included chats from a chat filter, which are suggested to be left when the chat filter is deleted @chat_filter_id Chat filter identifier -getChatFilterChatsToLeave chat_filter_id:int32 = Chats; +//@description Returns identifiers of pinned or always included chats from a chat folder, which are suggested to be left when the chat folder is deleted @chat_folder_id Chat folder identifier +getChatFolderChatsToLeave chat_folder_id:int32 = Chats; -//@description Changes the order of chat filters @chat_filter_ids Identifiers of chat filters in the new correct order @main_chat_list_position Position of the main chat list among chat filters, 0-based. Can be non-zero only for Premium users -reorderChatFilters chat_filter_ids:vector main_chat_list_position:int32 = Ok; +//@description Changes the order of chat folders @chat_folder_ids Identifiers of chat folders in the new correct order @main_chat_list_position Position of the main chat list among chat folders, 0-based. Can be non-zero only for Premium users +reorderChatFolders chat_folder_ids:vector main_chat_list_position:int32 = Ok; -//@description Returns recommended chat filters for the current user -getRecommendedChatFilters = RecommendedChatFilters; +//@description Returns recommended chat folders for the current user +getRecommendedChatFolders = RecommendedChatFolders; -//@description Returns default icon name for a filter. Can be called synchronously @filter Chat filter -getChatFilterDefaultIconName filter:chatFilter = ChatFilterIcon; +//@description Returns default icon name for a folder. Can be called synchronously @folder Chat folder +getChatFolderDefaultIconName folder:chatFolder = ChatFolderIcon; -//@description Creates a new invite link for a chat filter. A link can be created for a filter if it has only pinned and included chats -//@chat_filter_id Chat filter identifier +//@description Creates a new invite link for a chat folder. A link can be created for a chat folder if it has only pinned and included chats +//@chat_folder_id Chat folder identifier //@name Name of the link; 0-32 characters //@chat_ids Identifiers of basic group, supergroup, or channel chats to be accessible by the invite link. The chats must be public, or the user must be able to invite new members to them by an invite link. Basic groups will be automatically converted to supergroups before link creation -createChatFilterInviteLink chat_filter_id:int32 name:string chat_ids:vector = ChatFilterInviteLink; +createChatFolderInviteLink chat_folder_id:int32 name:string chat_ids:vector = ChatFolderInviteLink; -//@description Returns invite links created by the current user for a shareable chat filter @chat_filter_id Chat filter identifier -getChatFilterInviteLinks chat_filter_id:int32 = ChatFilterInviteLinks; +//@description Returns invite links created by the current user for a shareable chat folder @chat_folder_id Chat folder identifier +getChatFolderInviteLinks chat_folder_id:int32 = ChatFolderInviteLinks; -//@description Edits an invite link for a chat filter -//@chat_filter_id Chat filter identifier +//@description Edits an invite link for a chat folder +//@chat_folder_id Chat folder identifier //@invite_link Invite link to be edited //@name New name of the link; 0-32 characters //@chat_ids New identifiers of basic group, supergroup, or channel chats to be accessible by the invite link. The chats must be public, or the user must be able to invite new members to them by an invite link. Basic groups will be automatically converted to supergroups before link editing -editChatFilterInviteLink chat_filter_id:int32 invite_link:string name:string chat_ids:vector = ChatFilterInviteLink; +editChatFolderInviteLink chat_folder_id:int32 invite_link:string name:string chat_ids:vector = ChatFolderInviteLink; -//@description Deletes an invite link for a chat filter -//@chat_filter_id Chat filter identifier +//@description Deletes an invite link for a chat folder +//@chat_folder_id Chat folder identifier //@invite_link Invite link to be deleted -deleteChatFilterInviteLink chat_filter_id:int32 invite_link:string = Ok; +deleteChatFolderInviteLink chat_folder_id:int32 invite_link:string = Ok; -//@description Checks the validity of an invite link for a chat filter and returns information about the corresponding chat filter @invite_link Invite link to be checked -checkChatFilterInviteLink invite_link:string = ChatFilterInviteLinkInfo; +//@description Checks the validity of an invite link for a chat folder and returns information about the corresponding chat folder @invite_link Invite link to be checked +checkChatFolderInviteLink invite_link:string = ChatFolderInviteLinkInfo; -//@description Adds a chat filter by an invite link @invite_link Invite link for the chat filter @chat_ids Identifiers of the chats added to the chat filter. The chats are automatically joined if they aren't joined yet -addChatFilterByInviteLink invite_link:string chat_ids:vector = Ok; +//@description Adds a chat folder by an invite link @invite_link Invite link for the chat folder @chat_ids Identifiers of the chats added to the chat folder. The chats are automatically joined if they aren't joined yet +addChatFolderByInviteLink invite_link:string chat_ids:vector = Ok; //@description Changes the chat title. Supported only for basic groups, supergroups and channels. Requires can_change_info administrator right diff --git a/td/telegram/ConfigManager.cpp b/td/telegram/ConfigManager.cpp index 3cc46a7d2..8be6a4675 100644 --- a/td/telegram/ConfigManager.cpp +++ b/td/telegram/ConfigManager.cpp @@ -2037,8 +2037,8 @@ void ConfigManager::process_app_config(tl_object_ptr &c bool is_premium = options.get_option_boolean("is_premium"); if (is_premium) { - options.set_option_integer("chat_filter_count_max", options.get_option_integer("dialog_filters_limit_premium", 20)); - options.set_option_integer("chat_filter_chosen_chat_count_max", + options.set_option_integer("chat_folder_count_max", options.get_option_integer("dialog_filters_limit_premium", 20)); + options.set_option_integer("chat_folder_chosen_chat_count_max", options.get_option_integer("dialog_filters_chats_limit_premium", 200)); options.set_option_integer("bio_length_max", options.get_option_integer("about_length_limit_premium", 140)); options.set_option_integer("saved_animations_limit", options.get_option_integer("saved_gifs_limit_premium", 400)); @@ -2049,8 +2049,8 @@ void ConfigManager::process_app_config(tl_object_ptr &c options.set_option_integer("pinned_archived_chat_count_max", options.get_option_integer("dialogs_folder_pinned_limit_premium", 200)); } else { - options.set_option_integer("chat_filter_count_max", options.get_option_integer("dialog_filters_limit_default", 10)); - options.set_option_integer("chat_filter_chosen_chat_count_max", + options.set_option_integer("chat_folder_count_max", options.get_option_integer("dialog_filters_limit_default", 10)); + options.set_option_integer("chat_folder_chosen_chat_count_max", options.get_option_integer("dialog_filters_chats_limit_default", 100)); options.set_option_integer("bio_length_max", options.get_option_integer("about_length_limit_default", 70)); options.set_option_integer("saved_animations_limit", options.get_option_integer("saved_gifs_limit_default", 200)); diff --git a/td/telegram/DialogFilter.cpp b/td/telegram/DialogFilter.cpp index f7cd72d1e..9841eaafd 100644 --- a/td/telegram/DialogFilter.cpp +++ b/td/telegram/DialogFilter.cpp @@ -26,7 +26,7 @@ namespace td { int32 DialogFilter::get_max_filter_dialogs() { - return narrow_cast(G()->get_option_integer("chat_filter_chosen_chat_count_max", 100)); + return narrow_cast(G()->get_option_integer("chat_folder_chosen_chat_count_max", 100)); } unique_ptr DialogFilter::get_dialog_filter( @@ -93,9 +93,9 @@ unique_ptr DialogFilter::get_dialog_filter( } Result> DialogFilter::create_dialog_filter(Td *td, DialogFilterId dialog_filter_id, - td_api::object_ptr filter) { + td_api::object_ptr filter) { if (filter == nullptr) { - return Status::Error(400, "Chat filter must be non-empty"); + return Status::Error(400, "Chat folder must be non-empty"); } string icon_name; if (filter->icon_ != nullptr) { @@ -368,7 +368,7 @@ string DialogFilter::get_chosen_or_default_icon_name() const { return "Custom"; } -string DialogFilter::get_default_icon_name(const td_api::chatFilter *filter) { +string DialogFilter::get_default_icon_name(const td_api::chatFolder *filter) { if (filter->icon_ != nullptr && !filter->icon_->name_.empty() && !get_emoji_by_icon_name(filter->icon_->name_).empty()) { return filter->icon_->name_; @@ -455,7 +455,7 @@ telegram_api::object_ptr DialogFilter::get_input_dia InputDialogId::get_input_peers(excluded_dialog_ids_)); } -td_api::object_ptr DialogFilter::get_chat_filter_object( +td_api::object_ptr DialogFilter::get_chat_folder_object( const vector &unknown_dialog_ids) const { auto get_chat_ids = [unknown_dialog_ids](const vector &input_dialog_ids) { vector chat_ids; @@ -469,20 +469,20 @@ td_api::object_ptr DialogFilter::get_chat_filter_object( return chat_ids; }; - td_api::object_ptr icon; + td_api::object_ptr icon; auto icon_name = get_icon_name(); if (!icon_name.empty()) { - icon = td_api::make_object(icon_name); + icon = td_api::make_object(icon_name); } - return td_api::make_object( + return td_api::make_object( title_, std::move(icon), is_shareable_, get_chat_ids(pinned_dialog_ids_), get_chat_ids(included_dialog_ids_), get_chat_ids(excluded_dialog_ids_), exclude_muted_, exclude_read_, exclude_archived_, include_contacts_, include_non_contacts_, include_bots_, include_groups_, include_channels_); } -td_api::object_ptr DialogFilter::get_chat_filter_info_object() const { - return td_api::make_object( - dialog_filter_id_.get(), title_, td_api::make_object(get_chosen_or_default_icon_name()), +td_api::object_ptr DialogFilter::get_chat_folder_info_object() const { + return td_api::make_object( + dialog_filter_id_.get(), title_, td_api::make_object(get_chosen_or_default_icon_name()), has_my_invites_); } @@ -780,7 +780,7 @@ bool DialogFilter::set_dialog_filters_order(vector> &di if (old_dialog_filter_ids == dialog_filter_ids) { return false; } - LOG(INFO) << "Reorder chat filters from " << old_dialog_filter_ids << " to " << dialog_filter_ids; + LOG(INFO) << "Reorder chat folders from " << old_dialog_filter_ids << " to " << dialog_filter_ids; if (dialog_filter_ids.size() != old_dialog_filter_ids.size()) { for (auto dialog_filter_id : old_dialog_filter_ids) { diff --git a/td/telegram/DialogFilter.h b/td/telegram/DialogFilter.h index 5b7a6b76e..92cda25b2 100644 --- a/td/telegram/DialogFilter.h +++ b/td/telegram/DialogFilter.h @@ -33,7 +33,7 @@ class DialogFilter { bool with_id); static Result> create_dialog_filter(Td *td, DialogFilterId dialog_filter_id, - td_api::object_ptr filter); + td_api::object_ptr filter); void set_dialog_is_pinned(InputDialogId input_dialog_id, bool is_pinned); @@ -79,13 +79,13 @@ class DialogFilter { string get_icon_name() const; - static string get_default_icon_name(const td_api::chatFilter *filter); + static string get_default_icon_name(const td_api::chatFolder *filter); telegram_api::object_ptr get_input_dialog_filter() const; - td_api::object_ptr get_chat_filter_object(const vector &unknown_dialog_ids) const; + td_api::object_ptr get_chat_folder_object(const vector &unknown_dialog_ids) const; - td_api::object_ptr get_chat_filter_info_object() const; + td_api::object_ptr get_chat_folder_info_object() const; void for_each_dialog(std::function callback) const; diff --git a/td/telegram/DialogFilterId.h b/td/telegram/DialogFilterId.h index fb55a2470..3f1ea05d7 100644 --- a/td/telegram/DialogFilterId.h +++ b/td/telegram/DialogFilterId.h @@ -73,7 +73,7 @@ struct DialogFilterIdHash { }; inline StringBuilder &operator<<(StringBuilder &string_builder, DialogFilterId dialog_filter_id) { - return string_builder << "filter " << dialog_filter_id.get(); + return string_builder << "folder " << dialog_filter_id.get(); } } // namespace td diff --git a/td/telegram/DialogFilterInviteLink.cpp b/td/telegram/DialogFilterInviteLink.cpp index 9a18f4216..d510ede2c 100644 --- a/td/telegram/DialogFilterInviteLink.cpp +++ b/td/telegram/DialogFilterInviteLink.cpp @@ -27,8 +27,8 @@ DialogFilterInviteLink::DialogFilterInviteLink( } } -td_api::object_ptr DialogFilterInviteLink::get_chat_filter_invite_link_object() const { - return td_api::make_object(invite_link_, title_, DialogId::get_chat_ids(dialog_ids_)); +td_api::object_ptr DialogFilterInviteLink::get_chat_folder_invite_link_object() const { + return td_api::make_object(invite_link_, title_, DialogId::get_chat_ids(dialog_ids_)); } bool DialogFilterInviteLink::is_valid_invite_link(Slice invite_link) { diff --git a/td/telegram/DialogFilterInviteLink.h b/td/telegram/DialogFilterInviteLink.h index 65c79e029..2a0a95cd0 100644 --- a/td/telegram/DialogFilterInviteLink.h +++ b/td/telegram/DialogFilterInviteLink.h @@ -33,7 +33,7 @@ class DialogFilterInviteLink { DialogFilterInviteLink(Td *td, telegram_api::object_ptr exported_invite); - td_api::object_ptr get_chat_filter_invite_link_object() const; + td_api::object_ptr get_chat_folder_invite_link_object() const; bool is_valid() const { return !invite_link_.empty(); diff --git a/td/telegram/DialogFilterManager.cpp b/td/telegram/DialogFilterManager.cpp index af80f9815..1ddbc1536 100644 --- a/td/telegram/DialogFilterManager.cpp +++ b/td/telegram/DialogFilterManager.cpp @@ -124,10 +124,10 @@ class UpdateDialogFiltersOrderQuery final : public Td::ResultHandler { }; class ExportChatlistInviteQuery final : public Td::ResultHandler { - Promise> promise_; + Promise> promise_; public: - explicit ExportChatlistInviteQuery(Promise> &&promise) + explicit ExportChatlistInviteQuery(Promise> &&promise) : promise_(std::move(promise)) { } @@ -146,7 +146,7 @@ class ExportChatlistInviteQuery final : public Td::ResultHandler { auto ptr = result_ptr.move_as_ok(); LOG(INFO) << "Receive result for ExportChatlistInviteQuery: " << to_string(ptr); td_->dialog_filter_manager_->on_get_dialog_filter(std::move(ptr->filter_)); - promise_.set_value(DialogFilterInviteLink(td_, std::move(ptr->invite_)).get_chat_filter_invite_link_object()); + promise_.set_value(DialogFilterInviteLink(td_, std::move(ptr->invite_)).get_chat_folder_invite_link_object()); } void on_error(Status status) final { @@ -155,11 +155,11 @@ class ExportChatlistInviteQuery final : public Td::ResultHandler { }; class GetExportedChatlistInvitesQuery final : public Td::ResultHandler { - Promise> promise_; + Promise> promise_; DialogFilterId dialog_filter_id_; public: - explicit GetExportedChatlistInvitesQuery(Promise> &&promise) + explicit GetExportedChatlistInvitesQuery(Promise> &&promise) : promise_(std::move(promise)) { } @@ -179,10 +179,10 @@ class GetExportedChatlistInvitesQuery final : public Td::ResultHandler { LOG(INFO) << "Receive result for GetExportedChatlistInvitesQuery: " << to_string(ptr); td_->contacts_manager_->on_get_users(std::move(ptr->users_), "GetExportedChatlistInvitesQuery"); td_->contacts_manager_->on_get_chats(std::move(ptr->chats_), "GetExportedChatlistInvitesQuery"); - td_api::object_ptr result; + td_api::object_ptr result; for (auto &invite : ptr->invites_) { result->invite_links_.push_back( - DialogFilterInviteLink(td_, std::move(invite)).get_chat_filter_invite_link_object()); + DialogFilterInviteLink(td_, std::move(invite)).get_chat_folder_invite_link_object()); } td_->dialog_filter_manager_->set_dialog_filter_has_my_invite_links(dialog_filter_id_, !result->invite_links_.empty()); @@ -195,10 +195,10 @@ class GetExportedChatlistInvitesQuery final : public Td::ResultHandler { }; class EditExportedChatlistInviteQuery final : public Td::ResultHandler { - Promise> promise_; + Promise> promise_; public: - explicit EditExportedChatlistInviteQuery(Promise> &&promise) + explicit EditExportedChatlistInviteQuery(Promise> &&promise) : promise_(std::move(promise)) { } @@ -218,7 +218,7 @@ class EditExportedChatlistInviteQuery final : public Td::ResultHandler { auto ptr = result_ptr.move_as_ok(); LOG(INFO) << "Receive result for EditExportedChatlistInviteQuery: " << to_string(ptr); - promise_.set_value(DialogFilterInviteLink(td_, std::move(ptr)).get_chat_filter_invite_link_object()); + promise_.set_value(DialogFilterInviteLink(td_, std::move(ptr)).get_chat_folder_invite_link_object()); } void on_error(Status status) final { @@ -312,11 +312,11 @@ class GetLeaveChatlistSuggestionsQuery final : public Td::ResultHandler { }; class CheckChatlistInviteQuery final : public Td::ResultHandler { - Promise> promise_; + Promise> promise_; string invite_link_; public: - explicit CheckChatlistInviteQuery(Promise> &&promise) + explicit CheckChatlistInviteQuery(Promise> &&promise) : promise_(std::move(promise)) { } @@ -553,15 +553,15 @@ void DialogFilterManager::init() { for (auto &dialog_filter : log_event.dialog_filters_out) { add_dialog_filter(std::move(dialog_filter), false, "binlog"); } - LOG(INFO) << "Loaded server chat filters " + LOG(INFO) << "Loaded server chat folders " << DialogFilter::get_dialog_filter_ids(server_dialog_filters_, server_main_dialog_list_position_) - << " and local chat filters " + << " and local chat folders " << DialogFilter::get_dialog_filter_ids(dialog_filters_, main_dialog_list_position_); } else { - LOG(ERROR) << "Failed to parse chat filters from binlog"; + LOG(ERROR) << "Failed to parse chat folders from binlog"; } } - send_update_chat_filters(); // always send updateChatFilters + send_update_chat_folders(); // always send updateChatFolders if (is_authorized) { if (need_synchronize_dialog_filters()) { @@ -646,7 +646,7 @@ vector DialogFilterManager::get_pinned_dialog_ids(DialogFilterId dialo Status DialogFilterManager::set_dialog_is_pinned(DialogFilterId dialog_filter_id, InputDialogId input_dialog_id, bool is_pinned) { - CHECK(is_update_chat_filters_sent_); + CHECK(is_update_chat_folders_sent_); auto old_dialog_filter = get_dialog_filter(dialog_filter_id); CHECK(old_dialog_filter != nullptr); auto new_dialog_filter = make_unique(*old_dialog_filter); @@ -662,7 +662,7 @@ Status DialogFilterManager::set_dialog_is_pinned(DialogFilterId dialog_filter_id Status DialogFilterManager::set_pinned_dialog_ids(DialogFilterId dialog_filter_id, vector input_dialog_ids, bool need_synchronize) { - CHECK(is_update_chat_filters_sent_); + CHECK(is_update_chat_folders_sent_); auto old_dialog_filter = get_dialog_filter(dialog_filter_id); CHECK(old_dialog_filter != nullptr); auto new_dialog_filter = make_unique(*old_dialog_filter); @@ -675,7 +675,7 @@ Status DialogFilterManager::set_pinned_dialog_ids(DialogFilterId dialog_filter_i } Status DialogFilterManager::add_dialog(DialogFilterId dialog_filter_id, InputDialogId input_dialog_id) { - CHECK(is_update_chat_filters_sent_); + CHECK(is_update_chat_folders_sent_); auto old_dialog_filter = get_dialog_filter(dialog_filter_id); CHECK(old_dialog_filter != nullptr); if (old_dialog_filter->is_dialog_included(input_dialog_id.get_dialog_id())) { @@ -701,17 +701,17 @@ bool DialogFilterManager::is_recommended_dialog_filter(const DialogFilter *dialo return false; } -td_api::object_ptr DialogFilterManager::get_chat_filter_object(DialogFilterId dialog_filter_id) { +td_api::object_ptr DialogFilterManager::get_chat_folder_object(DialogFilterId dialog_filter_id) { CHECK(!td_->auth_manager_->is_bot()); auto dialog_filter = get_dialog_filter(dialog_filter_id); if (dialog_filter == nullptr) { return nullptr; } - return get_chat_filter_object(dialog_filter); + return get_chat_folder_object(dialog_filter); } -td_api::object_ptr DialogFilterManager::get_chat_filter_object(const DialogFilter *dialog_filter) { +td_api::object_ptr DialogFilterManager::get_chat_folder_object(const DialogFilter *dialog_filter) { DialogFilterId dialog_filter_id = dialog_filter->get_dialog_filter_id(); vector left_dialog_ids; @@ -731,16 +731,16 @@ td_api::object_ptr DialogFilterManager::get_chat_filter_obje } }); - auto result = dialog_filter->get_chat_filter_object(unknown_dialog_ids); + auto result = dialog_filter->get_chat_folder_object(unknown_dialog_ids); if (dialog_filter_id.is_valid()) { - delete_dialogs_from_filter(dialog_filter, std::move(left_dialog_ids), "get_chat_filter_object"); + delete_dialogs_from_filter(dialog_filter, std::move(left_dialog_ids), "get_chat_folder_object"); } return result; } void DialogFilterManager::get_recommended_dialog_filters( - Promise> &&promise) { + Promise> &&promise) { CHECK(!td_->auth_manager_->is_bot()); auto query_promise = PromiseCreator::lambda( [actor_id = actor_id(this), promise = std::move(promise)]( @@ -753,7 +753,7 @@ void DialogFilterManager::get_recommended_dialog_filters( void DialogFilterManager::on_get_recommended_dialog_filters( Result>> result, - Promise> &&promise) { + Promise> &&promise) { if (result.is_error()) { return promise.set_error(result.move_as_error()); } @@ -788,25 +788,25 @@ void DialogFilterManager::on_get_recommended_dialog_filters( void DialogFilterManager::on_load_recommended_dialog_filters( Result &&result, vector &&filters, - Promise> &&promise) { + Promise> &&promise) { TRY_STATUS_PROMISE(promise, G()->close_status()); if (result.is_error()) { return promise.set_error(result.move_as_error()); } CHECK(!td_->auth_manager_->is_bot()); - auto chat_filters = transform(filters, [this](const RecommendedDialogFilter &recommended_dialog_filter) { - return td_api::make_object( - get_chat_filter_object(recommended_dialog_filter.dialog_filter.get()), recommended_dialog_filter.description); + auto chat_folders = transform(filters, [this](const RecommendedDialogFilter &recommended_dialog_filter) { + return td_api::make_object( + get_chat_folder_object(recommended_dialog_filter.dialog_filter.get()), recommended_dialog_filter.description); }); recommended_dialog_filters_ = std::move(filters); - promise.set_value(td_api::make_object(std::move(chat_filters))); + promise.set_value(td_api::make_object(std::move(chat_folders))); } void DialogFilterManager::load_dialog_filter(DialogFilterId dialog_filter_id, bool force, Promise &&promise) { CHECK(!td_->auth_manager_->is_bot()); if (!dialog_filter_id.is_valid()) { - return promise.set_error(Status::Error(400, "Invalid chat filter identifier specified")); + return promise.set_error(Status::Error(400, "Invalid chat folder identifier specified")); } auto dialog_filter = get_dialog_filter(dialog_filter_id); @@ -894,7 +894,7 @@ void DialogFilterManager::on_load_dialog_filter_dialogs(DialogFilterId dialog_fi if (old_dialog_filter == nullptr) { return promise.set_value(Unit()); } - CHECK(is_update_chat_filters_sent_); + CHECK(is_update_chat_folders_sent_); delete_dialogs_from_filter(old_dialog_filter, std::move(dialog_ids), "on_load_dialog_filter_dialogs"); @@ -968,7 +968,7 @@ int32 DialogFilterManager::get_server_main_dialog_list_position() const { return current_server_position; } } - LOG(WARNING) << "Failed to find server position for " << main_dialog_list_position_ << " in chat filters"; + LOG(WARNING) << "Failed to find server position for " << main_dialog_list_position_ << " in chat folders"; return current_server_position; } @@ -988,7 +988,7 @@ void DialogFilterManager::schedule_dialog_filters_reload(double timeout) { save_dialog_filters(); } } - LOG(INFO) << "Schedule reload of chat filters in " << timeout; + LOG(INFO) << "Schedule reload of chat folders in " << timeout; reload_dialog_filters_timeout_.set_callback(std::move(DialogFilterManager::on_reload_dialog_filters_timeout)); reload_dialog_filters_timeout_.set_callback_data(static_cast(this)); reload_dialog_filters_timeout_.set_timeout_in(timeout); @@ -1012,7 +1012,7 @@ void DialogFilterManager::reload_dialog_filters() { need_dialog_filters_reload_ = true; return; } - LOG(INFO) << "Reload chat filters from server"; + LOG(INFO) << "Reload chat folders from server"; are_dialog_filters_being_reloaded_ = true; need_dialog_filters_reload_ = false; auto promise = PromiseCreator::lambda( @@ -1057,8 +1057,8 @@ void DialogFilterManager::on_get_dialog_filter(telegram_api::object_ptr> new_server_dialog_filters; - LOG(INFO) << "Receive chat filters from server: " << to_string(filters); + LOG(INFO) << "Receive chat folders from server: " << to_string(filters); std::unordered_set new_dialog_filter_ids; int32 server_main_dialog_list_position = -1; int32 position = 0; @@ -1128,7 +1128,7 @@ void DialogFilterManager::on_get_dialog_filters( bool is_changed = false; dialog_filters_updated_date_ = G()->unix_time(); if (server_dialog_filters_ != new_server_dialog_filters) { - LOG(INFO) << "Change server chat filters from " + LOG(INFO) << "Change server chat folders from " << DialogFilter::get_dialog_filter_ids(server_dialog_filters_, server_main_dialog_list_position_) << " to " << DialogFilter::get_dialog_filter_ids(new_server_dialog_filters, server_main_dialog_list_position); @@ -1179,7 +1179,7 @@ void DialogFilterManager::on_get_dialog_filters( left_old_server_dialog_filter_ids.push_back(dialog_filter->get_dialog_filter_id()); } } - LOG(INFO) << "Still existing server chat filters: " << left_old_server_dialog_filter_ids; + LOG(INFO) << "Still existing server chat folders: " << left_old_server_dialog_filter_ids; for (auto &old_server_filter : old_server_dialog_filters) { auto dialog_filter_id = old_server_filter.first; // deleted filter @@ -1233,7 +1233,7 @@ void DialogFilterManager::on_get_dialog_filters( } } if (main_dialog_list_position == -1) { - LOG(INFO) << "Failed to find server position " << server_main_dialog_list_position << " in chat filters"; + LOG(INFO) << "Failed to find server position " << server_main_dialog_list_position << " in chat folders"; main_dialog_list_position = static_cast(dialog_filters_.size()); } } @@ -1245,8 +1245,8 @@ void DialogFilterManager::on_get_dialog_filters( is_changed = true; } } - if (is_changed || !is_update_chat_filters_sent_) { - send_update_chat_filters(); + if (is_changed || !is_update_chat_folders_sent_) { + send_update_chat_folders(); } schedule_dialog_filters_reload(get_dialog_filters_cache_time()); save_dialog_filters(); @@ -1305,7 +1305,7 @@ void DialogFilterManager::synchronize_dialog_filters() { return reload_dialog_filters(); } - LOG(INFO) << "Synchronize chat filter changes with server having local " + LOG(INFO) << "Synchronize chat folder changes with server having local " << DialogFilter::get_dialog_filter_ids(dialog_filters_, main_dialog_list_position_) << " and server " << DialogFilter::get_dialog_filter_ids(server_dialog_filters_, server_main_dialog_list_position_); for (const auto &server_dialog_filter : server_dialog_filters_) { @@ -1337,34 +1337,34 @@ void DialogFilterManager::synchronize_dialog_filters() { UNREACHABLE(); } -void DialogFilterManager::send_update_chat_filters() { +void DialogFilterManager::send_update_chat_folders() { if (td_->auth_manager_->is_bot()) { return; } - is_update_chat_filters_sent_ = true; - send_closure(G()->td(), &Td::send_update, get_update_chat_filters_object()); + is_update_chat_folders_sent_ = true; + send_closure(G()->td(), &Td::send_update, get_update_chat_folders_object()); } -td_api::object_ptr DialogFilterManager::get_update_chat_filters_object() const { +td_api::object_ptr DialogFilterManager::get_update_chat_folders_object() const { CHECK(!td_->auth_manager_->is_bot()); - auto update = td_api::make_object(); + auto update = td_api::make_object(); for (const auto &dialog_filter : dialog_filters_) { - update->chat_filters_.push_back(dialog_filter->get_chat_filter_info_object()); + update->chat_folders_.push_back(dialog_filter->get_chat_folder_info_object()); } update->main_chat_list_position_ = main_dialog_list_position_; return update; } -void DialogFilterManager::create_dialog_filter(td_api::object_ptr filter, - Promise> &&promise) { +void DialogFilterManager::create_dialog_filter(td_api::object_ptr filter, + Promise> &&promise) { CHECK(!td_->auth_manager_->is_bot()); - auto max_dialog_filters = clamp(td_->option_manager_->get_option_integer("chat_filter_count_max"), + auto max_dialog_filters = clamp(td_->option_manager_->get_option_integer("chat_folder_count_max"), static_cast(0), static_cast(100)); if (dialog_filters_.size() >= narrow_cast(max_dialog_filters)) { return promise.set_error(Status::Error(400, "The maximum number of chat folders exceeded")); } - if (!is_update_chat_filters_sent_) { + if (!is_update_chat_folders_sent_) { return promise.set_error(Status::Error(400, "Chat folders are not synchronized yet")); } @@ -1380,7 +1380,7 @@ void DialogFilterManager::create_dialog_filter(td_api::object_ptris_shareable()) { return promise.set_error(Status::Error(400, "Can't create shareable folder")); } - auto chat_filter_info = dialog_filter->get_chat_filter_info_object(); + auto chat_folder_info = dialog_filter->get_chat_folder_info_object(); bool at_beginning = is_recommended_dialog_filter(dialog_filter.get()); add_dialog_filter(std::move(dialog_filter), at_beginning, "create_dialog_filter"); @@ -1388,21 +1388,21 @@ void DialogFilterManager::create_dialog_filter(td_api::object_ptr filter, - Promise> &&promise) { + td_api::object_ptr filter, + Promise> &&promise) { CHECK(!td_->auth_manager_->is_bot()); auto old_dialog_filter = get_dialog_filter(dialog_filter_id); if (old_dialog_filter == nullptr) { return promise.set_error(Status::Error(400, "Chat folder not found")); } - CHECK(is_update_chat_filters_sent_); + CHECK(is_update_chat_folders_sent_); TRY_RESULT_PROMISE(promise, new_dialog_filter, DialogFilter::create_dialog_filter(td_, dialog_filter_id, std::move(filter))); @@ -1410,22 +1410,22 @@ void DialogFilterManager::edit_dialog_filter(DialogFilterId dialog_filter_id, return promise.set_error(Status::Error(400, "Can't convert a shareable folder to a non-shareable")); } new_dialog_filter->update_from(*old_dialog_filter); - auto chat_filter_info = new_dialog_filter->get_chat_filter_info_object(); + auto chat_folder_info = new_dialog_filter->get_chat_folder_info_object(); if (*new_dialog_filter == *old_dialog_filter) { - return promise.set_value(std::move(chat_filter_info)); + return promise.set_value(std::move(chat_folder_info)); } do_edit_dialog_filter(std::move(new_dialog_filter), true, "edit_dialog_filter"); - promise.set_value(std::move(chat_filter_info)); + promise.set_value(std::move(chat_folder_info)); } void DialogFilterManager::do_edit_dialog_filter(unique_ptr &&filter, bool need_synchronize, const char *source) { edit_dialog_filter(std::move(filter), source); save_dialog_filters(); - send_update_chat_filters(); + send_update_chat_folders(); if (need_synchronize) { synchronize_dialog_filters(); @@ -1521,7 +1521,7 @@ void DialogFilterManager::delete_dialog_filter(DialogFilterId dialog_filter_id, main_dialog_list_position_--; } save_dialog_filters(); - send_update_chat_filters(); + send_update_chat_folders(); synchronize_dialog_filters(); promise.set_value(Unit()); @@ -1611,7 +1611,7 @@ void DialogFilterManager::reorder_dialog_filters(vector dialog_f std::unordered_set new_dialog_filter_ids_set(dialog_filter_ids.begin(), dialog_filter_ids.end()); if (new_dialog_filter_ids_set.size() != dialog_filter_ids.size()) { - return promise.set_error(Status::Error(400, "Duplicate chat filters in the new list")); + return promise.set_error(Status::Error(400, "Duplicate chat folders in the new list")); } if (main_dialog_list_position < 0 || main_dialog_list_position > static_cast(dialog_filters_.size())) { return promise.set_error(Status::Error(400, "Invalid main chat list position specified")); @@ -1625,7 +1625,7 @@ void DialogFilterManager::reorder_dialog_filters(vector dialog_f main_dialog_list_position_ = main_dialog_list_position; save_dialog_filters(); - send_update_chat_filters(); + send_update_chat_folders(); synchronize_dialog_filters(); } @@ -1735,9 +1735,9 @@ void DialogFilterManager::save_dialog_filters() { log_event.server_dialog_filters_in = &server_dialog_filters_; log_event.dialog_filters_in = &dialog_filters_; - LOG(INFO) << "Save server chat filters " + LOG(INFO) << "Save server chat folders " << DialogFilter::get_dialog_filter_ids(server_dialog_filters_, server_main_dialog_list_position_) - << " and local chat filters " + << " and local chat folders " << DialogFilter::get_dialog_filter_ids(dialog_filters_, main_dialog_list_position_); G()->td_db()->get_binlog_pmc()->set("dialog_filters", log_event_store(log_event).as_slice().str()); @@ -1745,7 +1745,7 @@ void DialogFilterManager::save_dialog_filters() { void DialogFilterManager::create_dialog_filter_invite_link( DialogFilterId dialog_filter_id, string invite_link_name, vector dialog_ids, - Promise> promise) { + Promise> promise) { auto dialog_filter = get_dialog_filter(dialog_filter_id); if (dialog_filter == nullptr) { return promise.set_error(Status::Error(400, "Chat folder not found")); @@ -1767,20 +1767,20 @@ void DialogFilterManager::create_dialog_filter_invite_link( } void DialogFilterManager::get_dialog_filter_invite_links( - DialogFilterId dialog_filter_id, Promise> promise) { + DialogFilterId dialog_filter_id, Promise> promise) { auto dialog_filter = get_dialog_filter(dialog_filter_id); if (dialog_filter == nullptr) { return promise.set_error(Status::Error(400, "Chat folder not found")); } if (!dialog_filter->is_shareable()) { - return promise.set_value(td_api::make_object()); + return promise.set_value(td_api::make_object()); } td_->create_handler(std::move(promise))->send(dialog_filter_id); } void DialogFilterManager::edit_dialog_filter_invite_link( DialogFilterId dialog_filter_id, string invite_link, string invite_link_name, vector dialog_ids, - Promise> promise) { + Promise> promise) { auto dialog_filter = get_dialog_filter(dialog_filter_id); if (dialog_filter == nullptr) { return promise.set_error(Status::Error(400, "Chat folder not found")); @@ -1811,7 +1811,7 @@ void DialogFilterManager::delete_dialog_filter_invite_link(DialogFilterId dialog } void DialogFilterManager::check_dialog_filter_invite_link( - const string &invite_link, Promise> &&promise) { + const string &invite_link, Promise> &&promise) { if (!DialogFilterInviteLink::is_valid_invite_link(invite_link)) { return promise.set_error(Status::Error(400, "Wrong invite link")); } @@ -1822,11 +1822,11 @@ void DialogFilterManager::check_dialog_filter_invite_link( void DialogFilterManager::on_get_chatlist_invite( const string &invite_link, telegram_api::object_ptr &&invite_ptr, - Promise> &&promise) { + Promise> &&promise) { CHECK(invite_ptr != nullptr); LOG(INFO) << "Receive information about chat folder invite link " << invite_link << ": " << to_string(invite_ptr); - td_api::object_ptr info; + td_api::object_ptr info; vector> missing_peers; vector> already_peers; vector> chats; @@ -1843,7 +1843,7 @@ void DialogFilterManager::on_get_chatlist_invite( reload_dialog_filters(); return promise.set_error(Status::Error(500, "Receive unknown chat folder")); } - info = dialog_filter->get_chat_filter_info_object(); + info = dialog_filter->get_chat_folder_info_object(); missing_peers = std::move(invite->missing_peers_); already_peers = std::move(invite->already_peers_); chats = std::move(invite->chats_); @@ -1856,8 +1856,8 @@ void DialogFilterManager::on_get_chatlist_invite( if (icon_name.empty()) { icon_name = "Custom"; } - info = td_api::make_object(0, invite->title_, - td_api::make_object(icon_name), false); + info = td_api::make_object(0, invite->title_, + td_api::make_object(icon_name), false); missing_peers = std::move(invite->peers_); chats = std::move(invite->chats_); users = std::move(invite->users_); @@ -1873,7 +1873,7 @@ void DialogFilterManager::on_get_chatlist_invite( auto missing_dialog_ids = td_->messages_manager_->get_peers_dialog_ids(std::move(missing_peers)); auto already_dialog_ids = td_->messages_manager_->get_peers_dialog_ids(std::move(already_peers)); - promise.set_value(td_api::make_object( + promise.set_value(td_api::make_object( std::move(info), DialogId::get_chat_ids(missing_dialog_ids), DialogId::get_chat_ids(already_dialog_ids))); } @@ -1903,7 +1903,7 @@ void DialogFilterManager::set_dialog_filter_has_my_invite_links(DialogFilterId d void DialogFilterManager::get_current_state(vector> &updates) const { if (have_dialog_filters()) { - updates.push_back(get_update_chat_filters_object()); + updates.push_back(get_update_chat_folders_object()); } } diff --git a/td/telegram/DialogFilterManager.h b/td/telegram/DialogFilterManager.h index 7dcfb3155..c54e69f5c 100644 --- a/td/telegram/DialogFilterManager.h +++ b/td/telegram/DialogFilterManager.h @@ -59,11 +59,11 @@ class DialogFilterManager final : public Actor { Status add_dialog(DialogFilterId dialog_filter_id, InputDialogId input_dialog_id); - void create_dialog_filter(td_api::object_ptr filter, - Promise> &&promise); + void create_dialog_filter(td_api::object_ptr filter, + Promise> &&promise); - void edit_dialog_filter(DialogFilterId dialog_filter_id, td_api::object_ptr filter, - Promise> &&promise); + void edit_dialog_filter(DialogFilterId dialog_filter_id, td_api::object_ptr filter, + Promise> &&promise); void delete_dialog_filter(DialogFilterId dialog_filter_id, vector leave_dialog_ids, Promise &&promise); @@ -74,34 +74,34 @@ class DialogFilterManager final : public Actor { void reorder_dialog_filters(vector dialog_filter_ids, int32 main_dialog_list_position, Promise &&promise); - td_api::object_ptr get_chat_filter_object(DialogFilterId dialog_filter_id); + td_api::object_ptr get_chat_folder_object(DialogFilterId dialog_filter_id); void create_dialog_filter_invite_link(DialogFilterId dialog_filter_id, string invite_link_name, vector dialog_ids, - Promise> promise); + Promise> promise); void get_dialog_filter_invite_links(DialogFilterId dialog_filter_id, - Promise> promise); + Promise> promise); void edit_dialog_filter_invite_link(DialogFilterId dialog_filter_id, string invite_link, string invite_link_name, vector dialog_ids, - Promise> promise); + Promise> promise); void delete_dialog_filter_invite_link(DialogFilterId dialog_filter_id, string invite_link, Promise promise); void check_dialog_filter_invite_link(const string &invite_link, - Promise> &&promise); + Promise> &&promise); void on_get_chatlist_invite(const string &invite_link, telegram_api::object_ptr &&invite_ptr, - Promise> &&promise); + Promise> &&promise); void add_dialog_filter_by_invite_link(const string &invite_link, vector dialog_ids, Promise &&promise); void on_get_dialog_filter(telegram_api::object_ptr filter); - void get_recommended_dialog_filters(Promise> &&promise); + void get_recommended_dialog_filters(Promise> &&promise); void load_dialog_filter(DialogFilterId dialog_filter_id, bool force, Promise &&promise); @@ -145,11 +145,11 @@ class DialogFilterManager final : public Actor { void synchronize_dialog_filters(); - td_api::object_ptr get_chat_filter_object(const DialogFilter *dialog_filter); + td_api::object_ptr get_chat_folder_object(const DialogFilter *dialog_filter); - void send_update_chat_filters(); + void send_update_chat_folders(); - td_api::object_ptr get_update_chat_filters_object() const; + td_api::object_ptr get_update_chat_folders_object() const; void do_edit_dialog_filter(unique_ptr &&filter, bool need_synchronize, const char *source); @@ -186,10 +186,10 @@ class DialogFilterManager final : public Actor { void on_get_recommended_dialog_filters( Result>> result, - Promise> &&promise); + Promise> &&promise); void on_load_recommended_dialog_filters(Result &&result, vector &&filters, - Promise> &&promise); + Promise> &&promise); void load_dialog_filter(const DialogFilter *dialog_filter, bool force, Promise &&promise); @@ -204,7 +204,7 @@ class DialogFilterManager final : public Actor { bool are_dialog_filters_being_reloaded_ = false; bool need_dialog_filters_reload_ = false; bool disable_get_dialog_filter_ = false; - bool is_update_chat_filters_sent_ = false; + bool is_update_chat_folders_sent_ = false; int32 dialog_filters_updated_date_ = 0; vector> server_dialog_filters_; vector> dialog_filters_; diff --git a/td/telegram/DialogListId.h b/td/telegram/DialogListId.h index 0aaecfb3a..d46f24c61 100644 --- a/td/telegram/DialogListId.h +++ b/td/telegram/DialogListId.h @@ -49,8 +49,8 @@ class DialogListId { case td_api::chatListMain::ID: CHECK(id == FolderId::main().get()); break; - case td_api::chatListFilter::ID: { - DialogFilterId filter_id(static_cast(chat_list.get())->chat_filter_id_); + case td_api::chatListFolder::ID: { + DialogFilterId filter_id(static_cast(chat_list.get())->chat_folder_id_); if (filter_id.is_valid()) { *this = DialogListId(filter_id); } @@ -74,7 +74,7 @@ class DialogListId { return td_api::make_object(); } if (is_filter()) { - return td_api::make_object(get_filter_id().get()); + return td_api::make_object(get_filter_id().get()); } UNREACHABLE(); return nullptr; diff --git a/td/telegram/LinkManager.cpp b/td/telegram/LinkManager.cpp index 04a4124c6..c390a43d2 100644 --- a/td/telegram/LinkManager.cpp +++ b/td/telegram/LinkManager.cpp @@ -366,15 +366,15 @@ class LinkManager::InternalLinkDefaultMessageAutoDeleteTimerSettings final : pub } }; -class LinkManager::InternalLinkDialogFilterInvite final : public InternalLink { +class LinkManager::InternalLinkDialogFolderInvite final : public InternalLink { string url_; td_api::object_ptr get_internal_link_type_object() const final { - return td_api::make_object(url_); + return td_api::make_object(url_); } public: - explicit InternalLinkDialogFilterInvite(string url) : url_(std::move(url)) { + explicit InternalLinkDialogFolderInvite(string url) : url_(std::move(url)) { } }; @@ -396,9 +396,9 @@ class LinkManager::InternalLinkEditProfileSettings final : public InternalLink { } }; -class LinkManager::InternalLinkFilterSettings final : public InternalLink { +class LinkManager::InternalLinkFolderSettings final : public InternalLink { td_api::object_ptr get_internal_link_type_object() const final { - return td_api::make_object(); + return td_api::make_object(); } }; @@ -1273,7 +1273,7 @@ unique_ptr LinkManager::parse_tg_link_query(Slice que } if (path.size() == 2 && path[1] == "folders") { // settings/folders - return td::make_unique(); + return td::make_unique(); } if (path.size() == 2 && path[1] == "language") { // settings/language @@ -1293,7 +1293,7 @@ unique_ptr LinkManager::parse_tg_link_query(Slice que auto slug = get_url_query_slug(true, url_query); if (!slug.empty() && is_base64url_characters(slug)) { // list?slug= - return td::make_unique(get_dialog_filter_invite_link(slug, true)); + return td::make_unique(get_dialog_filter_invite_link(slug, true)); } } else if (path.size() == 1 && path[0] == "join") { auto invite_hash = get_url_query_hash(true, url_query); @@ -1429,7 +1429,7 @@ unique_ptr LinkManager::parse_t_me_link_query(Slice q auto slug = get_url_query_slug(false, url_query); if (!slug.empty() && is_base64url_characters(slug)) { // /list/ - return td::make_unique(get_dialog_filter_invite_link(slug, true)); + return td::make_unique(get_dialog_filter_invite_link(slug, true)); } } else if (path[0] == "joinchat") { auto invite_hash = get_url_query_hash(false, url_query); @@ -1867,8 +1867,8 @@ Result LinkManager::get_internal_link_impl(const td_api::InternalLinkTyp return Status::Error("HTTP link is unavailable for the link type"); } return "tg://settings/change_number"; - case td_api::internalLinkTypeChatFilterInvite::ID: { - auto link = static_cast(type_ptr); + case td_api::internalLinkTypeChatFolderInvite::ID: { + auto link = static_cast(type_ptr); auto slug = get_dialog_filter_invite_link_slug(link->invite_link_); if (slug.empty()) { return Status::Error(400, "Invalid invite link specified"); @@ -1893,7 +1893,7 @@ Result LinkManager::get_internal_link_impl(const td_api::InternalLinkTyp return Status::Error("HTTP link is unavailable for the link type"); } return "tg://settings/edit_profile"; - case td_api::internalLinkTypeFilterSettings::ID: + case td_api::internalLinkTypeFolderSettings::ID: if (!is_internal) { return Status::Error("HTTP link is unavailable for the link type"); } diff --git a/td/telegram/LinkManager.h b/td/telegram/LinkManager.h index 4796b24d2..aeabda888 100644 --- a/td/telegram/LinkManager.h +++ b/td/telegram/LinkManager.h @@ -124,10 +124,10 @@ class LinkManager final : public Actor { class InternalLinkChangePhoneNumber; class InternalLinkConfirmPhone; class InternalLinkDefaultMessageAutoDeleteTimerSettings; - class InternalLinkDialogFilterInvite; + class InternalLinkDialogFolderInvite; class InternalLinkDialogInvite; class InternalLinkEditProfileSettings; - class InternalLinkFilterSettings; + class InternalLinkFolderSettings; class InternalLinkGame; class InternalLinkInstantView; class InternalLinkInvoice; diff --git a/td/telegram/OptionManager.cpp b/td/telegram/OptionManager.cpp index 15e222e8e..d3d65ba0e 100644 --- a/td/telegram/OptionManager.cpp +++ b/td/telegram/OptionManager.cpp @@ -97,11 +97,11 @@ OptionManager::OptionManager(Td *td) if (!have_option("notification_sound_count_max")) { set_option_integer("notification_sound_count_max", G()->is_test_dc() ? 5 : 100); } - if (!have_option("chat_filter_count_max")) { - set_option_integer("chat_filter_count_max", G()->is_test_dc() ? 3 : 10); + if (!have_option("chat_folder_count_max")) { + set_option_integer("chat_folder_count_max", G()->is_test_dc() ? 3 : 10); } - if (!have_option("chat_filter_chosen_chat_count_max")) { - set_option_integer("chat_filter_chosen_chat_count_max", G()->is_test_dc() ? 5 : 100); + if (!have_option("chat_folder_chosen_chat_count_max")) { + set_option_integer("chat_folder_chosen_chat_count_max", G()->is_test_dc() ? 5 : 100); } if (!have_option("aggressive_anti_spam_supergroup_member_count_min")) { set_option_integer("aggressive_anti_spam_supergroup_member_count_min", G()->is_test_dc() ? 1 : 100); @@ -110,6 +110,8 @@ OptionManager::OptionManager(Td *td) set_option_integer("pinned_forum_topic_count_max", G()->is_test_dc() ? 3 : 5); } + set_option_empty("chat_filter_count_max"); + set_option_empty("chat_filter_chosen_chat_count_max"); set_option_empty("forum_member_count_min"); set_option_empty("themed_emoji_statuses_sticker_set_id"); set_option_empty("themed_premium_statuses_sticker_set_id"); diff --git a/td/telegram/Premium.cpp b/td/telegram/Premium.cpp index 174002e98..2c39fa8b0 100644 --- a/td/telegram/Premium.cpp +++ b/td/telegram/Premium.cpp @@ -313,9 +313,9 @@ static Slice get_limit_type_key(const td_api::PremiumLimitType *limit_type) { return Slice("saved_gifs"); case td_api::premiumLimitTypeFavoriteStickerCount::ID: return Slice("stickers_faved"); - case td_api::premiumLimitTypeChatFilterCount::ID: + case td_api::premiumLimitTypeChatFolderCount::ID: return Slice("dialog_filters"); - case td_api::premiumLimitTypeChatFilterChosenChatCount::ID: + case td_api::premiumLimitTypeChatFolderChosenChatCount::ID: return Slice("dialog_filters_chats"); case td_api::premiumLimitTypePinnedChatCount::ID: return Slice("dialogs_pinned"); @@ -428,10 +428,10 @@ static td_api::object_ptr get_premium_limit_object(Slice k return td_api::make_object(); } if (key == "dialog_filters") { - return td_api::make_object(); + return td_api::make_object(); } if (key == "dialog_filters_chats") { - return td_api::make_object(); + return td_api::make_object(); } if (key == "dialogs_pinned") { return td_api::make_object(); diff --git a/td/telegram/Td.cpp b/td/telegram/Td.cpp index 1d62ca43d..677a3d8bd 100644 --- a/td/telegram/Td.cpp +++ b/td/telegram/Td.cpp @@ -727,7 +727,7 @@ class GetChatRequest final : public RequestActor<> { } }; -class GetChatFilterRequest final : public RequestActor<> { +class GetChatFolderRequest final : public RequestActor<> { DialogFilterId dialog_filter_id_; void do_run(Promise &&promise) final { @@ -735,11 +735,11 @@ class GetChatFilterRequest final : public RequestActor<> { } void do_send_result() final { - send_result(td_->dialog_filter_manager_->get_chat_filter_object(dialog_filter_id_)); + send_result(td_->dialog_filter_manager_->get_chat_folder_object(dialog_filter_id_)); } public: - GetChatFilterRequest(ActorShared td, uint64 request_id, int32 dialog_filter_id) + GetChatFolderRequest(ActorShared td, uint64 request_id, int32 dialog_filter_id) : RequestActor(std::move(td), request_id), dialog_filter_id_(dialog_filter_id) { set_tries(3); } @@ -2773,7 +2773,7 @@ bool Td::is_synchronous_request(const td_api::Function *function) { case td_api::cleanFileName::ID: case td_api::getLanguagePackString::ID: case td_api::getPhoneNumberInfoSync::ID: - case td_api::getChatFilterDefaultIconName::ID: + case td_api::getChatFolderDefaultIconName::ID: case td_api::getJsonValue::ID: case td_api::getJsonString::ID: case td_api::getThemeParametersJsonString::ID: @@ -3007,7 +3007,7 @@ td_api::object_ptr Td::static_request(td_api::object_ptr &&object) { case td_api::updateUnreadChatCount::ID / 2: case td_api::updateChatOnlineMemberCount::ID / 2: case td_api::updateChatAction::ID / 2: - case td_api::updateChatFilters::ID / 2: + case td_api::updateChatFolders::ID / 2: case td_api::updateChatPosition::ID / 2: case td_api::updateFileAddedToDownloads::ID / 2: case td_api::updateFileDownload::ID / 2: @@ -6114,93 +6114,93 @@ void Td::on_request(uint64 id, const td_api::addChatToList &request) { std::move(promise)); } -void Td::on_request(uint64 id, const td_api::getChatFilter &request) { +void Td::on_request(uint64 id, const td_api::getChatFolder &request) { CHECK_IS_USER(); - CREATE_REQUEST(GetChatFilterRequest, request.chat_filter_id_); + CREATE_REQUEST(GetChatFolderRequest, request.chat_folder_id_); } -void Td::on_request(uint64 id, const td_api::getRecommendedChatFilters &request) { +void Td::on_request(uint64 id, const td_api::getRecommendedChatFolders &request) { CHECK_IS_USER(); CREATE_REQUEST_PROMISE(); dialog_filter_manager_->get_recommended_dialog_filters(std::move(promise)); } -void Td::on_request(uint64 id, td_api::createChatFilter &request) { +void Td::on_request(uint64 id, td_api::createChatFolder &request) { CHECK_IS_USER(); CREATE_REQUEST_PROMISE(); - dialog_filter_manager_->create_dialog_filter(std::move(request.filter_), std::move(promise)); + dialog_filter_manager_->create_dialog_filter(std::move(request.folder_), std::move(promise)); } -void Td::on_request(uint64 id, td_api::editChatFilter &request) { +void Td::on_request(uint64 id, td_api::editChatFolder &request) { CHECK_IS_USER(); CREATE_REQUEST_PROMISE(); - dialog_filter_manager_->edit_dialog_filter(DialogFilterId(request.chat_filter_id_), std::move(request.filter_), + dialog_filter_manager_->edit_dialog_filter(DialogFilterId(request.chat_folder_id_), std::move(request.folder_), std::move(promise)); } -void Td::on_request(uint64 id, const td_api::deleteChatFilter &request) { +void Td::on_request(uint64 id, const td_api::deleteChatFolder &request) { CHECK_IS_USER(); CREATE_OK_REQUEST_PROMISE(); - dialog_filter_manager_->delete_dialog_filter(DialogFilterId(request.chat_filter_id_), + dialog_filter_manager_->delete_dialog_filter(DialogFilterId(request.chat_folder_id_), DialogId::get_dialog_ids(request.leave_chat_ids_), std::move(promise)); } -void Td::on_request(uint64 id, const td_api::getChatFilterChatsToLeave &request) { +void Td::on_request(uint64 id, const td_api::getChatFolderChatsToLeave &request) { CHECK_IS_USER(); CREATE_REQUEST_PROMISE(); - dialog_filter_manager_->get_leave_dialog_filter_suggestions(DialogFilterId(request.chat_filter_id_), + dialog_filter_manager_->get_leave_dialog_filter_suggestions(DialogFilterId(request.chat_folder_id_), std::move(promise)); } -void Td::on_request(uint64 id, const td_api::reorderChatFilters &request) { +void Td::on_request(uint64 id, const td_api::reorderChatFolders &request) { CHECK_IS_USER(); CREATE_OK_REQUEST_PROMISE(); dialog_filter_manager_->reorder_dialog_filters( - transform(request.chat_filter_ids_, [](int32 id) { return DialogFilterId(id); }), + transform(request.chat_folder_ids_, [](int32 id) { return DialogFilterId(id); }), request.main_chat_list_position_, std::move(promise)); } -void Td::on_request(uint64 id, td_api::createChatFilterInviteLink &request) { +void Td::on_request(uint64 id, td_api::createChatFolderInviteLink &request) { CHECK_IS_USER(); CLEAN_INPUT_STRING(request.name_); CREATE_REQUEST_PROMISE(); dialog_filter_manager_->create_dialog_filter_invite_link( - DialogFilterId(request.chat_filter_id_), std::move(request.name_), DialogId::get_dialog_ids(request.chat_ids_), + DialogFilterId(request.chat_folder_id_), std::move(request.name_), DialogId::get_dialog_ids(request.chat_ids_), std::move(promise)); } -void Td::on_request(uint64 id, td_api::getChatFilterInviteLinks &request) { +void Td::on_request(uint64 id, td_api::getChatFolderInviteLinks &request) { CHECK_IS_USER(); CREATE_REQUEST_PROMISE(); - dialog_filter_manager_->get_dialog_filter_invite_links(DialogFilterId(request.chat_filter_id_), std::move(promise)); + dialog_filter_manager_->get_dialog_filter_invite_links(DialogFilterId(request.chat_folder_id_), std::move(promise)); } -void Td::on_request(uint64 id, td_api::editChatFilterInviteLink &request) { +void Td::on_request(uint64 id, td_api::editChatFolderInviteLink &request) { CHECK_IS_USER(); CLEAN_INPUT_STRING(request.invite_link_); CLEAN_INPUT_STRING(request.name_); CREATE_REQUEST_PROMISE(); dialog_filter_manager_->edit_dialog_filter_invite_link( - DialogFilterId(request.chat_filter_id_), std::move(request.invite_link_), std::move(request.name_), + DialogFilterId(request.chat_folder_id_), std::move(request.invite_link_), std::move(request.name_), DialogId::get_dialog_ids(request.chat_ids_), std::move(promise)); } -void Td::on_request(uint64 id, td_api::deleteChatFilterInviteLink &request) { +void Td::on_request(uint64 id, td_api::deleteChatFolderInviteLink &request) { CHECK_IS_USER(); CLEAN_INPUT_STRING(request.invite_link_); CREATE_OK_REQUEST_PROMISE(); - dialog_filter_manager_->delete_dialog_filter_invite_link(DialogFilterId(request.chat_filter_id_), + dialog_filter_manager_->delete_dialog_filter_invite_link(DialogFilterId(request.chat_folder_id_), std::move(request.invite_link_), std::move(promise)); } -void Td::on_request(uint64 id, td_api::checkChatFilterInviteLink &request) { +void Td::on_request(uint64 id, td_api::checkChatFolderInviteLink &request) { CHECK_IS_USER(); CLEAN_INPUT_STRING(request.invite_link_); CREATE_REQUEST_PROMISE(); dialog_filter_manager_->check_dialog_filter_invite_link(std::move(request.invite_link_), std::move(promise)); } -void Td::on_request(uint64 id, td_api::addChatFilterByInviteLink &request) { +void Td::on_request(uint64 id, td_api::addChatFolderByInviteLink &request) { CHECK_IS_USER(); CLEAN_INPUT_STRING(request.invite_link_); CREATE_OK_REQUEST_PROMISE(); @@ -8605,7 +8605,7 @@ void Td::on_request(uint64 id, const td_api::getPushReceiverId &request) { UNREACHABLE(); } -void Td::on_request(uint64 id, const td_api::getChatFilterDefaultIconName &request) { +void Td::on_request(uint64 id, const td_api::getChatFolderDefaultIconName &request) { UNREACHABLE(); } @@ -8783,17 +8783,17 @@ td_api::object_ptr Td::do_static_request(const td_api::getPushRe return td_api::make_object(r_push_receiver_id.ok()); } -td_api::object_ptr Td::do_static_request(const td_api::getChatFilterDefaultIconName &request) { - if (request.filter_ == nullptr) { - return make_error(400, "Chat filter must be non-empty"); +td_api::object_ptr Td::do_static_request(const td_api::getChatFolderDefaultIconName &request) { + if (request.folder_ == nullptr) { + return make_error(400, "Chat folder must be non-empty"); } - if (!check_utf8(request.filter_->title_)) { - return make_error(400, "Chat filter title must be encoded in UTF-8"); + if (!check_utf8(request.folder_->title_)) { + return make_error(400, "Chat folder title must be encoded in UTF-8"); } - if (request.filter_->icon_ != nullptr && !check_utf8(request.filter_->icon_->name_)) { - return make_error(400, "Chat filter icon name must be encoded in UTF-8"); + if (request.folder_->icon_ != nullptr && !check_utf8(request.folder_->icon_->name_)) { + return make_error(400, "Chat folder icon name must be encoded in UTF-8"); } - return td_api::make_object(DialogFilter::get_default_icon_name(request.filter_.get())); + return td_api::make_object(DialogFilter::get_default_icon_name(request.folder_.get())); } td_api::object_ptr Td::do_static_request(td_api::getJsonValue &request) { diff --git a/td/telegram/Td.h b/td/telegram/Td.h index 5bea6133f..2583b649d 100644 --- a/td/telegram/Td.h +++ b/td/telegram/Td.h @@ -913,31 +913,31 @@ class Td final : public Actor { void on_request(uint64 id, const td_api::addChatToList &request); - void on_request(uint64 id, const td_api::getChatFilter &request); + void on_request(uint64 id, const td_api::getChatFolder &request); - void on_request(uint64 id, const td_api::getRecommendedChatFilters &request); + void on_request(uint64 id, const td_api::getRecommendedChatFolders &request); - void on_request(uint64 id, td_api::createChatFilter &request); + void on_request(uint64 id, td_api::createChatFolder &request); - void on_request(uint64 id, td_api::editChatFilter &request); + void on_request(uint64 id, td_api::editChatFolder &request); - void on_request(uint64 id, const td_api::deleteChatFilter &request); + void on_request(uint64 id, const td_api::deleteChatFolder &request); - void on_request(uint64 id, const td_api::getChatFilterChatsToLeave &request); + void on_request(uint64 id, const td_api::getChatFolderChatsToLeave &request); - void on_request(uint64 id, const td_api::reorderChatFilters &request); + void on_request(uint64 id, const td_api::reorderChatFolders &request); - void on_request(uint64 id, td_api::createChatFilterInviteLink &request); + void on_request(uint64 id, td_api::createChatFolderInviteLink &request); - void on_request(uint64 id, td_api::getChatFilterInviteLinks &request); + void on_request(uint64 id, td_api::getChatFolderInviteLinks &request); - void on_request(uint64 id, td_api::editChatFilterInviteLink &request); + void on_request(uint64 id, td_api::editChatFolderInviteLink &request); - void on_request(uint64 id, td_api::deleteChatFilterInviteLink &request); + void on_request(uint64 id, td_api::deleteChatFolderInviteLink &request); - void on_request(uint64 id, td_api::checkChatFilterInviteLink &request); + void on_request(uint64 id, td_api::checkChatFolderInviteLink &request); - void on_request(uint64 id, td_api::addChatFilterByInviteLink &request); + void on_request(uint64 id, td_api::addChatFolderByInviteLink &request); void on_request(uint64 id, td_api::setChatTitle &request); @@ -1561,7 +1561,7 @@ class Td final : public Actor { void on_request(uint64 id, const td_api::getPushReceiverId &request); - void on_request(uint64 id, const td_api::getChatFilterDefaultIconName &request); + void on_request(uint64 id, const td_api::getChatFolderDefaultIconName &request); void on_request(uint64 id, const td_api::getJsonValue &request); @@ -1615,7 +1615,7 @@ class Td final : public Actor { static td_api::object_ptr do_static_request(const td_api::getLanguagePackString &request); static td_api::object_ptr do_static_request(td_api::getPhoneNumberInfoSync &request); static td_api::object_ptr do_static_request(const td_api::getPushReceiverId &request); - static td_api::object_ptr do_static_request(const td_api::getChatFilterDefaultIconName &request); + static td_api::object_ptr do_static_request(const td_api::getChatFolderDefaultIconName &request); static td_api::object_ptr do_static_request(td_api::getJsonValue &request); static td_api::object_ptr do_static_request(const td_api::getJsonString &request); static td_api::object_ptr do_static_request(const td_api::getThemeParametersJsonString &request); diff --git a/td/telegram/cli.cpp b/td/telegram/cli.cpp index a36890968..30ab196e7 100644 --- a/td/telegram/cli.cpp +++ b/td/telegram/cli.cpp @@ -486,12 +486,12 @@ class CliClient final : public Actor { return to_integer(str); } - static int32 as_chat_filter_id(Slice str) { + static int32 as_chat_folder_id(Slice str) { return to_integer(trim(str)); } - static vector as_chat_filter_ids(Slice chat_filter_ids) { - return transform(autosplit(chat_filter_ids), as_chat_filter_id); + static vector as_chat_folder_ids(Slice chat_folder_ids) { + return transform(autosplit(chat_folder_ids), as_chat_folder_id); } static td_api::object_ptr as_chat_list(string chat_list) { @@ -499,7 +499,7 @@ class CliClient final : public Actor { return td_api::make_object(); } if (chat_list.find('-') != string::npos) { - return td_api::make_object(as_chat_filter_id(chat_list.substr(chat_list.find('-') + 1))); + return td_api::make_object(as_chat_folder_id(chat_list.substr(chat_list.find('-') + 1))); } return td_api::make_object(); } @@ -831,16 +831,16 @@ class CliClient final : public Actor { arg.user_id = as_user_id(args); } - struct ChatFilterId { - int32 chat_filter_id = 0; + struct ChatFolderId { + int32 chat_folder_id = 0; operator int32() const { - return chat_filter_id; + return chat_folder_id; } }; - void get_args(string &args, ChatFilterId &arg) const { - arg.chat_filter_id = as_chat_filter_id(args); + void get_args(string &args, ChatFolderId &arg) const { + arg.chat_folder_id = as_chat_folder_id(args); } struct FileId { @@ -1526,15 +1526,15 @@ class CliClient final : public Actor { return Random::fast_bool(); } - td_api::object_ptr as_chat_filter(string filter, bool is_shareable = false) const { + td_api::object_ptr as_chat_folder(string filter, bool is_shareable = false) const { string title; string icon_name; string pinned_chat_ids; string included_chat_ids; string excluded_chat_ids; get_args(filter, title, icon_name, pinned_chat_ids, included_chat_ids, excluded_chat_ids); - return td_api::make_object( - title, td_api::make_object(icon_name), is_shareable, as_chat_ids(pinned_chat_ids), + return td_api::make_object( + title, td_api::make_object(icon_name), is_shareable, as_chat_ids(pinned_chat_ids), as_chat_ids(included_chat_ids), as_chat_ids(excluded_chat_ids), rand_bool(), rand_bool(), rand_bool(), rand_bool(), rand_bool(), rand_bool(), rand_bool(), rand_bool()); } @@ -2763,11 +2763,11 @@ class CliClient final : public Actor { } else if (op == "gadl") { send_request(td_api::make_object()); } else if (op == "gprl") { - auto limit_type = td_api::make_object(); + auto limit_type = td_api::make_object(); send_request(td_api::make_object(std::move(limit_type))); } else if (op == "gprf") { auto source = td_api::make_object( - td_api::make_object()); + td_api::make_object()); send_request(td_api::make_object(std::move(source))); } else if (op == "gprse") { send_request(td_api::make_object()); @@ -4561,71 +4561,71 @@ class CliClient final : public Actor { get_args(args, chat_id); send_request(td_api::make_object(chat_id, as_chat_list(op))); } else if (op == "gcf") { - ChatFilterId chat_filter_id; - get_args(args, chat_filter_id); - send_request(td_api::make_object(chat_filter_id)); + ChatFolderId chat_folder_id; + get_args(args, chat_folder_id); + send_request(td_api::make_object(chat_folder_id)); } else if (op == "ccf") { - send_request(td_api::make_object(as_chat_filter(args))); + send_request(td_api::make_object(as_chat_folder(args))); } else if (op == "ccfe") { - auto chat_filter = td_api::make_object(); - chat_filter->title_ = "empty"; - chat_filter->included_chat_ids_ = as_chat_ids(args); - send_request(td_api::make_object(std::move(chat_filter))); + auto chat_folder = td_api::make_object(); + chat_folder->title_ = "empty"; + chat_folder->included_chat_ids_ = as_chat_ids(args); + send_request(td_api::make_object(std::move(chat_folder))); } else if (op == "ecf" || op == "ecfs") { - ChatFilterId chat_filter_id; + ChatFolderId chat_folder_id; string filter; - get_args(args, chat_filter_id, filter); - send_request(td_api::make_object(chat_filter_id, as_chat_filter(filter, op == "ecfs"))); + get_args(args, chat_folder_id, filter); + send_request(td_api::make_object(chat_folder_id, as_chat_folder(filter, op == "ecfs"))); } else if (op == "dcf") { - ChatFilterId chat_filter_id; + ChatFolderId chat_folder_id; string chat_ids; - get_args(args, chat_filter_id, chat_ids); - send_request(td_api::make_object(chat_filter_id, as_chat_ids(chat_ids))); + get_args(args, chat_folder_id, chat_ids); + send_request(td_api::make_object(chat_folder_id, as_chat_ids(chat_ids))); } else if (op == "gcfctl") { - ChatFilterId chat_filter_id; - get_args(args, chat_filter_id); - send_request(td_api::make_object(chat_filter_id)); + ChatFolderId chat_folder_id; + get_args(args, chat_folder_id); + send_request(td_api::make_object(chat_folder_id)); } else if (op == "rcf") { int32 main_chat_list_position; - string chat_filter_ids; - get_args(args, main_chat_list_position, chat_filter_ids); - send_request(td_api::make_object(as_chat_filter_ids(chat_filter_ids), + string chat_folder_ids; + get_args(args, main_chat_list_position, chat_folder_ids); + send_request(td_api::make_object(as_chat_folder_ids(chat_folder_ids), main_chat_list_position)); } else if (op == "crcfil") { - ChatFilterId chat_filter_id; + ChatFolderId chat_folder_id; string name; string chat_ids; - get_args(args, chat_filter_id, name, chat_ids); + get_args(args, chat_folder_id, name, chat_ids); send_request( - td_api::make_object(chat_filter_id, name, as_chat_ids(chat_ids))); + td_api::make_object(chat_folder_id, name, as_chat_ids(chat_ids))); } else if (op == "gcfil") { - ChatFilterId chat_filter_id; - get_args(args, chat_filter_id); - send_request(td_api::make_object(chat_filter_id)); + ChatFolderId chat_folder_id; + get_args(args, chat_folder_id); + send_request(td_api::make_object(chat_folder_id)); } else if (op == "ecfil") { - ChatFilterId chat_filter_id; + ChatFolderId chat_folder_id; string invite_link; string name; string chat_ids; - get_args(args, chat_filter_id, invite_link, name, chat_ids); - send_request(td_api::make_object(chat_filter_id, invite_link, name, + get_args(args, chat_folder_id, invite_link, name, chat_ids); + send_request(td_api::make_object(chat_folder_id, invite_link, name, as_chat_ids(chat_ids))); } else if (op == "dcfil") { - ChatFilterId chat_filter_id; + ChatFolderId chat_folder_id; string invite_link; - get_args(args, chat_filter_id, invite_link); - send_request(td_api::make_object(chat_filter_id, invite_link)); + get_args(args, chat_folder_id, invite_link); + send_request(td_api::make_object(chat_folder_id, invite_link)); } else if (op == "ccfil") { - send_request(td_api::make_object(args)); + send_request(td_api::make_object(args)); } else if (op == "acfbil") { string invite_link; string chat_ids; get_args(args, invite_link, chat_ids); - send_request(td_api::make_object(invite_link, as_chat_ids(chat_ids))); + send_request(td_api::make_object(invite_link, as_chat_ids(chat_ids))); } else if (op == "grcf") { - send_request(td_api::make_object()); + send_request(td_api::make_object()); } else if (op == "gcfdin") { - execute(td_api::make_object(as_chat_filter(args))); + execute(td_api::make_object(as_chat_folder(args))); } else if (op == "sct") { ChatId chat_id; string title; diff --git a/test/link.cpp b/test/link.cpp index 657bf6130..30bc9e9cc 100644 --- a/test/link.cpp +++ b/test/link.cpp @@ -218,8 +218,8 @@ static auto change_phone_number() { return td::td_api::make_object(); } -static auto chat_filter_invite(const td::string &slug) { - return td::td_api::make_object("tg:list?slug=" + slug); +static auto chat_folder_invite(const td::string &slug) { + return td::td_api::make_object("tg:list?slug=" + slug); } static auto chat_invite(const td::string &hash) { @@ -234,8 +234,8 @@ static auto edit_profile_settings() { return td::td_api::make_object(); } -static auto filter_settings() { - return td::td_api::make_object(); +static auto folder_settings() { + return td::td_api::make_object(); } static auto game(const td::string &bot_username, const td::string &game_short_name) { @@ -714,16 +714,16 @@ TEST(Link, parse_internal_link_part2) { parse_internal_link("t.me/list?/abcdef", nullptr); parse_internal_link("t.me/list/?abcdef", nullptr); parse_internal_link("t.me/list/#abcdef", nullptr); - parse_internal_link("t.me/list/abacaba", chat_filter_invite("abacaba")); + parse_internal_link("t.me/list/abacaba", chat_folder_invite("abacaba")); parse_internal_link("t.me/list/aba%20aba", nullptr); - parse_internal_link("t.me/list/aba%30aba", chat_filter_invite("aba0aba")); - parse_internal_link("t.me/list/123456a", chat_filter_invite("123456a")); - parse_internal_link("t.me/list/12345678901", chat_filter_invite("12345678901")); - parse_internal_link("t.me/list/123456", chat_filter_invite("123456")); - parse_internal_link("t.me/list/123456/123123/12/31/a/s//21w/?asdas#test", chat_filter_invite("123456")); - parse_internal_link("t.me/list/12345678901a", chat_filter_invite("12345678901a")); - parse_internal_link("t.me/list/123456a", chat_filter_invite("123456a")); - parse_internal_link("t.me/list/123456a/123123/12/31/a/s//21w/?asdas#test", chat_filter_invite("123456a")); + parse_internal_link("t.me/list/aba%30aba", chat_folder_invite("aba0aba")); + parse_internal_link("t.me/list/123456a", chat_folder_invite("123456a")); + parse_internal_link("t.me/list/12345678901", chat_folder_invite("12345678901")); + parse_internal_link("t.me/list/123456", chat_folder_invite("123456")); + parse_internal_link("t.me/list/123456/123123/12/31/a/s//21w/?asdas#test", chat_folder_invite("123456")); + parse_internal_link("t.me/list/12345678901a", chat_folder_invite("12345678901a")); + parse_internal_link("t.me/list/123456a", chat_folder_invite("123456a")); + parse_internal_link("t.me/list/123456a/123123/12/31/a/s//21w/?asdas#test", chat_folder_invite("123456a")); parse_internal_link("t.me/contact/startattach/adasd", user_token("startattach")); parse_internal_link("t.me/contact/startattach", user_token("startattach")); @@ -736,9 +736,9 @@ TEST(Link, parse_internal_link_part2) { parse_internal_link("tg://join?invite=abc%30def", chat_invite("abc0def")); parse_internal_link("tg:join?invite=", unknown_deep_link("tg://join?invite=")); - parse_internal_link("tg:list?slug=abcdef", chat_filter_invite("abcdef")); + parse_internal_link("tg:list?slug=abcdef", chat_folder_invite("abcdef")); parse_internal_link("tg:list?slug=abc%20def", unknown_deep_link("tg://list?slug=abc%20def")); - parse_internal_link("tg://list?slug=abc%30def", chat_filter_invite("abc0def")); + parse_internal_link("tg://list?slug=abc%30def", chat_folder_invite("abc0def")); parse_internal_link("tg:list?slug=", unknown_deep_link("tg://list?slug=")); parse_internal_link("t.me/addstickers?set=abcdef", nullptr); @@ -1145,7 +1145,7 @@ TEST(Link, parse_internal_link_part4) { parse_internal_link("tg://settings/devices", active_sessions()); parse_internal_link("tg://settings/change_number", change_phone_number()); parse_internal_link("tg://settings/edit_profile", edit_profile_settings()); - parse_internal_link("tg://settings/folders", filter_settings()); + parse_internal_link("tg://settings/folders", folder_settings()); parse_internal_link("tg://settings/filters", settings()); parse_internal_link("tg://settings/language", language_settings()); parse_internal_link("tg://settings/privacy", privacy_and_security_settings());