Update API scheme to layer 158.
This commit is contained in:
		
							parent
							
								
									b2c5c8ae2c
								
							
						
					
					
						commit
						725c22e776
					
				
					 4 changed files with 127 additions and 31 deletions
				
			
		| 
						 | 
				
			
			@ -110,7 +110,7 @@ storage.fileMp4#b3cea0e4 = storage.FileType;
 | 
			
		|||
storage.fileWebp#1081464c = storage.FileType;
 | 
			
		||||
 | 
			
		||||
userEmpty#d3bc4b7a id:long = User;
 | 
			
		||||
user#8f97c628 flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true restricted:flags.18?true min:flags.20?true bot_inline_geo:flags.21?true support:flags.23?true scam:flags.24?true apply_min_photo:flags.25?true fake:flags.26?true bot_attach_menu:flags.27?true premium:flags.28?true attach_menu_enabled:flags.29?true flags2:# id:long access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int restriction_reason:flags.18?Vector<RestrictionReason> bot_inline_placeholder:flags.19?string lang_code:flags.22?string emoji_status:flags.30?EmojiStatus usernames:flags2.0?Vector<Username> = User;
 | 
			
		||||
user#8f97c628 flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true restricted:flags.18?true min:flags.20?true bot_inline_geo:flags.21?true support:flags.23?true scam:flags.24?true apply_min_photo:flags.25?true fake:flags.26?true bot_attach_menu:flags.27?true premium:flags.28?true attach_menu_enabled:flags.29?true flags2:# bot_can_edit:flags2.1?true id:long access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int restriction_reason:flags.18?Vector<RestrictionReason> bot_inline_placeholder:flags.19?string lang_code:flags.22?string emoji_status:flags.30?EmojiStatus usernames:flags2.0?Vector<Username> = User;
 | 
			
		||||
 | 
			
		||||
userProfilePhotoEmpty#4f11bae1 = UserProfilePhoto;
 | 
			
		||||
userProfilePhoto#82d1f706 flags:# has_video:flags.0?true personal:flags.2?true photo_id:long stripped_thumb:flags.1?bytes dc_id:int = UserProfilePhoto;
 | 
			
		||||
| 
						 | 
				
			
			@ -191,7 +191,7 @@ messageActionSetChatTheme#aa786345 emoticon:string = MessageAction;
 | 
			
		|||
messageActionChatJoinedByRequest#ebbca3cb = MessageAction;
 | 
			
		||||
messageActionWebViewDataSentMe#47dd8079 text:string data:string = MessageAction;
 | 
			
		||||
messageActionWebViewDataSent#b4c38cb5 text:string = MessageAction;
 | 
			
		||||
messageActionGiftPremium#aba0f5c6 currency:string amount:long months:int = MessageAction;
 | 
			
		||||
messageActionGiftPremium#c83d6aec flags:# currency:string amount:long months:int crypto_currency:flags.0?string crypto_amount:flags.0?long = MessageAction;
 | 
			
		||||
messageActionTopicCreate#d999256 flags:# title:string icon_color:int icon_emoji_id:flags.0?long = MessageAction;
 | 
			
		||||
messageActionTopicEdit#c0944820 flags:# title:flags.0?string icon_emoji_id:flags.1?long closed:flags.2?Bool hidden:flags.3?Bool = MessageAction;
 | 
			
		||||
messageActionSuggestProfilePhoto#57de635e photo:Photo = MessageAction;
 | 
			
		||||
| 
						 | 
				
			
			@ -737,7 +737,7 @@ auth.sentCodeTypeSms#c000bba2 length:int = auth.SentCodeType;
 | 
			
		|||
auth.sentCodeTypeCall#5353e5a7 length:int = auth.SentCodeType;
 | 
			
		||||
auth.sentCodeTypeFlashCall#ab03c6d9 pattern:string = auth.SentCodeType;
 | 
			
		||||
auth.sentCodeTypeMissedCall#82006484 prefix:string length:int = auth.SentCodeType;
 | 
			
		||||
auth.sentCodeTypeEmailCode#5a159841 flags:# apple_signin_allowed:flags.0?true google_signin_allowed:flags.1?true email_pattern:string length:int next_phone_login_date:flags.2?int = auth.SentCodeType;
 | 
			
		||||
auth.sentCodeTypeEmailCode#f450f59b flags:# apple_signin_allowed:flags.0?true google_signin_allowed:flags.1?true email_pattern:string length:int reset_available_period:flags.3?int reset_pending_date:flags.4?int = auth.SentCodeType;
 | 
			
		||||
auth.sentCodeTypeSetUpEmailRequired#a5491dea flags:# apple_signin_allowed:flags.0?true google_signin_allowed:flags.1?true = auth.SentCodeType;
 | 
			
		||||
auth.sentCodeTypeFragmentSms#d9565c39 url:string length:int = auth.SentCodeType;
 | 
			
		||||
auth.sentCodeTypeFirebaseSms#e57b1432 flags:# nonce:flags.0?bytes receipt:flags.1?string push_timeout:flags.1?int length:int = auth.SentCodeType;
 | 
			
		||||
| 
						 | 
				
			
			@ -1227,6 +1227,7 @@ payments.bankCardData#3e24e573 title:string open_urls:Vector<BankCardOpenUrl> =
 | 
			
		|||
 | 
			
		||||
dialogFilter#7438f7e8 flags:# contacts:flags.0?true non_contacts:flags.1?true groups:flags.2?true broadcasts:flags.3?true bots:flags.4?true exclude_muted:flags.11?true exclude_read:flags.12?true exclude_archived:flags.13?true id:int title:string emoticon:flags.25?string pinned_peers:Vector<InputPeer> include_peers:Vector<InputPeer> exclude_peers:Vector<InputPeer> = DialogFilter;
 | 
			
		||||
dialogFilterDefault#363293ae = DialogFilter;
 | 
			
		||||
dialogFilterCommunity#d8565037 flags:# id:int title:string emoticon:flags.25?string pinned_peers:Vector<InputPeer> include_peers:Vector<InputPeer> = DialogFilter;
 | 
			
		||||
 | 
			
		||||
dialogFilterSuggested#77744d4a filter:DialogFilter description:string = DialogFilterSuggested;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1524,6 +1525,21 @@ inlineBotWebView#b57295d5 text:string url:string = InlineBotWebView;
 | 
			
		|||
 | 
			
		||||
readParticipantDate#4a4ff172 user_id:long date:int = ReadParticipantDate;
 | 
			
		||||
 | 
			
		||||
inputCommunityDialogFilter#1ae107a1 filter_id:int = InputCommunity;
 | 
			
		||||
 | 
			
		||||
exportedCommunityInvite#ebddc1aa flags:# title:string url:string peers:Vector<Peer> = ExportedCommunityInvite;
 | 
			
		||||
 | 
			
		||||
communities.exportedCommunityInvite#6b97a8ea filter:DialogFilter invite:ExportedCommunityInvite = communities.ExportedCommunityInvite;
 | 
			
		||||
 | 
			
		||||
communities.exportedInvites#ffd75fa7 invites:Vector<ExportedCommunityInvite> chats:Vector<Chat> users:Vector<User> = communities.ExportedInvites;
 | 
			
		||||
 | 
			
		||||
communities.communityInviteAlready#c745ee07 filter_id:int missing_peers:Vector<Peer> already_peers:Vector<Peer> chats:Vector<Chat> users:Vector<User> = communities.CommunityInvite;
 | 
			
		||||
communities.communityInvite#3857da1 flags:# title:string emoticon:flags.0?string peers:Vector<Peer> chats:Vector<Chat> users:Vector<User> = communities.CommunityInvite;
 | 
			
		||||
 | 
			
		||||
communities.communityUpdates#e74660b3 missing_peers:Vector<Peer> chats:Vector<Chat> users:Vector<User> = communities.CommunityUpdates;
 | 
			
		||||
 | 
			
		||||
bots.botInfo#e8a775b0 name:string about:string description:string = bots.BotInfo;
 | 
			
		||||
 | 
			
		||||
---functions---
 | 
			
		||||
 | 
			
		||||
invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X;
 | 
			
		||||
| 
						 | 
				
			
			@ -1555,6 +1571,7 @@ auth.acceptLoginToken#e894ad4d token:bytes = Authorization;
 | 
			
		|||
auth.checkRecoveryPassword#d36bf79 code:string = Bool;
 | 
			
		||||
auth.importWebTokenAuthorization#2db873a9 api_id:int api_hash:string web_auth_token:string = auth.Authorization;
 | 
			
		||||
auth.requestFirebaseSms#89464b50 flags:# phone_number:string phone_code_hash:string safety_net_token:flags.0?string ios_push_secret:flags.1?string = Bool;
 | 
			
		||||
auth.resetLoginEmail#7e960193 phone_number:string phone_code_hash:string = auth.SentCode;
 | 
			
		||||
 | 
			
		||||
account.registerDevice#ec86017a flags:# no_muted:flags.0?true token_type:int token:string app_sandbox:Bool secret:bytes other_uids:Vector<long> = Bool;
 | 
			
		||||
account.unregisterDevice#6a0d3206 token_type:int token:string other_uids:Vector<long> = Bool;
 | 
			
		||||
| 
						 | 
				
			
			@ -1864,8 +1881,8 @@ updates.getState#edd4882a = updates.State;
 | 
			
		|||
updates.getDifference#25939651 flags:# pts:int pts_total_limit:flags.0?int date:int qts:int = updates.Difference;
 | 
			
		||||
updates.getChannelDifference#3173d78 flags:# force:flags.0?true channel:InputChannel filter:ChannelMessagesFilter pts:int limit:int = updates.ChannelDifference;
 | 
			
		||||
 | 
			
		||||
photos.updateProfilePhoto#1c3d5956 flags:# fallback:flags.0?true id:InputPhoto = photos.Photo;
 | 
			
		||||
photos.uploadProfilePhoto#93c9a51 flags:# fallback:flags.3?true file:flags.0?InputFile video:flags.1?InputFile video_start_ts:flags.2?double video_emoji_markup:flags.4?VideoSize = photos.Photo;
 | 
			
		||||
photos.updateProfilePhoto#9e82039 flags:# fallback:flags.0?true bot:flags.1?InputUser id:InputPhoto = photos.Photo;
 | 
			
		||||
photos.uploadProfilePhoto#388a3b5 flags:# fallback:flags.3?true bot:flags.5?InputUser file:flags.0?InputFile video:flags.1?InputFile video_start_ts:flags.2?double video_emoji_markup:flags.4?VideoSize = photos.Photo;
 | 
			
		||||
photos.deletePhotos#87cf7f2f id:Vector<InputPhoto> = Vector<long>;
 | 
			
		||||
photos.getUserPhotos#91cd32a8 user_id:InputUser offset:int max_id:long limit:int = photos.Photos;
 | 
			
		||||
photos.uploadContactProfilePhoto#e14c4a71 flags:# suggest:flags.3?true save:flags.4?true user_id:InputUser file:flags.0?InputFile video:flags.1?InputFile video_start_ts:flags.2?double video_emoji_markup:flags.5?VideoSize = photos.Photo;
 | 
			
		||||
| 
						 | 
				
			
			@ -1968,8 +1985,10 @@ bots.setBotMenuButton#4504d54f user_id:InputUser button:BotMenuButton = Bool;
 | 
			
		|||
bots.getBotMenuButton#9c60eb28 user_id:InputUser = BotMenuButton;
 | 
			
		||||
bots.setBotBroadcastDefaultAdminRights#788464e1 admin_rights:ChatAdminRights = Bool;
 | 
			
		||||
bots.setBotGroupDefaultAdminRights#925ec9ea admin_rights:ChatAdminRights = Bool;
 | 
			
		||||
bots.setBotInfo#a365df7a flags:# lang_code:string about:flags.0?string description:flags.1?string = Bool;
 | 
			
		||||
bots.getBotInfo#75ec12e6 lang_code:string = Vector<string>;
 | 
			
		||||
bots.setBotInfo#10cf3123 flags:# bot:flags.2?InputUser lang_code:string name:flags.3?string about:flags.0?string description:flags.1?string = Bool;
 | 
			
		||||
bots.getBotInfo#dcd914fd flags:# bot:flags.0?InputUser lang_code:string = bots.BotInfo;
 | 
			
		||||
bots.reorderUsernames#9709b1c2 bot:InputUser order:Vector<string> = Bool;
 | 
			
		||||
bots.toggleUsername#53ca973 bot:InputUser username:string active:Bool = Bool;
 | 
			
		||||
 | 
			
		||||
payments.getPaymentForm#37148dbb flags:# invoice:InputInvoice theme_params:flags.0?DataJSON = payments.PaymentForm;
 | 
			
		||||
payments.getPaymentReceipt#2478d1cc peer:InputPeer msg_id:int = payments.PaymentReceipt;
 | 
			
		||||
| 
						 | 
				
			
			@ -2033,7 +2052,6 @@ langpack.getLanguages#42c6978f lang_pack:string = Vector<LangPackLanguage>;
 | 
			
		|||
langpack.getLanguage#6a596502 lang_pack:string lang_code:string = LangPackLanguage;
 | 
			
		||||
 | 
			
		||||
folders.editPeerFolders#6847d0ab folder_peers:Vector<InputFolderPeer> = Updates;
 | 
			
		||||
folders.deleteFolder#1c295881 folder_id:int = Updates;
 | 
			
		||||
 | 
			
		||||
stats.getBroadcastStats#ab42441a flags:# dark:flags.0?true channel:InputChannel = stats.BroadcastStats;
 | 
			
		||||
stats.loadAsyncGraph#621d5fa0 flags:# token:string x:flags.0?long = StatsGraph;
 | 
			
		||||
| 
						 | 
				
			
			@ -2041,4 +2059,15 @@ stats.getMegagroupStats#dcdf8607 flags:# dark:flags.0?true channel:InputChannel
 | 
			
		|||
stats.getMessagePublicForwards#5630281b channel:InputChannel msg_id:int offset_rate:int offset_peer:InputPeer offset_id:int limit:int = messages.Messages;
 | 
			
		||||
stats.getMessageStats#b6e0a3f5 flags:# dark:flags.0?true channel:InputChannel msg_id:int = stats.MessageStats;
 | 
			
		||||
 | 
			
		||||
// LAYER 155
 | 
			
		||||
communities.exportCommunityInvite#41fe69d9 community:InputCommunity title:string peers:Vector<InputPeer> = communities.ExportedCommunityInvite;
 | 
			
		||||
communities.deleteExportedInvite#f96e4616 community:InputCommunity slug:string = Bool;
 | 
			
		||||
communities.editExportedInvite#27140512 flags:# community:InputCommunity slug:string title:flags.1?string peers:flags.2?Vector<InputPeer> = ExportedCommunityInvite;
 | 
			
		||||
communities.getExportedInvites#4688a39d community:InputCommunity = communities.ExportedInvites;
 | 
			
		||||
communities.checkCommunityInvite#99ba9e5 slug:string = communities.CommunityInvite;
 | 
			
		||||
communities.joinCommunityInvite#4eff927 slug:string peers:Vector<InputPeer> = Updates;
 | 
			
		||||
communities.getCommunityUpdates#2956d635 community:InputCommunity = communities.CommunityUpdates;
 | 
			
		||||
communities.joinCommunityUpdates#51d42216 community:InputCommunity peers:Vector<InputPeer> = Updates;
 | 
			
		||||
communities.hideCommunityUpdates#d678baf community:InputCommunity = Bool;
 | 
			
		||||
communities.leaveCommunity#35d9755f community:InputCommunity peers:Vector<InputPeer> = Updates;
 | 
			
		||||
 | 
			
		||||
// LAYER 158
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -186,6 +186,7 @@ void PeerPhoto::updateSelf(
 | 
			
		|||
		const auto usedFileReference = photo->fileReference();
 | 
			
		||||
		_api.request(MTPphotos_UpdateProfilePhoto(
 | 
			
		||||
			MTP_flags(0),
 | 
			
		||||
			MTPInputUser(), // bot
 | 
			
		||||
			photo->mtpInput()
 | 
			
		||||
		)).done([=](const MTPphotos_Photo &result) {
 | 
			
		||||
			result.match([&](const MTPDphotos_photo &data) {
 | 
			
		||||
| 
						 | 
				
			
			@ -252,6 +253,7 @@ void PeerPhoto::clear(not_null<PhotoData*> photo) {
 | 
			
		|||
	if (self->userpicPhotoId() == photo->id) {
 | 
			
		||||
		_api.request(MTPphotos_UpdateProfilePhoto(
 | 
			
		||||
			MTP_flags(0),
 | 
			
		||||
			MTPInputUser(), // bot
 | 
			
		||||
			MTP_inputPhotoEmpty()
 | 
			
		||||
		)).done([=](const MTPphotos_Photo &result) {
 | 
			
		||||
			self->setPhoto(MTP_userProfilePhotoEmpty());
 | 
			
		||||
| 
						 | 
				
			
			@ -276,6 +278,7 @@ void PeerPhoto::clear(not_null<PhotoData*> photo) {
 | 
			
		|||
		if (fallbackPhotoId && (*fallbackPhotoId) == photo->id) {
 | 
			
		||||
			_api.request(MTPphotos_UpdateProfilePhoto(
 | 
			
		||||
				MTP_flags(MTPphotos_UpdateProfilePhoto::Flag::f_fallback),
 | 
			
		||||
				MTPInputUser(), // bot
 | 
			
		||||
				MTP_inputPhotoEmpty()
 | 
			
		||||
			)).send();
 | 
			
		||||
			_session->storage().add(Storage::UserPhotosSetBack(
 | 
			
		||||
| 
						 | 
				
			
			@ -321,6 +324,7 @@ void PeerPhoto::set(not_null<PeerData*> peer, not_null<PhotoData*> photo) {
 | 
			
		|||
	if (peer == _session->user()) {
 | 
			
		||||
		_api.request(MTPphotos_UpdateProfilePhoto(
 | 
			
		||||
			MTP_flags(0),
 | 
			
		||||
			MTPInputUser(), // bot
 | 
			
		||||
			photo->mtpInput()
 | 
			
		||||
		)).done([=](const MTPphotos_Photo &result) {
 | 
			
		||||
			result.match([&](const MTPDphotos_photo &data) {
 | 
			
		||||
| 
						 | 
				
			
			@ -370,6 +374,7 @@ void PeerPhoto::ready(
 | 
			
		|||
			MTP_flags((file ? Flag::f_file : none)
 | 
			
		||||
				| (videoSize ? Flag::f_video_emoji_markup : none)
 | 
			
		||||
				| ((type == UploadType::Fallback) ? Flag::f_fallback : none)),
 | 
			
		||||
			MTPInputUser(), // bot
 | 
			
		||||
			file ? (*file) : MTPInputFile(),
 | 
			
		||||
			MTPInputFile(), // video
 | 
			
		||||
			MTPdouble(), // video_start_ts
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -109,22 +109,54 @@ ChatFilter ChatFilter::FromTL(
 | 
			
		|||
			{ never.begin(), never.end() });
 | 
			
		||||
	}, [](const MTPDdialogFilterDefault &d) {
 | 
			
		||||
		return ChatFilter();
 | 
			
		||||
	}, [&](const MTPDdialogFilterCommunity &data) {
 | 
			
		||||
		auto &&to_histories = ranges::views::transform([&](
 | 
			
		||||
				const MTPInputPeer &data) {
 | 
			
		||||
			const auto peer = data.match([&](const MTPDinputPeerUser &data) {
 | 
			
		||||
				const auto user = owner->user(data.vuser_id().v);
 | 
			
		||||
				user->setAccessHash(data.vaccess_hash().v);
 | 
			
		||||
				return (PeerData*)user;
 | 
			
		||||
			}, [&](const MTPDinputPeerChat &data) {
 | 
			
		||||
				return (PeerData*)owner->chat(data.vchat_id().v);
 | 
			
		||||
			}, [&](const MTPDinputPeerChannel &data) {
 | 
			
		||||
				const auto channel = owner->channel(data.vchannel_id().v);
 | 
			
		||||
				channel->setAccessHash(data.vaccess_hash().v);
 | 
			
		||||
				return (PeerData*)channel;
 | 
			
		||||
			}, [&](const MTPDinputPeerSelf &data) {
 | 
			
		||||
				return (PeerData*)owner->session().user();
 | 
			
		||||
			}, [&](const auto &data) {
 | 
			
		||||
				return (PeerData*)nullptr;
 | 
			
		||||
			});
 | 
			
		||||
			return peer ? owner->history(peer).get() : nullptr;
 | 
			
		||||
		}) | ranges::views::filter([](History *history) {
 | 
			
		||||
			return history != nullptr;
 | 
			
		||||
		}) | ranges::views::transform([](History *history) {
 | 
			
		||||
			return not_null<History*>(history);
 | 
			
		||||
		});
 | 
			
		||||
		auto &&always = ranges::views::concat(
 | 
			
		||||
			data.vinclude_peers().v
 | 
			
		||||
		) | to_histories;
 | 
			
		||||
		auto pinned = ranges::views::all(
 | 
			
		||||
			data.vpinned_peers().v
 | 
			
		||||
		) | to_histories | ranges::to_vector;
 | 
			
		||||
		auto &&all = ranges::views::concat(always, pinned);
 | 
			
		||||
		auto list = base::flat_set<not_null<History*>>{
 | 
			
		||||
			all.begin(),
 | 
			
		||||
			all.end()
 | 
			
		||||
		};
 | 
			
		||||
		return ChatFilter(
 | 
			
		||||
			data.vid().v,
 | 
			
		||||
			qs(data.vtitle()),
 | 
			
		||||
			qs(data.vemoticon().value_or_empty()),
 | 
			
		||||
			(Flag::Community
 | 
			
		||||
				| (data.is_community_can_admin() ? Flag::Admin : Flag())),
 | 
			
		||||
			std::move(list),
 | 
			
		||||
			std::move(pinned),
 | 
			
		||||
			{});
 | 
			
		||||
	});
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
MTPDialogFilter ChatFilter::tl(FilterId replaceId) const {
 | 
			
		||||
	using TLFlag = MTPDdialogFilter::Flag;
 | 
			
		||||
	const auto flags = TLFlag(0)
 | 
			
		||||
		| ((_flags & Flag::Contacts) ? TLFlag::f_contacts : TLFlag(0))
 | 
			
		||||
		| ((_flags & Flag::NonContacts) ? TLFlag::f_non_contacts : TLFlag(0))
 | 
			
		||||
		| ((_flags & Flag::Groups) ? TLFlag::f_groups : TLFlag(0))
 | 
			
		||||
		| ((_flags & Flag::Channels) ? TLFlag::f_broadcasts : TLFlag(0))
 | 
			
		||||
		| ((_flags & Flag::Bots) ? TLFlag::f_bots : TLFlag(0))
 | 
			
		||||
		| ((_flags & Flag::NoMuted) ? TLFlag::f_exclude_muted : TLFlag(0))
 | 
			
		||||
		| ((_flags & Flag::NoRead) ? TLFlag::f_exclude_read : TLFlag(0))
 | 
			
		||||
		| ((_flags & Flag::NoArchived)
 | 
			
		||||
			? TLFlag::f_exclude_archived
 | 
			
		||||
			: TLFlag(0));
 | 
			
		||||
	auto always = _always;
 | 
			
		||||
	auto pinned = QVector<MTPInputPeer>();
 | 
			
		||||
	pinned.reserve(_pinned.size());
 | 
			
		||||
| 
						 | 
				
			
			@ -137,13 +169,39 @@ MTPDialogFilter ChatFilter::tl(FilterId replaceId) const {
 | 
			
		|||
	for (const auto &history : always) {
 | 
			
		||||
		include.push_back(history->peer->input);
 | 
			
		||||
	}
 | 
			
		||||
	if (_flags & Flag::Community) {
 | 
			
		||||
		using TLFlag = MTPDdialogFilterCommunity::Flag;
 | 
			
		||||
		const auto flags = TLFlag::f_emoticon
 | 
			
		||||
			| ((_flags & Flag::Admin)
 | 
			
		||||
				? TLFlag::f_community_can_admin
 | 
			
		||||
				: TLFlag(0));
 | 
			
		||||
		return MTP_dialogFilterCommunity(
 | 
			
		||||
			MTP_flags(flags),
 | 
			
		||||
			MTP_int(replaceId ? replaceId : _id),
 | 
			
		||||
			MTP_string(_title),
 | 
			
		||||
			MTP_string(_iconEmoji),
 | 
			
		||||
			MTP_vector<MTPInputPeer>(pinned),
 | 
			
		||||
			MTP_vector<MTPInputPeer>(include));
 | 
			
		||||
	}
 | 
			
		||||
	using TLFlag = MTPDdialogFilter::Flag;
 | 
			
		||||
	const auto flags = TLFlag::f_emoticon
 | 
			
		||||
		| ((_flags & Flag::Contacts) ? TLFlag::f_contacts : TLFlag(0))
 | 
			
		||||
		| ((_flags & Flag::NonContacts) ? TLFlag::f_non_contacts : TLFlag(0))
 | 
			
		||||
		| ((_flags & Flag::Groups) ? TLFlag::f_groups : TLFlag(0))
 | 
			
		||||
		| ((_flags & Flag::Channels) ? TLFlag::f_broadcasts : TLFlag(0))
 | 
			
		||||
		| ((_flags & Flag::Bots) ? TLFlag::f_bots : TLFlag(0))
 | 
			
		||||
		| ((_flags & Flag::NoMuted) ? TLFlag::f_exclude_muted : TLFlag(0))
 | 
			
		||||
		| ((_flags & Flag::NoRead) ? TLFlag::f_exclude_read : TLFlag(0))
 | 
			
		||||
		| ((_flags & Flag::NoArchived)
 | 
			
		||||
			? TLFlag::f_exclude_archived
 | 
			
		||||
			: TLFlag(0));
 | 
			
		||||
	auto never = QVector<MTPInputPeer>();
 | 
			
		||||
	never.reserve(_never.size());
 | 
			
		||||
	for (const auto &history : _never) {
 | 
			
		||||
		never.push_back(history->peer->input);
 | 
			
		||||
	}
 | 
			
		||||
	return MTP_dialogFilter(
 | 
			
		||||
		MTP_flags(flags | TLFlag::f_emoticon),
 | 
			
		||||
		MTP_flags(flags),
 | 
			
		||||
		MTP_int(replaceId ? replaceId : _id),
 | 
			
		||||
		MTP_string(_title),
 | 
			
		||||
		MTP_string(_iconEmoji),
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -22,15 +22,18 @@ class Session;
 | 
			
		|||
 | 
			
		||||
class ChatFilter final {
 | 
			
		||||
public:
 | 
			
		||||
	enum class Flag : uchar {
 | 
			
		||||
		Contacts    = 0x01,
 | 
			
		||||
		NonContacts = 0x02,
 | 
			
		||||
		Groups      = 0x04,
 | 
			
		||||
		Channels    = 0x08,
 | 
			
		||||
		Bots        = 0x10,
 | 
			
		||||
		NoMuted     = 0x20,
 | 
			
		||||
		NoRead      = 0x40,
 | 
			
		||||
		NoArchived  = 0x80,
 | 
			
		||||
	enum class Flag : ushort {
 | 
			
		||||
		Contacts    = (1 << 0),
 | 
			
		||||
		NonContacts = (1 << 1),
 | 
			
		||||
		Groups      = (1 << 2),
 | 
			
		||||
		Channels    = (1 << 3),
 | 
			
		||||
		Bots        = (1 << 4),
 | 
			
		||||
		NoMuted     = (1 << 5),
 | 
			
		||||
		NoRead      = (1 << 6),
 | 
			
		||||
		NoArchived  = (1 << 7),
 | 
			
		||||
 | 
			
		||||
		Community   = (1 << 8),
 | 
			
		||||
		Admin       = (1 << 9),
 | 
			
		||||
	};
 | 
			
		||||
	friend constexpr inline bool is_flag_type(Flag) { return true; };
 | 
			
		||||
	using Flags = base::flags<Flag>;
 | 
			
		||||
| 
						 | 
				
			
			@ -54,6 +57,7 @@ public:
 | 
			
		|||
	[[nodiscard]] QString title() const;
 | 
			
		||||
	[[nodiscard]] QString iconEmoji() const;
 | 
			
		||||
	[[nodiscard]] Flags flags() const;
 | 
			
		||||
	[[nodiscard]] bool admin() const;
 | 
			
		||||
	[[nodiscard]] const base::flat_set<not_null<History*>> &always() const;
 | 
			
		||||
	[[nodiscard]] const std::vector<not_null<History*>> &pinned() const;
 | 
			
		||||
	[[nodiscard]] const base::flat_set<not_null<History*>> &never() const;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue