Update layer to 95.

GitOrigin-RevId: 0d6b470b6ca6f72b5b87fbd899aaeae8892f8834
This commit is contained in:
levlam 2019-03-15 16:52:55 +03:00
parent 547720ccf6
commit 3ecf990ad6
21 changed files with 264 additions and 328 deletions

View File

@ -342,9 +342,13 @@ chatMemberStatusMember = ChatMemberStatus;
//@restricted_until_date Point in time (Unix timestamp) when restrictions will be lifted from the user; 0 if never. If the user is restricted for more than 366 days or for less than 30 seconds from the current time, the user is considered to be restricted forever
//@can_send_messages True, if the user can send text messages, contacts, locations, and venues
//@can_send_media_messages True, if the user can send audio files, documents, photos, videos, video notes, and voice notes. Implies can_send_messages permissions
//@can_send_polls True, if the user can send polls. Implies can_send_messages permissions
//@can_send_other_messages True, if the user can send animations, games, and stickers and use inline bots. Implies can_send_media_messages permissions
//@can_add_web_page_previews True, if the user may add a web page preview to his messages. Implies can_send_messages permissions
chatMemberStatusRestricted is_member:Bool restricted_until_date:int32 can_send_messages:Bool can_send_media_messages:Bool can_send_other_messages:Bool can_add_web_page_previews:Bool = ChatMemberStatus;
//@can_change_info True, if the user can change the chat title, photo, and other settings; applicable to groups only
//@can_invite_users True, if the user can invite new users to the chat; applicable to groups only
//@can_pin_messages True, if the user can pin messages; applicable to groups only
chatMemberStatusRestricted is_member:Bool restricted_until_date:int32 can_send_messages:Bool can_send_media_messages:Bool can_send_polls:Bool can_send_other_messages:Bool can_add_web_page_previews:Bool can_change_info:Bool can_invite_users:Bool can_pin_messages:Bool = ChatMemberStatus;
//@description The user is not a chat member
chatMemberStatusLeft = ChatMemberStatus;
@ -3483,19 +3487,12 @@ disconnectWebsite website_id:int64 = Ok;
disconnectAllWebsites = Ok;
//@description Toggles the "All members are admins" setting in basic groups; requires creator privileges in the group @basic_group_id Identifier of the basic group @everyone_is_administrator New value of everyone_is_administrator
toggleBasicGroupAdministrators basic_group_id:int32 everyone_is_administrator:Bool = Ok;
//@description Changes the username of a supergroup or channel, requires creator privileges in the supergroup or channel @supergroup_id Identifier of the supergroup or channel @username New value of the username. Use an empty string to remove the username
setSupergroupUsername supergroup_id:int32 username:string = Ok;
//@description Changes the sticker set of a supergroup; requires appropriate rights in the supergroup @supergroup_id Identifier of the supergroup @sticker_set_id New value of the supergroup sticker set identifier. Use 0 to remove the supergroup sticker set
setSupergroupStickerSet supergroup_id:int32 sticker_set_id:int64 = Ok;
//@description Toggles whether all members of a supergroup can add new members; requires appropriate administrator rights in the supergroup. @supergroup_id Identifier of the supergroup @anyone_can_invite New value of anyone_can_invite
toggleSupergroupInvites supergroup_id:int32 anyone_can_invite:Bool = Ok;
//@description Toggles sender signatures messages sent in a channel; requires appropriate administrator rights in the channel. @supergroup_id Identifier of the channel @sign_messages New value of sign_messages
toggleSupergroupSignMessages supergroup_id:int32 sign_messages:Bool = Ok;

Binary file not shown.

View File

@ -105,12 +105,12 @@ userStatusLastWeek#7bf09fc = UserStatus;
userStatusLastMonth#77ebc742 = UserStatus;
chatEmpty#9ba2d800 id:int = Chat;
chat#d91cdd54 flags:# creator:flags.0?true kicked:flags.1?true left:flags.2?true admins_enabled:flags.3?true admin:flags.4?true deactivated:flags.5?true id:int title:string photo:ChatPhoto participants_count:int date:int version:int migrated_to:flags.6?InputChannel = Chat;
chat#3bda1bde flags:# creator:flags.0?true kicked:flags.1?true left:flags.2?true deactivated:flags.5?true id:int title:string photo:ChatPhoto participants_count:int date:int version:int migrated_to:flags.6?InputChannel admin_rights:flags.14?ChatAdminRights default_banned_rights:flags.18?ChatBannedRights = Chat;
chatForbidden#7328bdb id:int title:string = Chat;
channel#c88974ac flags:# creator:flags.0?true left:flags.2?true editor:flags.3?true broadcast:flags.5?true verified:flags.7?true megagroup:flags.8?true restricted:flags.9?true democracy:flags.10?true signatures:flags.11?true min:flags.12?true id:int access_hash:flags.13?long title:string username:flags.6?string photo:ChatPhoto date:int version:int restriction_reason:flags.9?string admin_rights:flags.14?ChannelAdminRights banned_rights:flags.15?ChannelBannedRights participants_count:flags.17?int = Chat;
channel#4df30834 flags:# creator:flags.0?true left:flags.2?true broadcast:flags.5?true verified:flags.7?true megagroup:flags.8?true restricted:flags.9?true signatures:flags.11?true min:flags.12?true id:int access_hash:flags.13?long title:string username:flags.6?string photo:ChatPhoto date:int version:int restriction_reason:flags.9?string admin_rights:flags.14?ChatAdminRights banned_rights:flags.15?ChatBannedRights default_banned_rights:flags.18?ChatBannedRights participants_count:flags.17?int = Chat;
channelForbidden#289da732 flags:# broadcast:flags.5?true megagroup:flags.8?true id:int access_hash:long title:string until_date:flags.16?int = Chat;
chatFull#edd2a791 flags:# id:int participants:ChatParticipants chat_photo:flags.2?Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite bot_info:flags.3?Vector<BotInfo> pinned_msg_id:flags.6?int = ChatFull;
chatFull#22a235da flags:# can_set_username:flags.7?true id:int about:string participants:ChatParticipants chat_photo:flags.2?Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite bot_info:flags.3?Vector<BotInfo> pinned_msg_id:flags.6?int = ChatFull;
channelFull#1c87a71a flags:# can_view_participants:flags.3?true can_set_username:flags.6?true can_set_stickers:flags.7?true hidden_prehistory:flags.10?true can_view_stats:flags.12?true id:int about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int online_count:flags.13?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite bot_info:Vector<BotInfo> migrated_from_chat_id:flags.4?int migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int stickerset:flags.8?StickerSet available_min_id:flags.9?int = ChatFull;
chatParticipant#c8d7493e user_id:int inviter_id:int date:int = ChatParticipant;
@ -196,8 +196,7 @@ peerNotifySettings#af509d20 flags:# show_previews:flags.0?Bool silent:flags.1?Bo
peerSettings#818426cd flags:# report_spam:flags.0?true = PeerSettings;
wallPaper#ccb03657 id:int title:string sizes:Vector<PhotoSize> color:int = WallPaper;
wallPaperSolid#63117f24 id:int title:string bg_color:int color:int = WallPaper;
wallPaper#a437c3ed id:long flags:# creator:flags.0?true default:flags.1?true pattern:flags.3?true dark:flags.4?true access_hash:long slug:string document:Document settings:flags.2?WallPaperSettings = WallPaper;
inputReportReasonSpam#58dbcab8 = ReportReason;
inputReportReasonViolence#1e22c78d = ReportReason;
@ -291,7 +290,6 @@ updateNewChannelMessage#62ba04d9 message:Message pts:int pts_count:int = Update;
updateReadChannelInbox#4214f37f channel_id:int max_id:int = Update;
updateDeleteChannelMessages#c37521c9 channel_id:int messages:Vector<int> pts:int pts_count:int = Update;
updateChannelMessageViews#98a12b4b channel_id:int id:int views:int = Update;
updateChatAdmins#6e947941 chat_id:int enabled:Bool version:int = Update;
updateChatParticipantAdmin#b6901959 chat_id:int user_id:int is_admin:Bool version:int = Update;
updateNewStickerSet#688a30aa stickerset:messages.StickerSet = Update;
updateStickerSetsOrder#bb2d201 flags:# masks:flags.0?true order:Vector<long> = Update;
@ -328,6 +326,7 @@ updateDialogUnreadMark#e16459c3 flags:# unread:flags.0?true peer:DialogPeer = Up
updateUserPinnedMessage#4c43da18 user_id:int id:int = Update;
updateChatPinnedMessage#22893b26 chat_id:int id:int = Update;
updateMessagePoll#aca1657b flags:# poll_id:long poll:flags.0?Poll results:PollResults = Update;
updateChatDefaultBannedRights#54c01850 peer:Peer default_banned_rights:ChatBannedRights version:int = Update;
updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State;
@ -392,7 +391,7 @@ inputDocumentEmpty#72f0eaae = InputDocument;
inputDocument#1abfb575 id:long access_hash:long file_reference:bytes = InputDocument;
documentEmpty#36f8c871 id:long = Document;
document#59534e4c id:long access_hash:long file_reference:bytes date:int mime_type:string size:int thumb:PhotoSize dc_id:int attributes:Vector<DocumentAttribute> = Document;
document#9ba29cc1 flags:# id:long access_hash:long file_reference:bytes date:int mime_type:string size:int thumbs:flags.0?Vector<PhotoSize> dc_id:int attributes:Vector<DocumentAttribute> = Document;
help.support#17c6b5f6 phone_number:string user:User = help.Support;
@ -556,8 +555,8 @@ channelMessagesFilter#cd77d957 flags:# exclude_new_messages:flags.1?true ranges:
channelParticipant#15ebac1d user_id:int date:int = ChannelParticipant;
channelParticipantSelf#a3289a6d user_id:int inviter_id:int date:int = ChannelParticipant;
channelParticipantCreator#e3e2e1f9 user_id:int = ChannelParticipant;
channelParticipantAdmin#a82fa898 flags:# can_edit:flags.0?true user_id:int inviter_id:int promoted_by:int date:int admin_rights:ChannelAdminRights = ChannelParticipant;
channelParticipantBanned#222c1886 flags:# left:flags.0?true user_id:int kicked_by:int date:int banned_rights:ChannelBannedRights = ChannelParticipant;
channelParticipantAdmin#5daa6e23 flags:# can_edit:flags.0?true self:flags.1?true user_id:int inviter_id:flags.1?int promoted_by:int date:int admin_rights:ChatAdminRights = ChannelParticipant;
channelParticipantBanned#1c0facaf flags:# left:flags.0?true user_id:int kicked_by:int date:int banned_rights:ChatBannedRights = ChannelParticipant;
channelParticipantsRecent#de3f3c79 = ChannelParticipantsFilter;
channelParticipantsAdmins#b4608969 = ChannelParticipantsFilter;
@ -565,6 +564,7 @@ channelParticipantsKicked#a3b54985 q:string = ChannelParticipantsFilter;
channelParticipantsBots#b0d1865b = ChannelParticipantsFilter;
channelParticipantsBanned#1427a5e1 q:string = ChannelParticipantsFilter;
channelParticipantsSearch#656ac4b q:string = ChannelParticipantsFilter;
channelParticipantsContacts#bb6ae88d q:string = ChannelParticipantsFilter;
channels.channelParticipants#f56ee2a8 count:int participants:Vector<ChannelParticipant> users:Vector<User> = channels.ChannelParticipants;
channels.channelParticipantsNotModified#f0173fe9 = channels.ChannelParticipants;
@ -801,10 +801,6 @@ langPackDifference#f385c1f6 lang_code:string from_version:int version:int string
langPackLanguage#eeca5ce3 flags:# official:flags.0?true rtl:flags.2?true beta:flags.3?true name:string native_name:string lang_code:string base_lang_code:flags.1?string plural_code:string strings_count:int translated_count:int translations_url:string = LangPackLanguage;
channelAdminRights#5d7ceba5 flags:# change_info:flags.0?true post_messages:flags.1?true edit_messages:flags.2?true delete_messages:flags.3?true ban_users:flags.4?true invite_users:flags.5?true invite_link:flags.6?true pin_messages:flags.7?true add_admins:flags.9?true = ChannelAdminRights;
channelBannedRights#58cf4249 flags:# view_messages:flags.0?true send_messages:flags.1?true send_media:flags.2?true send_stickers:flags.3?true send_gifs:flags.4?true send_games:flags.5?true send_inline:flags.6?true embed_links:flags.7?true until_date:int = ChannelBannedRights;
channelAdminLogEventActionChangeTitle#e6dfb825 prev_value:string new_value:string = ChannelAdminLogEventAction;
channelAdminLogEventActionChangeAbout#55188a2e prev_value:string new_value:string = ChannelAdminLogEventAction;
channelAdminLogEventActionChangeUsername#6a4afc38 prev_value:string new_value:string = ChannelAdminLogEventAction;
@ -821,6 +817,8 @@ channelAdminLogEventActionParticipantToggleBan#e6d83d7e prev_participant:Channel
channelAdminLogEventActionParticipantToggleAdmin#d5676710 prev_participant:ChannelParticipant new_participant:ChannelParticipant = ChannelAdminLogEventAction;
channelAdminLogEventActionChangeStickerSet#b1c3caa7 prev_stickerset:InputStickerSet new_stickerset:InputStickerSet = ChannelAdminLogEventAction;
channelAdminLogEventActionTogglePreHistoryHidden#5f5c95f1 new_value:Bool = ChannelAdminLogEventAction;
channelAdminLogEventActionDefaultBannedRights#2df5fc0a prev_banned_rights:ChatBannedRights new_banned_rights:ChatBannedRights = ChannelAdminLogEventAction;
channelAdminLogEventActionStopPoll#8f079643 message:Message = ChannelAdminLogEventAction;
channelAdminLogEvent#3b5a3e40 id:long date:int user_id:int action:ChannelAdminLogEventAction = ChannelAdminLogEvent;
@ -984,6 +982,20 @@ chatOnlines#f041e250 onlines:int = ChatOnlines;
statsURL#47a971e0 url:string = StatsURL;
chatAdminRights#5fb224d5 flags:# change_info:flags.0?true post_messages:flags.1?true edit_messages:flags.2?true delete_messages:flags.3?true ban_users:flags.4?true invite_users:flags.5?true pin_messages:flags.7?true add_admins:flags.9?true = ChatAdminRights;
chatBannedRights#9f120418 flags:# view_messages:flags.0?true send_messages:flags.1?true send_media:flags.2?true send_stickers:flags.3?true send_gifs:flags.4?true send_games:flags.5?true send_inline:flags.6?true embed_links:flags.7?true send_polls:flags.8?true change_info:flags.10?true invite_users:flags.15?true pin_messages:flags.17?true until_date:int = ChatBannedRights;
inputWallPaper#e630b979 id:long access_hash:long = InputWallPaper;
inputWallPaperSlug#72091c80 slug:string = InputWallPaper;
account.wallPapersNotModified#1c199183 = account.WallPapers;
account.wallPapers#702b65a9 hash:int wallpapers:Vector<WallPaper> = account.WallPapers;
codeSettings#302f59f3 flags:# allow_flashcall:flags.0?true current_number:flags.1?true app_hash_persistent:flags.2?true app_hash:flags.3?string = CodeSettings;
wallPaperSettings#a12f40b8 flags:# blur:flags.1?true motion:flags.2?true background_color:flags.0?int intensity:flags.3?int = WallPaperSettings;
---functions---
invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X;
@ -994,7 +1006,7 @@ invokeWithoutUpdates#bf9459b7 {X:Type} query:!X = X;
invokeWithMessagesRange#365275f2 {X:Type} range:MessageRange query:!X = X;
invokeWithTakeout#aca9fd2e {X:Type} takeout_id:long query:!X = X;
auth.sendCode#86aef0ec flags:# allow_flashcall:flags.0?true phone_number:string current_number:flags.0?Bool api_id:int api_hash:string = auth.SentCode;
auth.sendCode#a677244f phone_number:string api_id:int api_hash:string settings:CodeSettings = auth.SentCode;
auth.signUp#1b067634 phone_number:string phone_code_hash:string phone_code:string first_name:string last_name:string = auth.Authorization;
auth.signIn#bcd51581 phone_number:string phone_code_hash:string phone_code:string = auth.Authorization;
auth.logOut#5717da40 = Bool;
@ -1017,7 +1029,7 @@ account.getNotifySettings#12b3ad31 peer:InputNotifyPeer = PeerNotifySettings;
account.resetNotifySettings#db7e1747 = Bool;
account.updateProfile#78515775 flags:# first_name:flags.0?string last_name:flags.1?string about:flags.2?string = User;
account.updateStatus#6628562c offline:Bool = Bool;
account.getWallPapers#c04cfac2 = Vector<WallPaper>;
account.getWallPapers#aabb1763 hash:int = account.WallPapers;
account.reportPeer#ae189d5f peer:InputPeer reason:ReportReason = Bool;
account.checkUsername#2714d86c username:string = Bool;
account.updateUsername#3e0bdd7c username:string = User;
@ -1026,7 +1038,7 @@ account.setPrivacy#c9f81ce8 key:InputPrivacyKey rules:Vector<InputPrivacyRule> =
account.deleteAccount#418d4e0b reason:string = Bool;
account.getAccountTTL#8fc711d = AccountDaysTTL;
account.setAccountTTL#2442485e ttl:AccountDaysTTL = Bool;
account.sendChangePhoneCode#8e57deb flags:# allow_flashcall:flags.0?true phone_number:string current_number:flags.0?Bool = auth.SentCode;
account.sendChangePhoneCode#82574ae5 phone_number:string settings:CodeSettings = auth.SentCode;
account.changePhone#70c32edb phone_number:string phone_code_hash:string phone_code:string = User;
account.updateDeviceLocked#38df3532 period:int = Bool;
account.getAuthorizations#e320c158 = account.Authorizations;
@ -1034,7 +1046,7 @@ account.resetAuthorization#df77f3bc hash:long = Bool;
account.getPassword#548a30f5 = account.Password;
account.getPasswordSettings#9cd4eaf9 password:InputCheckPasswordSRP = account.PasswordSettings;
account.updatePasswordSettings#a59b102f password:InputCheckPasswordSRP new_settings:account.PasswordInputSettings = Bool;
account.sendConfirmPhoneCode#1516d7bd flags:# allow_flashcall:flags.0?true hash:string current_number:flags.0?Bool = auth.SentCode;
account.sendConfirmPhoneCode#1b3faa88 hash:string settings:CodeSettings = auth.SentCode;
account.confirmPhone#5f2178c3 phone_code_hash:string phone_code:string = Bool;
account.getTmpPassword#449e0b51 password:InputCheckPasswordSRP period:int = account.TmpPassword;
account.getWebAuthorizations#182e6d6f = account.WebAuthorizations;
@ -1046,7 +1058,7 @@ account.saveSecureValue#899fe31d value:InputSecureValue secure_secret_id:long =
account.deleteSecureValue#b880bc4b types:Vector<SecureValueType> = Bool;
account.getAuthorizationForm#b86ba8e1 bot_id:int scope:string public_key:string = account.AuthorizationForm;
account.acceptAuthorization#e7027c94 bot_id:int scope:string public_key:string value_hashes:Vector<SecureValueHash> credentials:SecureCredentialsEncrypted = Bool;
account.sendVerifyPhoneCode#823380b4 flags:# allow_flashcall:flags.0?true phone_number:string current_number:flags.0?Bool = auth.SentCode;
account.sendVerifyPhoneCode#a5a356f9 phone_number:string settings:CodeSettings = auth.SentCode;
account.verifyPhone#4dd3a7f6 phone_number:string phone_code_hash:string phone_code:string = Bool;
account.sendVerifyEmailCode#7011509f email:string = account.SentEmailCode;
account.verifyEmail#ecba39db email:string code:string = Bool;
@ -1058,6 +1070,11 @@ account.cancelPasswordEmail#c1cbd5b6 = Bool;
account.getContactSignUpNotification#9f07c728 = Bool;
account.setContactSignUpNotification#cff43f61 silent:Bool = Bool;
account.getNotifyExceptions#53577479 flags:# compare_sound:flags.1?true peer:flags.0?InputNotifyPeer = Updates;
account.getWallPaper#fc8ddbea wallpaper:InputWallPaper = WallPaper;
account.uploadWallPaper#dd853661 file:InputFile mime_type:string settings:WallPaperSettings = WallPaper;
account.saveWallPaper#6c5a5b37 wallpaper:InputWallPaper unsave:Bool settings:WallPaperSettings = Bool;
account.installWallPaper#feed5769 wallpaper:InputWallPaper settings:WallPaperSettings = Bool;
account.resetWallPapers#bb3b9804 = Bool;
users.getUsers#d91a548 id:Vector<InputUser> = Vector<User>;
users.getFullUser#ca30a5b1 id:InputUser = UserFull;
@ -1119,7 +1136,7 @@ messages.readMessageContents#36a73f77 id:Vector<int> = messages.AffectedMessages
messages.getStickers#43d4f2c emoticon:string hash:int = messages.Stickers;
messages.getAllStickers#1c9618b1 hash:int = messages.AllStickers;
messages.getWebPagePreview#8b68b0cc flags:# message:string entities:flags.3?Vector<MessageEntity> = MessageMedia;
messages.exportChatInvite#7d885289 chat_id:int = ExportedChatInvite;
messages.exportChatInvite#df7534c peer:InputPeer = ExportedChatInvite;
messages.checkChatInvite#3eadb1bb hash:string = ChatInvite;
messages.importChatInvite#6c50051c hash:string = Updates;
messages.getStickerSet#2619a90e stickerset:InputStickerSet = messages.StickerSet;
@ -1127,7 +1144,6 @@ messages.installStickerSet#c78fe460 stickerset:InputStickerSet archived:Bool = m
messages.uninstallStickerSet#f96e55de stickerset:InputStickerSet = Bool;
messages.startBot#e6df7378 bot:InputUser peer:InputPeer random_id:long start_param:string = Updates;
messages.getMessagesViews#c4c8a55d peer:InputPeer id:Vector<int> increment:Bool = Vector<int>;
messages.toggleChatAdmins#ec8bd9e1 chat_id:int enabled:Bool = Updates;
messages.editChatAdmin#a9e69f2e chat_id:int user_id:InputUser is_admin:Bool = Bool;
messages.migrateChat#15a3b8e3 chat_id:int = Updates;
messages.searchGlobal#9e3cacb0 q:string offset_date:int offset_peer:InputPeer offset_id:int limit:int = messages.Messages;
@ -1186,6 +1202,8 @@ messages.sendVote#10ea6184 peer:InputPeer msg_id:int options:Vector<bytes> = Upd
messages.getPollResults#73bb643b peer:InputPeer msg_id:int = Updates;
messages.getOnlines#6e2be050 peer:InputPeer = ChatOnlines;
messages.getStatsURL#83f6c0cd peer:InputPeer = StatsURL;
messages.editChatAbout#def60797 peer:InputPeer about:string = Bool;
messages.editChatDefaultBannedRights#a5866b41 peer:InputPeer banned_rights:ChatBannedRights = Updates;
updates.getState#edd4882a = updates.State;
updates.getDifference#25939651 flags:# pts:int pts_total_limit:flags.0?int date:int qts:int = updates.Difference;
@ -1235,8 +1253,7 @@ channels.getParticipant#546dd7a6 channel:InputChannel user_id:InputUser = channe
channels.getChannels#a7f6bbb id:Vector<InputChannel> = messages.Chats;
channels.getFullChannel#8736a09 channel:InputChannel = messages.ChatFull;
channels.createChannel#f4893d7f flags:# broadcast:flags.0?true megagroup:flags.1?true title:string about:string = Updates;
channels.editAbout#13e27f1e channel:InputChannel about:string = Bool;
channels.editAdmin#20b88214 channel:InputChannel user_id:InputUser admin_rights:ChannelAdminRights = Updates;
channels.editAdmin#70f893ba channel:InputChannel user_id:InputUser admin_rights:ChatAdminRights = Updates;
channels.editTitle#566decd0 channel:InputChannel title:string = Updates;
channels.editPhoto#f12e57c9 channel:InputChannel photo:InputChatPhoto = Updates;
channels.checkUsername#10e6bd2c channel:InputChannel username:string = Bool;
@ -1244,13 +1261,11 @@ channels.updateUsername#3514b3de channel:InputChannel username:string = Bool;
channels.joinChannel#24b524c5 channel:InputChannel = Updates;
channels.leaveChannel#f836aa95 channel:InputChannel = Updates;
channels.inviteToChannel#199f3a6c channel:InputChannel users:Vector<InputUser> = Updates;
channels.exportInvite#c7560885 channel:InputChannel = ExportedChatInvite;
channels.deleteChannel#c0111fe3 channel:InputChannel = Updates;
channels.toggleInvites#49609307 channel:InputChannel enabled:Bool = Updates;
channels.exportMessageLink#ceb77163 channel:InputChannel id:int grouped:Bool = ExportedMessageLink;
channels.toggleSignatures#1f69b606 channel:InputChannel enabled:Bool = Updates;
channels.getAdminedPublicChannels#8d8d82d7 = messages.Chats;
channels.editBanned#bfd915cd channel:InputChannel user_id:InputUser banned_rights:ChannelBannedRights = Updates;
channels.editBanned#72796912 channel:InputChannel user_id:InputUser banned_rights:ChatBannedRights = Updates;
channels.getAdminLog#33ddf480 flags:# channel:InputChannel q:string events_filter:flags.0?ChannelAdminLogEventsFilter admins:flags.1?Vector<InputUser> max_id:long min_id:long limit:int = channels.AdminLogResults;
channels.setStickers#ea8ca4f9 channel:InputChannel stickerset:InputStickerSet = Bool;
channels.readMessageContents#eab5dc38 channel:InputChannel id:Vector<int> = Bool;

Binary file not shown.

View File

@ -903,40 +903,6 @@ class UpdateUsernameQuery : public Td::ResultHandler {
}
};
class ToggleChatAdminsQuery : public Td::ResultHandler {
Promise<Unit> promise_;
public:
explicit ToggleChatAdminsQuery(Promise<Unit> &&promise) : promise_(std::move(promise)) {
}
void send(ChatId chat_id, bool everyone_is_administrator) {
send_query(G()->net_query_creator().create(
create_storer(telegram_api::messages_toggleChatAdmins(chat_id.get(), !everyone_is_administrator))));
}
void on_result(uint64 id, BufferSlice packet) override {
auto result_ptr = fetch_result<telegram_api::messages_toggleChatAdmins>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
}
auto ptr = result_ptr.move_as_ok();
LOG(INFO) << "Receive result for toggleChatAdmins: " << to_string(ptr);
td->updates_manager_->on_get_updates(std::move(ptr));
promise_.set_value(Unit());
}
void on_error(uint64 id, Status status) override {
if (status.message() == "CHAT_NOT_MODIFIED" && !td->auth_manager_->is_bot()) {
promise_.set_value(Unit());
return;
}
promise_.set_error(std::move(status));
}
};
class CheckChannelUsernameQuery : public Td::ResultHandler {
Promise<bool> promise_;
ChannelId channel_id_;
@ -1073,48 +1039,6 @@ class SetChannelStickerSetQuery : public Td::ResultHandler {
}
};
class ToggleChannelInvitesQuery : public Td::ResultHandler {
Promise<Unit> promise_;
ChannelId channel_id_;
public:
explicit ToggleChannelInvitesQuery(Promise<Unit> &&promise) : promise_(std::move(promise)) {
}
void send(ChannelId channel_id, bool anyone_can_invite) {
channel_id_ = channel_id;
auto input_channel = td->contacts_manager_->get_input_channel(channel_id);
CHECK(input_channel != nullptr);
send_query(G()->net_query_creator().create(
create_storer(telegram_api::channels_toggleInvites(std::move(input_channel), anyone_can_invite))));
}
void on_result(uint64 id, BufferSlice packet) override {
auto result_ptr = fetch_result<telegram_api::channels_toggleInvites>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
}
auto ptr = result_ptr.move_as_ok();
LOG(INFO) << "Receive result for toggleChannelInvites: " << to_string(ptr);
td->updates_manager_->on_get_updates(std::move(ptr));
promise_.set_value(Unit());
}
void on_error(uint64 id, Status status) override {
if (status.message() == "CHAT_NOT_MODIFIED") {
if (!td->auth_manager_->is_bot()) {
promise_.set_value(Unit());
return;
}
} else {
td->contacts_manager_->on_get_channel_error(channel_id_, status, "ToggleChannelInvitesQuery");
}
promise_.set_error(std::move(status));
}
};
class ToggleChannelSignaturesQuery : public Td::ResultHandler {
Promise<Unit> promise_;
ChannelId channel_id_;
@ -1215,14 +1139,16 @@ class EditChannelAboutQuery : public Td::ResultHandler {
void send(ChannelId channel_id, const string &about) {
channel_id_ = channel_id;
about_ = about;
auto input_channel = td->contacts_manager_->get_input_channel(channel_id);
CHECK(input_channel != nullptr);
auto input_peer = td->messages_manager_->get_input_peer(DialogId(channel_id), AccessRights::Read);
if (input_peer == nullptr) {
return on_error(0, Status::Error(400, "Can't access the chat"));
}
send_query(G()->net_query_creator().create(
create_storer(telegram_api::channels_editAbout(std::move(input_channel), about))));
create_storer(telegram_api::messages_editChatAbout(std::move(input_peer), about))));
}
void on_result(uint64 id, BufferSlice packet) override {
auto result_ptr = fetch_result<telegram_api::channels_editAbout>(packet);
auto result_ptr = fetch_result<telegram_api::messages_editChatAbout>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
}
@ -1230,7 +1156,7 @@ class EditChannelAboutQuery : public Td::ResultHandler {
bool result = result_ptr.ok();
LOG(DEBUG) << "Receive result for editChannelAbout " << result;
if (!result) {
return on_error(id, Status::Error(500, "Supergroup description is not updated"));
return on_error(id, Status::Error(500, "Chat description is not updated"));
}
td->contacts_manager_->on_update_channel_description(channel_id_, std::move(about_));
@ -1404,7 +1330,12 @@ class ExportChatInviteLinkQuery : public Td::ResultHandler {
void send(ChatId chat_id) {
chat_id_ = chat_id;
send_query(G()->net_query_creator().create(create_storer(telegram_api::messages_exportChatInvite(chat_id.get()))));
auto input_peer = td->messages_manager_->get_input_peer(DialogId(chat_id), AccessRights::Read);
if (input_peer == nullptr) {
return on_error(0, Status::Error(400, "Can't access the chat"));
}
send_query(
G()->net_query_creator().create(create_storer(telegram_api::messages_exportChatInvite(std::move(input_peer)))));
}
void on_result(uint64 id, BufferSlice packet) override {
@ -1436,14 +1367,16 @@ class ExportChannelInviteLinkQuery : public Td::ResultHandler {
void send(ChannelId channel_id) {
channel_id_ = channel_id;
auto input_channel = td->contacts_manager_->get_input_channel(channel_id);
CHECK(input_channel != nullptr);
auto input_peer = td->messages_manager_->get_input_peer(DialogId(channel_id), AccessRights::Read);
if (input_peer == nullptr) {
return on_error(0, Status::Error(400, "Can't access the chat"));
}
send_query(
G()->net_query_creator().create(create_storer(telegram_api::channels_exportInvite(std::move(input_channel)))));
G()->net_query_creator().create(create_storer(telegram_api::messages_exportChatInvite(std::move(input_peer)))));
}
void on_result(uint64 id, BufferSlice packet) override {
auto result_ptr = fetch_result<telegram_api::channels_exportInvite>(packet);
auto result_ptr = fetch_result<telegram_api::messages_exportChatInvite>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
}
@ -1652,7 +1585,7 @@ class EditChannelAdminQuery : public Td::ResultHandler {
auto input_channel = td->contacts_manager_->get_input_channel(channel_id);
CHECK(input_channel != nullptr);
send_query(G()->net_query_creator().create(create_storer(telegram_api::channels_editAdmin(
std::move(input_channel), std::move(input_user), status.get_channel_admin_rights()))));
std::move(input_channel), std::move(input_user), status.get_chat_admin_rights()))));
}
void on_result(uint64 id, BufferSlice packet) override {
@ -1689,7 +1622,7 @@ class EditChannelBannedQuery : public Td::ResultHandler {
auto input_channel = td->contacts_manager_->get_input_channel(channel_id);
CHECK(input_channel != nullptr);
send_query(G()->net_query_creator().create(create_storer(telegram_api::channels_editBanned(
std::move(input_channel), std::move(input_user), status.get_channel_banned_rights()))));
std::move(input_channel), std::move(input_user), status.get_chat_banned_rights()))));
}
void on_result(uint64 id, BufferSlice packet) override {
@ -4036,19 +3969,6 @@ void ContactsManager::set_username(const string &username, Promise<Unit> &&promi
td_->create_handler<UpdateUsernameQuery>(std::move(promise))->send(username);
}
void ContactsManager::toggle_chat_administrators(ChatId chat_id, bool everyone_is_administrator,
Promise<Unit> &&promise) {
auto c = get_chat(chat_id);
if (c == nullptr) {
return promise.set_error(Status::Error(6, "Group not found"));
}
if (!get_chat_status(c).is_creator()) {
return promise.set_error(Status::Error(6, "Not enough rights to toggle basic group administrators"));
}
td_->create_handler<ToggleChatAdminsQuery>(std::move(promise))->send(chat_id, everyone_is_administrator);
}
void ContactsManager::set_channel_username(ChannelId channel_id, const string &username, Promise<Unit> &&promise) {
auto c = get_channel(channel_id);
if (c == nullptr) {
@ -4103,21 +4023,6 @@ void ContactsManager::set_channel_sticker_set(ChannelId channel_id, int64 sticke
->send(channel_id, sticker_set_id, std::move(input_sticker_set));
}
void ContactsManager::toggle_channel_invites(ChannelId channel_id, bool anyone_can_invite, Promise<Unit> &&promise) {
auto c = get_channel(channel_id);
if (c == nullptr) {
return promise.set_error(Status::Error(6, "Supergroup not found"));
}
if (!get_channel_status(c).can_change_info_and_settings()) {
return promise.set_error(Status::Error(6, "Not enough rights to toggle supergroup invites"));
}
if (get_channel_type(c) != ChannelType::Megagroup) {
return promise.set_error(Status::Error(6, "Invites by any member can be enabled in the supergroups only"));
}
td_->create_handler<ToggleChannelInvitesQuery>(std::move(promise))->send(channel_id, anyone_can_invite);
}
void ContactsManager::toggle_channel_sign_messages(ChannelId channel_id, bool sign_messages, Promise<Unit> &&promise) {
auto c = get_channel(channel_id);
if (c == nullptr) {
@ -9811,8 +9716,8 @@ void ContactsManager::on_chat_update(telegram_api::chat &chat, const char *sourc
}
bool is_creator = 0 != (chat.flags_ & CHAT_FLAG_USER_IS_CREATOR);
bool is_administrator = 0 != (chat.flags_ & CHAT_FLAG_IS_ADMINISTRATOR);
bool everyone_is_administrator = 0 == (chat.flags_ & CHAT_FLAG_ADMINISTRATORS_ENABLED);
bool is_administrator = false; // 0 != (chat.flags_ & CHAT_FLAG_IS_ADMINISTRATOR);
bool everyone_is_administrator = true; // 0 == (chat.flags_ & CHAT_FLAG_ADMINISTRATORS_ENABLED);
bool is_active = 0 == (chat.flags_ & CHAT_FLAG_IS_DEACTIVATED);
@ -9920,7 +9825,7 @@ void ContactsManager::on_chat_update(telegram_api::channel &channel, const char
bool has_access_hash = (channel.flags_ & CHANNEL_FLAG_HAS_ACCESS_HASH) != 0;
auto access_hash = has_access_hash ? channel.access_hash_ : 0;
bool anyone_can_invite = (channel.flags_ & CHANNEL_FLAG_ANYONE_CAN_INVITE) != 0;
bool anyone_can_invite = true; // (channel.flags_ & CHANNEL_FLAG_ANYONE_CAN_INVITE) != 0;
bool sign_messages = (channel.flags_ & CHANNEL_FLAG_SIGN_MESSAGES) != 0;
bool is_megagroup = (channel.flags_ & CHANNEL_FLAG_IS_MEGAGROUP) != 0;
bool is_verified = (channel.flags_ & CHANNEL_FLAG_IS_VERIFIED) != 0;

View File

@ -283,14 +283,10 @@ class ContactsManager : public Actor {
void set_username(const string &username, Promise<Unit> &&promise);
void toggle_chat_administrators(ChatId chat_id, bool everyone_is_administrator, Promise<Unit> &&promise);
void set_channel_username(ChannelId channel_id, const string &username, Promise<Unit> &&promise);
void set_channel_sticker_set(ChannelId channel_id, int64 sticker_set_id, Promise<Unit> &&promise);
void toggle_channel_invites(ChannelId channel_id, bool anyone_can_invite, Promise<Unit> &&promise);
void toggle_channel_sign_messages(ChannelId channel_id, bool sign_messages, Promise<Unit> &&promise);
void toggle_channel_is_all_history_available(ChannelId channel_id, bool is_all_history_available,
@ -751,8 +747,8 @@ class ContactsManager : public Actor {
static constexpr int32 CHAT_FLAG_USER_IS_CREATOR = 1 << 0;
static constexpr int32 CHAT_FLAG_USER_WAS_KICKED = 1 << 1;
static constexpr int32 CHAT_FLAG_USER_HAS_LEFT = 1 << 2;
static constexpr int32 CHAT_FLAG_ADMINISTRATORS_ENABLED = 1 << 3;
static constexpr int32 CHAT_FLAG_IS_ADMINISTRATOR = 1 << 4;
// static constexpr int32 CHAT_FLAG_ADMINISTRATORS_ENABLED = 1 << 3;
// static constexpr int32 CHAT_FLAG_IS_ADMINISTRATOR = 1 << 4;
static constexpr int32 CHAT_FLAG_IS_DEACTIVATED = 1 << 5;
static constexpr int32 CHAT_FLAG_WAS_MIGRATED = 1 << 6;
@ -765,7 +761,7 @@ class ContactsManager : public Actor {
static constexpr int32 CHANNEL_FLAG_IS_VERIFIED = 1 << 7;
static constexpr int32 CHANNEL_FLAG_IS_MEGAGROUP = 1 << 8;
static constexpr int32 CHANNEL_FLAG_IS_RESTRICTED = 1 << 9;
static constexpr int32 CHANNEL_FLAG_ANYONE_CAN_INVITE = 1 << 10;
// static constexpr int32 CHANNEL_FLAG_ANYONE_CAN_INVITE = 1 << 10;
static constexpr int32 CHANNEL_FLAG_SIGN_MESSAGES = 1 << 11;
static constexpr int32 CHANNEL_FLAG_IS_MIN = 1 << 12;
static constexpr int32 CHANNEL_FLAG_HAS_ACCESS_HASH = 1 << 13;

View File

@ -33,13 +33,13 @@ DialogParticipantStatus DialogParticipantStatus::Administrator(bool can_be_edite
bool can_restrict_members, bool can_pin_messages,
bool can_promote_members) {
uint32 flags = (static_cast<uint32>(can_be_edited) * CAN_BE_EDITED) |
(static_cast<uint32>(can_change_info) * CAN_CHANGE_INFO_AND_SETTINGS) |
(static_cast<uint32>(can_change_info) * CAN_CHANGE_INFO_AND_SETTINGS_ADMIN) |
(static_cast<uint32>(can_post_messages) * CAN_POST_MESSAGES) |
(static_cast<uint32>(can_edit_messages) * CAN_EDIT_MESSAGES) |
(static_cast<uint32>(can_delete_messages) * CAN_DELETE_MESSAGES) |
(static_cast<uint32>(can_invite_users) * CAN_INVITE_USERS) |
(static_cast<uint32>(can_invite_users) * CAN_INVITE_USERS_ADMIN) |
(static_cast<uint32>(can_restrict_members) * CAN_RESTRICT_MEMBERS) |
(static_cast<uint32>(can_pin_messages) * CAN_PIN_MESSAGES) |
(static_cast<uint32>(can_pin_messages) * CAN_PIN_MESSAGES_ADMIN) |
(static_cast<uint32>(can_promote_members) * CAN_PROMOTE_MEMBERS);
if (flags == 0 || flags == CAN_BE_EDITED) {
return Member();
@ -51,11 +51,10 @@ DialogParticipantStatus DialogParticipantStatus::Member() {
return DialogParticipantStatus(Type::Member, IS_MEMBER | ALL_RESTRICTED_RIGHTS, 0);
}
DialogParticipantStatus DialogParticipantStatus::Restricted(bool is_member, int32 restricted_until_date,
bool can_send_messages, bool can_send_media,
bool can_send_stickers, bool can_send_animations,
bool can_send_games, bool can_use_inline_bots,
bool can_add_web_page_previews) {
DialogParticipantStatus DialogParticipantStatus::Restricted(
bool is_member, int32 restricted_until_date, bool can_send_messages, bool can_send_media, bool can_send_stickers,
bool can_send_animations, bool can_send_games, bool can_use_inline_bots, bool can_add_web_page_previews,
bool can_send_polls, bool can_change_info_and_settings, bool can_invite_users, bool can_pin_messages) {
uint32 flags = (static_cast<uint32>(can_send_messages) * CAN_SEND_MESSAGES) |
(static_cast<uint32>(can_send_media) * CAN_SEND_MEDIA) |
(static_cast<uint32>(can_send_stickers) * CAN_SEND_STICKERS) |
@ -63,6 +62,10 @@ DialogParticipantStatus DialogParticipantStatus::Restricted(bool is_member, int3
(static_cast<uint32>(can_send_games) * CAN_SEND_GAMES) |
(static_cast<uint32>(can_use_inline_bots) * CAN_USE_INLINE_BOTS) |
(static_cast<uint32>(can_add_web_page_previews) * CAN_ADD_WEB_PAGE_PREVIEWS) |
(static_cast<uint32>(can_send_polls) * CAN_SEND_POLLS) |
(static_cast<uint32>(can_change_info_and_settings) * CAN_CHANGE_INFO_AND_SETTINGS_BANNED) |
(static_cast<uint32>(can_invite_users) * CAN_INVITE_USERS_BANNED) |
(static_cast<uint32>(can_pin_messages) * CAN_PIN_MESSAGES_BANNED) |
(static_cast<uint32>(is_member) * IS_MEMBER);
if (flags == (IS_MEMBER | ALL_RESTRICTED_RIGHTS)) {
return Member();
@ -102,9 +105,9 @@ tl_object_ptr<td_api::ChatMemberStatus> DialogParticipantStatus::get_chat_member
return make_tl_object<td_api::chatMemberStatusMember>();
case Type::Restricted:
return make_tl_object<td_api::chatMemberStatusRestricted>(
is_member(), until_date_, can_send_messages(), can_send_media(),
is_member(), until_date_, can_send_messages(), can_send_media(), can_send_polls(),
can_send_stickers() && can_send_animations() && can_send_games() && can_use_inline_bots(),
can_add_web_page_previews());
can_add_web_page_previews(), can_change_info_and_settings(), can_invite_users(), can_pin_messages());
case Type::Left:
return make_tl_object<td_api::chatMemberStatusLeft>();
case Type::Banned:
@ -115,71 +118,83 @@ tl_object_ptr<td_api::ChatMemberStatus> DialogParticipantStatus::get_chat_member
}
}
tl_object_ptr<telegram_api::channelAdminRights> DialogParticipantStatus::get_channel_admin_rights() const {
tl_object_ptr<telegram_api::chatAdminRights> DialogParticipantStatus::get_chat_admin_rights() const {
int32 flags = 0;
if (can_change_info_and_settings()) {
flags |= telegram_api::channelAdminRights::CHANGE_INFO_MASK;
flags |= telegram_api::chatAdminRights::CHANGE_INFO_MASK;
}
if (can_post_messages()) {
flags |= telegram_api::channelAdminRights::POST_MESSAGES_MASK;
flags |= telegram_api::chatAdminRights::POST_MESSAGES_MASK;
}
if (can_edit_messages()) {
flags |= telegram_api::channelAdminRights::EDIT_MESSAGES_MASK;
flags |= telegram_api::chatAdminRights::EDIT_MESSAGES_MASK;
}
if (can_delete_messages()) {
flags |= telegram_api::channelAdminRights::DELETE_MESSAGES_MASK;
flags |= telegram_api::chatAdminRights::DELETE_MESSAGES_MASK;
}
if (can_invite_users()) {
flags |= telegram_api::channelAdminRights::INVITE_USERS_MASK;
flags |= telegram_api::channelAdminRights::INVITE_LINK_MASK;
flags |= telegram_api::chatAdminRights::INVITE_USERS_MASK;
}
if (can_restrict_members()) {
flags |= telegram_api::channelAdminRights::BAN_USERS_MASK;
flags |= telegram_api::chatAdminRights::BAN_USERS_MASK;
}
if (can_pin_messages()) {
flags |= telegram_api::channelAdminRights::PIN_MESSAGES_MASK;
flags |= telegram_api::chatAdminRights::PIN_MESSAGES_MASK;
}
if (can_promote_members()) {
flags |= telegram_api::channelAdminRights::ADD_ADMINS_MASK;
flags |= telegram_api::chatAdminRights::ADD_ADMINS_MASK;
}
LOG(INFO) << "Create channel admin rights " << flags;
return make_tl_object<telegram_api::channelAdminRights>(
flags, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/,
false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/);
return make_tl_object<telegram_api::chatAdminRights>(flags, false /*ignored*/, false /*ignored*/, false /*ignored*/,
false /*ignored*/, false /*ignored*/, false /*ignored*/,
false /*ignored*/, false /*ignored*/);
}
tl_object_ptr<telegram_api::channelBannedRights> DialogParticipantStatus::get_channel_banned_rights() const {
tl_object_ptr<telegram_api::chatBannedRights> DialogParticipantStatus::get_chat_banned_rights() const {
int32 flags = 0;
if (type_ == Type::Banned) {
flags |= telegram_api::channelBannedRights::VIEW_MESSAGES_MASK;
flags |= telegram_api::chatBannedRights::VIEW_MESSAGES_MASK;
}
if (!can_send_messages()) {
flags |= telegram_api::channelBannedRights::SEND_MESSAGES_MASK;
flags |= telegram_api::chatBannedRights::SEND_MESSAGES_MASK;
}
if (!can_send_media()) {
flags |= telegram_api::channelBannedRights::SEND_MEDIA_MASK;
flags |= telegram_api::chatBannedRights::SEND_MEDIA_MASK;
}
if (!can_send_stickers()) {
flags |= telegram_api::channelBannedRights::SEND_STICKERS_MASK;
flags |= telegram_api::chatBannedRights::SEND_STICKERS_MASK;
}
if (!can_send_animations()) {
flags |= telegram_api::channelBannedRights::SEND_GIFS_MASK;
flags |= telegram_api::chatBannedRights::SEND_GIFS_MASK;
}
if (!can_send_games()) {
flags |= telegram_api::channelBannedRights::SEND_GAMES_MASK;
flags |= telegram_api::chatBannedRights::SEND_GAMES_MASK;
}
if (!can_use_inline_bots()) {
flags |= telegram_api::channelBannedRights::SEND_INLINE_MASK;
flags |= telegram_api::chatBannedRights::SEND_INLINE_MASK;
}
if (!can_add_web_page_previews()) {
flags |= telegram_api::channelBannedRights::EMBED_LINKS_MASK;
flags |= telegram_api::chatBannedRights::EMBED_LINKS_MASK;
}
if (!can_send_polls()) {
flags |= telegram_api::chatBannedRights::SEND_POLLS_MASK;
}
if (!can_change_info_and_settings()) {
flags |= telegram_api::chatBannedRights::CHANGE_INFO_MASK;
}
if (!can_invite_users()) {
flags |= telegram_api::chatBannedRights::INVITE_USERS_MASK;
}
if (!can_pin_messages()) {
flags |= telegram_api::chatBannedRights::PIN_MESSAGES_MASK;
}
LOG(INFO) << "Create channel banned rights " << flags << " until " << until_date_;
return make_tl_object<telegram_api::channelBannedRights>(
return make_tl_object<telegram_api::chatBannedRights>(
flags, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/,
false /*ignored*/, false /*ignored*/, false /*ignored*/, until_date_);
false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/,
false /*ignored*/, until_date_);
}
void DialogParticipantStatus::update_restrictions() const {
@ -271,12 +286,24 @@ StringBuilder &operator<<(StringBuilder &string_builder, const DialogParticipant
if (!status.can_send_games()) {
string_builder << "(games)";
}
if (!status.can_send_polls()) {
string_builder << "(polls)";
}
if (!status.can_use_inline_bots()) {
string_builder << "(inline bots)";
}
if (!status.can_add_web_page_previews()) {
string_builder << "(links)";
}
if (!status.can_change_info_and_settings()) {
string_builder << "(change)";
}
if (!status.can_invite_users()) {
string_builder << "(invite)";
}
if (!status.can_pin_messages()) {
string_builder << "(pin)";
}
return string_builder;
case DialogParticipantStatus::Type::Left:
return string_builder << "Left";
@ -317,7 +344,8 @@ DialogParticipantStatus get_dialog_participant_status(const tl_object_ptr<td_api
return DialogParticipantStatus::Restricted(
st->is_member_, st->restricted_until_date_, st->can_send_messages_ || can_send_media, can_send_media,
st->can_send_other_messages_, st->can_send_other_messages_, st->can_send_other_messages_,
st->can_send_other_messages_, st->can_add_web_page_previews_);
st->can_send_other_messages_, st->can_add_web_page_previews_, st->can_send_polls_, st->can_change_info_,
st->can_invite_users_, st->can_pin_messages_);
}
case td_api::chatMemberStatusLeft::ID:
return DialogParticipantStatus::Left();
@ -332,36 +360,41 @@ DialogParticipantStatus get_dialog_participant_status(const tl_object_ptr<td_api
}
DialogParticipantStatus get_dialog_participant_status(
bool can_be_edited, const tl_object_ptr<telegram_api::channelAdminRights> &admin_rights) {
bool can_change_info = (admin_rights->flags_ & telegram_api::channelAdminRights::CHANGE_INFO_MASK) != 0;
bool can_post_messages = (admin_rights->flags_ & telegram_api::channelAdminRights::POST_MESSAGES_MASK) != 0;
bool can_edit_messages = (admin_rights->flags_ & telegram_api::channelAdminRights::EDIT_MESSAGES_MASK) != 0;
bool can_delete_messages = (admin_rights->flags_ & telegram_api::channelAdminRights::DELETE_MESSAGES_MASK) != 0;
bool can_invite_users = (admin_rights->flags_ & telegram_api::channelAdminRights::INVITE_USERS_MASK) != 0;
bool can_restrict_members = (admin_rights->flags_ & telegram_api::channelAdminRights::BAN_USERS_MASK) != 0;
bool can_pin_messages = (admin_rights->flags_ & telegram_api::channelAdminRights::PIN_MESSAGES_MASK) != 0;
bool can_promote_members = (admin_rights->flags_ & telegram_api::channelAdminRights::ADD_ADMINS_MASK) != 0;
bool can_be_edited, const tl_object_ptr<telegram_api::chatAdminRights> &admin_rights) {
bool can_change_info = (admin_rights->flags_ & telegram_api::chatAdminRights::CHANGE_INFO_MASK) != 0;
bool can_post_messages = (admin_rights->flags_ & telegram_api::chatAdminRights::POST_MESSAGES_MASK) != 0;
bool can_edit_messages = (admin_rights->flags_ & telegram_api::chatAdminRights::EDIT_MESSAGES_MASK) != 0;
bool can_delete_messages = (admin_rights->flags_ & telegram_api::chatAdminRights::DELETE_MESSAGES_MASK) != 0;
bool can_invite_users = (admin_rights->flags_ & telegram_api::chatAdminRights::INVITE_USERS_MASK) != 0;
bool can_restrict_members = (admin_rights->flags_ & telegram_api::chatAdminRights::BAN_USERS_MASK) != 0;
bool can_pin_messages = (admin_rights->flags_ & telegram_api::chatAdminRights::PIN_MESSAGES_MASK) != 0;
bool can_promote_members = (admin_rights->flags_ & telegram_api::chatAdminRights::ADD_ADMINS_MASK) != 0;
return DialogParticipantStatus::Administrator(can_be_edited, can_change_info, can_post_messages, can_edit_messages,
can_delete_messages, can_invite_users, can_restrict_members,
can_pin_messages, can_promote_members);
}
DialogParticipantStatus get_dialog_participant_status(
bool is_member, const tl_object_ptr<telegram_api::channelBannedRights> &banned_rights) {
bool can_view_messages = (banned_rights->flags_ & telegram_api::channelBannedRights::VIEW_MESSAGES_MASK) == 0;
bool is_member, const tl_object_ptr<telegram_api::chatBannedRights> &banned_rights) {
bool can_view_messages = (banned_rights->flags_ & telegram_api::chatBannedRights::VIEW_MESSAGES_MASK) == 0;
if (!can_view_messages) {
return DialogParticipantStatus::Banned(banned_rights->until_date_);
}
bool can_send_messages = (banned_rights->flags_ & telegram_api::channelBannedRights::SEND_MESSAGES_MASK) == 0;
bool can_send_media_messages = (banned_rights->flags_ & telegram_api::channelBannedRights::SEND_MEDIA_MASK) == 0;
bool can_send_stickers = (banned_rights->flags_ & telegram_api::channelBannedRights::SEND_STICKERS_MASK) == 0;
bool can_send_animations = (banned_rights->flags_ & telegram_api::channelBannedRights::SEND_GIFS_MASK) == 0;
bool can_send_games = (banned_rights->flags_ & telegram_api::channelBannedRights::SEND_GAMES_MASK) == 0;
bool can_use_inline_bots = (banned_rights->flags_ & telegram_api::channelBannedRights::SEND_INLINE_MASK) == 0;
bool can_add_web_page_previews = (banned_rights->flags_ & telegram_api::channelBannedRights::EMBED_LINKS_MASK) == 0;
return DialogParticipantStatus::Restricted(is_member, banned_rights->until_date_, can_send_messages,
can_send_media_messages, can_send_stickers, can_send_animations,
can_send_games, can_use_inline_bots, can_add_web_page_previews);
bool can_send_messages = (banned_rights->flags_ & telegram_api::chatBannedRights::SEND_MESSAGES_MASK) == 0;
bool can_send_media_messages = (banned_rights->flags_ & telegram_api::chatBannedRights::SEND_MEDIA_MASK) == 0;
bool can_send_stickers = (banned_rights->flags_ & telegram_api::chatBannedRights::SEND_STICKERS_MASK) == 0;
bool can_send_animations = (banned_rights->flags_ & telegram_api::chatBannedRights::SEND_GIFS_MASK) == 0;
bool can_send_games = (banned_rights->flags_ & telegram_api::chatBannedRights::SEND_GAMES_MASK) == 0;
bool can_use_inline_bots = (banned_rights->flags_ & telegram_api::chatBannedRights::SEND_INLINE_MASK) == 0;
bool can_add_web_page_previews = (banned_rights->flags_ & telegram_api::chatBannedRights::EMBED_LINKS_MASK) == 0;
bool can_send_polls = (banned_rights->flags_ & telegram_api::chatBannedRights::SEND_POLLS_MASK) == 0;
bool can_change_info_and_settings = (banned_rights->flags_ & telegram_api::chatBannedRights::CHANGE_INFO_MASK) == 0;
bool can_invite_users = (banned_rights->flags_ & telegram_api::chatBannedRights::INVITE_USERS_MASK) == 0;
bool can_pin_messages = (banned_rights->flags_ & telegram_api::chatBannedRights::PIN_MESSAGES_MASK) == 0;
return DialogParticipantStatus::Restricted(
is_member, banned_rights->until_date_, can_send_messages, can_send_media_messages, can_send_stickers,
can_send_animations, can_send_games, can_use_inline_bots, can_add_web_page_previews, can_send_polls,
can_change_info_and_settings, can_invite_users, can_pin_messages);
}
StringBuilder &operator<<(StringBuilder &string_builder, const DialogParticipant &dialog_participant) {

View File

@ -18,14 +18,14 @@
namespace td {
class DialogParticipantStatus {
static constexpr uint32 CAN_CHANGE_INFO_AND_SETTINGS = 1 << 0;
static constexpr uint32 CAN_CHANGE_INFO_AND_SETTINGS_ADMIN = 1 << 0;
static constexpr uint32 CAN_POST_MESSAGES = 1 << 1;
static constexpr uint32 CAN_EDIT_MESSAGES = 1 << 2;
static constexpr uint32 CAN_DELETE_MESSAGES = 1 << 3;
static constexpr uint32 CAN_INVITE_USERS = 1 << 4;
static constexpr uint32 CAN_INVITE_USERS_ADMIN = 1 << 4;
// static constexpr uint32 CAN_EXPORT_DIALOG_INVITE_LINK = 1 << 5;
static constexpr uint32 CAN_RESTRICT_MEMBERS = 1 << 6;
static constexpr uint32 CAN_PIN_MESSAGES = 1 << 7;
static constexpr uint32 CAN_PIN_MESSAGES_ADMIN = 1 << 7;
static constexpr uint32 CAN_PROMOTE_MEMBERS = 1 << 8;
static constexpr uint32 CAN_BE_EDITED = 1 << 15;
@ -37,6 +37,10 @@ class DialogParticipantStatus {
static constexpr uint32 CAN_SEND_GAMES = 1 << 20;
static constexpr uint32 CAN_USE_INLINE_BOTS = 1 << 21;
static constexpr uint32 CAN_ADD_WEB_PAGE_PREVIEWS = 1 << 22;
static constexpr uint32 CAN_SEND_POLLS = 1 << 23;
static constexpr uint32 CAN_CHANGE_INFO_AND_SETTINGS_BANNED = 1 << 24;
static constexpr uint32 CAN_INVITE_USERS_BANNED = 1 << 25;
static constexpr uint32 CAN_PIN_MESSAGES_BANNED = 1 << 26;
static constexpr uint32 IS_MEMBER = 1 << 27;
@ -44,13 +48,14 @@ class DialogParticipantStatus {
static constexpr int TYPE_SHIFT = 28;
static constexpr uint32 HAS_UNTIL_DATE = 1u << 31;
static constexpr uint32 ALL_ADMINISTRATOR_RIGHTS = CAN_CHANGE_INFO_AND_SETTINGS | CAN_POST_MESSAGES |
CAN_EDIT_MESSAGES | CAN_DELETE_MESSAGES | CAN_INVITE_USERS |
CAN_RESTRICT_MEMBERS | CAN_PIN_MESSAGES | CAN_PROMOTE_MEMBERS;
static constexpr uint32 ALL_ADMINISTRATOR_RIGHTS =
CAN_CHANGE_INFO_AND_SETTINGS_ADMIN | CAN_POST_MESSAGES | CAN_EDIT_MESSAGES | CAN_DELETE_MESSAGES |
CAN_INVITE_USERS_ADMIN | CAN_RESTRICT_MEMBERS | CAN_PIN_MESSAGES_ADMIN | CAN_PROMOTE_MEMBERS;
static constexpr uint32 ALL_RESTRICTED_RIGHTS = CAN_SEND_MESSAGES | CAN_SEND_MEDIA | CAN_SEND_STICKERS |
CAN_SEND_ANIMATIONS | CAN_SEND_GAMES | CAN_USE_INLINE_BOTS |
CAN_ADD_WEB_PAGE_PREVIEWS;
static constexpr uint32 ALL_RESTRICTED_RIGHTS =
CAN_SEND_MESSAGES | CAN_SEND_MEDIA | CAN_SEND_STICKERS | CAN_SEND_ANIMATIONS | CAN_SEND_GAMES |
CAN_USE_INLINE_BOTS | CAN_ADD_WEB_PAGE_PREVIEWS | CAN_SEND_POLLS | CAN_CHANGE_INFO_AND_SETTINGS_BANNED |
CAN_INVITE_USERS_BANNED | CAN_PIN_MESSAGES_BANNED;
enum class Type : int32 { Creator, Administrator, Member, Restricted, Left, Banned };
// all fields are logically const, but should be updated in update_restrictions()
@ -77,7 +82,9 @@ class DialogParticipantStatus {
static DialogParticipantStatus Restricted(bool is_member, int32 restricted_until_date, bool can_send_messages,
bool can_send_media, bool can_send_stickers, bool can_send_animations,
bool can_send_games, bool can_use_inline_bots,
bool can_add_web_page_previews);
bool can_add_web_page_previews, bool can_send_polls,
bool can_change_info_and_settings, bool can_invite_users,
bool can_pin_messages);
static DialogParticipantStatus Left();
@ -91,15 +98,15 @@ class DialogParticipantStatus {
tl_object_ptr<td_api::ChatMemberStatus> get_chat_member_status_object() const;
tl_object_ptr<telegram_api::channelAdminRights> get_channel_admin_rights() const;
tl_object_ptr<telegram_api::chatAdminRights> get_chat_admin_rights() const;
tl_object_ptr<telegram_api::channelBannedRights> get_channel_banned_rights() const;
tl_object_ptr<telegram_api::chatBannedRights> get_chat_banned_rights() const;
// unrestricts user if restriction time expired. Should be called before all privileges checks
void update_restrictions() const;
bool can_change_info_and_settings() const {
return (flags_ & CAN_CHANGE_INFO_AND_SETTINGS) != 0;
return (flags_ & CAN_CHANGE_INFO_AND_SETTINGS_ADMIN) != 0 || (flags_ & CAN_CHANGE_INFO_AND_SETTINGS_BANNED) != 0;
}
bool can_post_messages() const {
@ -115,7 +122,7 @@ class DialogParticipantStatus {
}
bool can_invite_users() const {
return (flags_ & CAN_INVITE_USERS) != 0;
return (flags_ & CAN_INVITE_USERS_ADMIN) != 0 || (flags_ & CAN_INVITE_USERS_BANNED) != 0;
}
bool can_restrict_members() const {
@ -123,7 +130,7 @@ class DialogParticipantStatus {
}
bool can_pin_messages() const {
return (flags_ & CAN_PIN_MESSAGES) != 0;
return (flags_ & CAN_PIN_MESSAGES_ADMIN) != 0 || (flags_ & CAN_PIN_MESSAGES_BANNED) != 0;
}
bool can_promote_members() const {
@ -162,6 +169,10 @@ class DialogParticipantStatus {
return (flags_ & CAN_ADD_WEB_PAGE_PREVIEWS) != 0;
}
bool can_send_polls() const {
return (flags_ & CAN_SEND_POLLS) != 0;
}
void set_is_member(bool is_member) {
if (is_member) {
flags_ |= IS_MEMBER;
@ -288,10 +299,10 @@ DialogParticipantsFilter get_dialog_participants_filter(const tl_object_ptr<td_a
DialogParticipantStatus get_dialog_participant_status(const tl_object_ptr<td_api::ChatMemberStatus> &status);
DialogParticipantStatus get_dialog_participant_status(
bool can_be_edited, const tl_object_ptr<telegram_api::channelAdminRights> &admin_rights);
DialogParticipantStatus get_dialog_participant_status(bool can_be_edited,
const tl_object_ptr<telegram_api::chatAdminRights> &admin_rights);
DialogParticipantStatus get_dialog_participant_status(
bool is_member, const tl_object_ptr<telegram_api::channelBannedRights> &banned_rights);
bool is_member, const tl_object_ptr<telegram_api::chatBannedRights> &banned_rights);
} // namespace td

View File

@ -211,14 +211,16 @@ Document DocumentsManager::on_get_document(RemoteDocument remote_document, Dialo
file_reference = document->file_reference_.as_slice().str();
if (document_type != Document::Type::VoiceNote) {
for (auto &thumb : document->thumbs_) {
auto photo_size = get_photo_size(td_->file_manager_.get(), FileType::Thumbnail, 0, 0, "", owner_dialog_id,
std::move(document->thumb_), has_webp_thumbnail);
std::move(thumb), has_webp_thumbnail);
if (photo_size.get_offset() == 0) {
thumbnail = std::move(photo_size.get<0>());
} else {
minithumbnail = std::move(photo_size.get<1>());
}
}
}
} else if (remote_document.secret_file != nullptr) {
CHECK(remote_document.secret_document != nullptr);
auto file = std::move(remote_document.secret_file);

View File

@ -3485,9 +3485,11 @@ static auto secret_to_telegram_document(secret_api::decryptedMessageMediaExterna
if (!clean_input_string(from.mime_type_)) {
from.mime_type_.clear();
}
return make_tl_object<telegram_api::document>(from.id_, from.access_hash_, BufferSlice(), from.date_, from.mime_type_,
from.size_, secret_to_telegram<telegram_api::PhotoSize>(*from.thumb_),
from.dc_id_, secret_to_telegram(from.attributes_));
vector<telegram_api::object_ptr<telegram_api::PhotoSize>> thumbnails;
thumbnails.push_back(secret_to_telegram<telegram_api::PhotoSize>(*from.thumb_));
return make_tl_object<telegram_api::document>(
telegram_api::document::THUMBS_MASK, from.id_, from.access_hash_, BufferSlice(), from.date_, from.mime_type_,
from.size_, std::move(thumbnails), from.dc_id_, secret_to_telegram(from.attributes_));
}
template <class ToT, class FromT>

View File

@ -39,6 +39,19 @@ Result<telegram_api::auth_resendCode> SendCodeHelper::resend_code() {
return telegram_api::auth_resendCode(phone_number_, phone_code_hash_);
}
telegram_api::object_ptr<telegram_api::codeSettings> SendCodeHelper::get_input_code_settings(
bool allow_flash_call, bool is_current_phone_number) {
int32 flags = 0;
if (allow_flash_call) {
flags |= telegram_api::codeSettings::ALLOW_FLASHCALL_MASK;
}
if (is_current_phone_number) {
flags |= telegram_api::codeSettings::CURRENT_NUMBER_MASK;
}
return telegram_api::make_object<telegram_api::codeSettings>(flags, false /*ignored*/, false /*ignored*/,
false /*ignored*/, string());
}
Result<telegram_api::auth_sendCode> SendCodeHelper::send_code(Slice phone_number, bool allow_flash_call,
bool is_current_phone_number, int32 api_id,
const string &api_hash) {
@ -46,23 +59,16 @@ Result<telegram_api::auth_sendCode> SendCodeHelper::send_code(Slice phone_number
return Status::Error(8, "Can't change phone");
}
phone_number_ = phone_number.str();
int32 flags = 0;
if (allow_flash_call) {
flags |= AUTH_SEND_CODE_FLAG_ALLOW_FLASH_CALL;
}
return telegram_api::auth_sendCode(flags, false /*ignored*/, phone_number_, is_current_phone_number, api_id,
api_hash);
return telegram_api::auth_sendCode(phone_number_, api_id, api_hash,
get_input_code_settings(allow_flash_call, is_current_phone_number));
}
Result<telegram_api::account_sendChangePhoneCode> SendCodeHelper::send_change_phone_code(Slice phone_number,
bool allow_flash_call,
bool is_current_phone_number) {
phone_number_ = phone_number.str();
int32 flags = 0;
if (allow_flash_call) {
flags |= AUTH_SEND_CODE_FLAG_ALLOW_FLASH_CALL;
}
return telegram_api::account_sendChangePhoneCode(flags, false /*ignored*/, phone_number_, is_current_phone_number);
return telegram_api::account_sendChangePhoneCode(phone_number_,
get_input_code_settings(allow_flash_call, is_current_phone_number));
}
Result<telegram_api::account_sendVerifyPhoneCode> SendCodeHelper::send_verify_phone_code(const string &hash,
@ -70,21 +76,15 @@ Result<telegram_api::account_sendVerifyPhoneCode> SendCodeHelper::send_verify_ph
bool allow_flash_call,
bool is_current_phone_number) {
phone_number_ = phone_number.str();
int32 flags = 0;
if (allow_flash_call) {
flags |= AUTH_SEND_CODE_FLAG_ALLOW_FLASH_CALL;
}
return telegram_api::account_sendVerifyPhoneCode(flags, false /*ignored*/, hash, is_current_phone_number);
return telegram_api::account_sendVerifyPhoneCode(hash,
get_input_code_settings(allow_flash_call, is_current_phone_number));
}
Result<telegram_api::account_sendConfirmPhoneCode> SendCodeHelper::send_confirm_phone_code(
Slice phone_number, bool allow_flash_call, bool is_current_phone_number) {
phone_number_ = phone_number.str();
int32 flags = 0;
if (allow_flash_call) {
flags |= AUTH_SEND_CODE_FLAG_ALLOW_FLASH_CALL;
}
return telegram_api::account_sendConfirmPhoneCode(flags, false /*ignored*/, phone_number_, is_current_phone_number);
return telegram_api::account_sendConfirmPhoneCode(phone_number_,
get_input_code_settings(allow_flash_call, is_current_phone_number));
}
SendCodeHelper::AuthenticationCodeInfo SendCodeHelper::get_authentication_code_info(
@ -132,19 +132,19 @@ SendCodeHelper::AuthenticationCodeInfo SendCodeHelper::get_authentication_code_i
}
}
tl_object_ptr<td_api::AuthenticationCodeType> SendCodeHelper::get_authentication_code_type_object(
td_api::object_ptr<td_api::AuthenticationCodeType> SendCodeHelper::get_authentication_code_type_object(
const AuthenticationCodeInfo &authentication_code_info) {
switch (authentication_code_info.type) {
case AuthenticationCodeInfo::Type::None:
return nullptr;
case AuthenticationCodeInfo::Type::Message:
return make_tl_object<td_api::authenticationCodeTypeTelegramMessage>(authentication_code_info.length);
return td_api::make_object<td_api::authenticationCodeTypeTelegramMessage>(authentication_code_info.length);
case AuthenticationCodeInfo::Type::Sms:
return make_tl_object<td_api::authenticationCodeTypeSms>(authentication_code_info.length);
return td_api::make_object<td_api::authenticationCodeTypeSms>(authentication_code_info.length);
case AuthenticationCodeInfo::Type::Call:
return make_tl_object<td_api::authenticationCodeTypeCall>(authentication_code_info.length);
return td_api::make_object<td_api::authenticationCodeTypeCall>(authentication_code_info.length);
case AuthenticationCodeInfo::Type::FlashCall:
return make_tl_object<td_api::authenticationCodeTypeFlashCall>(authentication_code_info.pattern);
return td_api::make_object<td_api::authenticationCodeTypeFlashCall>(authentication_code_info.pattern);
default:
UNREACHABLE();
return nullptr;

View File

@ -54,8 +54,6 @@ class SendCodeHelper {
void parse(ParserT &parser);
private:
static constexpr int32 AUTH_SEND_CODE_FLAG_ALLOW_FLASH_CALL = 1 << 0;
static constexpr int32 SENT_CODE_FLAG_IS_USER_REGISTERED = 1 << 0;
static constexpr int32 SENT_CODE_FLAG_HAS_NEXT_TYPE = 1 << 1;
static constexpr int32 SENT_CODE_FLAG_HAS_TIMEOUT = 1 << 2;
@ -90,8 +88,11 @@ class SendCodeHelper {
static AuthenticationCodeInfo get_authentication_code_info(
tl_object_ptr<telegram_api::auth_SentCodeType> &&sent_code_type_ptr);
static tl_object_ptr<td_api::AuthenticationCodeType> get_authentication_code_type_object(
static td_api::object_ptr<td_api::AuthenticationCodeType> get_authentication_code_type_object(
const AuthenticationCodeInfo &authentication_code_info);
static telegram_api::object_ptr<telegram_api::codeSettings> get_input_code_settings(bool allow_flash_call,
bool is_current_phone_number);
};
} // namespace td

View File

@ -1165,14 +1165,17 @@ std::pair<int64, FileId> StickersManager::on_get_sticker_document(tl_object_ptr<
document->file_reference_.as_slice().str()),
FileLocationSource::FromServer, DialogId(), document->size_, 0, PSTRING() << document_id << ".webp");
auto photo_size = get_photo_size(td_->file_manager_.get(), FileType::Thumbnail, 0, 0, "", DialogId(),
std::move(document->thumb_), has_webp_thumbnail(sticker));
PhotoSize thumbnail;
for (auto &thumb : document->thumbs_) {
auto photo_size = get_photo_size(td_->file_manager_.get(), FileType::Thumbnail, 0, 0, "", DialogId(),
std::move(thumb), has_webp_thumbnail(sticker));
if (photo_size.get_offset() == 0) {
thumbnail = std::move(photo_size.get<0>());
break;
} else {
LOG(ERROR) << "Receive minithumbnail for a sticker";
}
}
create_sticker(sticker_id, std::move(thumbnail), dimensions, from_message, std::move(sticker), nullptr);
return {document_id, sticker_id};

View File

@ -6042,13 +6042,6 @@ void Td::on_request(uint64 id, const td_api::getUserProfilePhotos &request) {
CREATE_REQUEST(GetUserProfilePhotosRequest, request.user_id_, request.offset_, request.limit_);
}
void Td::on_request(uint64 id, const td_api::toggleBasicGroupAdministrators &request) {
CHECK_IS_USER();
CREATE_OK_REQUEST_PROMISE();
contacts_manager_->toggle_chat_administrators(ChatId(request.basic_group_id_), request.everyone_is_administrator_,
std::move(promise));
}
void Td::on_request(uint64 id, td_api::setSupergroupUsername &request) {
CHECK_IS_USER();
CLEAN_INPUT_STRING(request.username_);
@ -6062,13 +6055,6 @@ void Td::on_request(uint64 id, const td_api::setSupergroupStickerSet &request) {
std::move(promise));
}
void Td::on_request(uint64 id, const td_api::toggleSupergroupInvites &request) {
CHECK_IS_USER();
CREATE_OK_REQUEST_PROMISE();
contacts_manager_->toggle_channel_invites(ChannelId(request.supergroup_id_), request.anyone_can_invite_,
std::move(promise));
}
void Td::on_request(uint64 id, const td_api::toggleSupergroupSignMessages &request) {
CHECK_IS_USER();
CREATE_OK_REQUEST_PROMISE();

View File

@ -734,14 +734,10 @@ class Td final : public NetQueryCallback {
void on_request(uint64 id, const td_api::getUserProfilePhotos &request);
void on_request(uint64 id, const td_api::toggleBasicGroupAdministrators &request);
void on_request(uint64 id, td_api::setSupergroupUsername &request);
void on_request(uint64 id, const td_api::setSupergroupStickerSet &request);
void on_request(uint64 id, const td_api::toggleSupergroupInvites &request);
void on_request(uint64 id, const td_api::toggleSupergroupSignMessages &request);
void on_request(uint64 id, const td_api::toggleSupergroupIsAllHistoryAvailable &request);

View File

@ -1678,11 +1678,6 @@ void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateChatParticipant
update->version_);
}
void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateChatAdmins> update, bool /*force_apply*/) {
td_->contacts_manager_->on_update_chat_everyone_is_administrator(ChatId(update->chat_id_), !update->enabled_,
update->version_);
}
void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateDraftMessage> update, bool /*force_apply*/) {
td_->messages_manager_->on_update_dialog_draft_message(DialogId(update->peer_), std::move(update->draft_));
}
@ -1844,4 +1839,8 @@ void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateMessagePoll> up
// unsupported updates
void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateChatDefaultBannedRights> update,
bool /*force_apply*/) {
}
} // namespace td

View File

@ -195,7 +195,6 @@ class UpdatesManager : public Actor {
void on_update(tl_object_ptr<telegram_api::updateChatParticipantAdd> update, bool /*force_apply*/);
void on_update(tl_object_ptr<telegram_api::updateChatParticipantAdmin> update, bool /*force_apply*/);
void on_update(tl_object_ptr<telegram_api::updateChatParticipantDelete> update, bool /*force_apply*/);
void on_update(tl_object_ptr<telegram_api::updateChatAdmins> update, bool /*force_apply*/);
void on_update(tl_object_ptr<telegram_api::updateServiceNotification> update, bool force_apply);
@ -264,6 +263,7 @@ class UpdatesManager : public Actor {
void on_update(tl_object_ptr<telegram_api::updateMessagePoll> update, bool /*force_apply*/);
// unsupported updates
void on_update(tl_object_ptr<telegram_api::updateChatDefaultBannedRights> update, bool /*force_apply*/);
};
} // namespace td

View File

@ -24,15 +24,15 @@
namespace td {
class GetWallpapersQuery : public Td::ResultHandler {
Promise<vector<telegram_api::object_ptr<telegram_api::WallPaper>>> promise_;
Promise<vector<telegram_api::object_ptr<telegram_api::wallPaper>>> promise_;
public:
explicit GetWallpapersQuery(Promise<vector<telegram_api::object_ptr<telegram_api::WallPaper>>> &&promise)
explicit GetWallpapersQuery(Promise<vector<telegram_api::object_ptr<telegram_api::wallPaper>>> &&promise)
: promise_(std::move(promise)) {
}
void send() {
send_query(G()->net_query_creator().create(create_storer(telegram_api::account_getWallPapers())));
send_query(G()->net_query_creator().create(create_storer(telegram_api::account_getWallPapers(0))));
}
void on_result(uint64 id, BufferSlice packet) override {
@ -41,7 +41,8 @@ class GetWallpapersQuery : public Td::ResultHandler {
return on_error(id, result_ptr.move_as_error());
}
promise_.set_value(result_ptr.move_as_ok());
// TODO
promise_.set_value(vector<telegram_api::object_ptr<telegram_api::wallPaper>>());
}
void on_error(uint64 id, Status status) override {
@ -68,7 +69,7 @@ void WallpaperManager::reload_wallpapers(Promise<Unit> &&promise) {
pending_get_wallpapers_queries_.push_back(std::move(promise));
if (pending_get_wallpapers_queries_.size() == 1) {
auto request_promise = PromiseCreator::lambda(
[actor_id = actor_id(this)](Result<vector<telegram_api::object_ptr<telegram_api::WallPaper>>> result) {
[actor_id = actor_id(this)](Result<vector<telegram_api::object_ptr<telegram_api::wallPaper>>> result) {
send_closure(actor_id, &WallpaperManager::on_get_wallpapers, std::move(result));
});
@ -76,7 +77,7 @@ void WallpaperManager::reload_wallpapers(Promise<Unit> &&promise) {
}
}
void WallpaperManager::on_get_wallpapers(Result<vector<telegram_api::object_ptr<telegram_api::WallPaper>>> result) {
void WallpaperManager::on_get_wallpapers(Result<vector<telegram_api::object_ptr<telegram_api::wallPaper>>> result) {
auto promises = std::move(pending_get_wallpapers_queries_);
CHECK(!promises.empty());
reset_to_empty(pending_get_wallpapers_queries_);
@ -91,8 +92,9 @@ void WallpaperManager::on_get_wallpapers(Result<vector<telegram_api::object_ptr<
return;
}
/*
wallpapers_ = transform(result.move_as_ok(), [file_manager = td_->file_manager_.get()](
tl_object_ptr<telegram_api::WallPaper> &&wallpaper_ptr) {
tl_object_ptr<telegram_api::wallPaper> &&wallpaper_ptr) {
CHECK(wallpaper_ptr != nullptr);
switch (wallpaper_ptr->get_id()) {
case telegram_api::wallPaper::ID: {
@ -119,6 +121,7 @@ void WallpaperManager::on_get_wallpapers(Result<vector<telegram_api::object_ptr<
return Wallpaper{0, {}, 0};
}
});
*/
vector<FileId> new_file_ids;
for (auto &wallpaper : wallpapers_) {
append(new_file_ids, transform(wallpaper.sizes, [](auto &size) { return size.file_id; }));

View File

@ -37,7 +37,7 @@ class WallpaperManager : public Actor {
private:
void tear_down() override;
void on_get_wallpapers(Result<vector<telegram_api::object_ptr<telegram_api::WallPaper>>> result);
void on_get_wallpapers(Result<vector<telegram_api::object_ptr<telegram_api::wallPaper>>> result);
struct Wallpaper {
int32 id = 0;

View File

@ -3296,15 +3296,16 @@ class CliClient final : public Actor {
false, false, false);
} else if (status_str == "rest") {
status = td_api::make_object<td_api::chatMemberStatusRestricted>(
true, static_cast<int32>(120 + std::time(nullptr)), false, false, false, false);
true, static_cast<int32>(120 + std::time(nullptr)), false, false, false, false, false, false, false, false);
} else if (status_str == "restkick") {
status = td_api::make_object<td_api::chatMemberStatusRestricted>(
false, static_cast<int32>(120 + std::time(nullptr)), true, false, false, false);
false, static_cast<int32>(120 + std::time(nullptr)), true, false, false, false, false, false, false, false);
} else if (status_str == "restunkick") {
status = td_api::make_object<td_api::chatMemberStatusRestricted>(
true, static_cast<int32>(120 + std::time(nullptr)), true, false, false, false);
true, static_cast<int32>(120 + std::time(nullptr)), true, false, false, false, false, false, false, false);
} else if (status_str == "unrest") {
status = td_api::make_object<td_api::chatMemberStatusRestricted>(true, 0, true, true, true, true);
status = td_api::make_object<td_api::chatMemberStatusRestricted>(true, 0, true, true, true, true, true, true,
true, true);
}
if (status != nullptr) {
send_request(td_api::make_object<td_api::setChatMemberStatus>(as_chat_id(chat_id), as_user_id(user_id),
@ -3343,13 +3344,6 @@ class CliClient final : public Actor {
send_request(td_api::make_object<td_api::setBio>("\n" + args + "\n" + args + "\n"));
} else if (op == "sun") {
send_request(td_api::make_object<td_api::setUsername>(args));
} else if (op == "tbga") {
string group_id;
string everyone_is_administrator;
std::tie(group_id, everyone_is_administrator) = split(args);
send_request(td_api::make_object<td_api::toggleBasicGroupAdministrators>(as_basic_group_id(group_id),
as_bool(everyone_is_administrator)));
} else if (op == "ccun") {
string chat_id;
string username;
@ -3369,13 +3363,6 @@ class CliClient final : public Actor {
std::tie(supergroup_id, sticker_set_id) = split(args);
send_request(td_api::make_object<td_api::setSupergroupStickerSet>(as_supergroup_id(supergroup_id),
to_integer<int64>(sticker_set_id)));
} else if (op == "tsgi") {
string supergroup_id;
string anyone_can_invite;
std::tie(supergroup_id, anyone_can_invite) = split(args);
send_request(td_api::make_object<td_api::toggleSupergroupInvites>(as_supergroup_id(supergroup_id),
as_bool(anyone_can_invite)));
} else if (op == "tsgp") {
string supergroup_id;
string is_all_history_available;

View File

@ -21,7 +21,7 @@ class HeaderStorer {
}
template <class StorerT>
void store(StorerT &storer) const {
constexpr int32 LAYER = 92;
constexpr int32 LAYER = 95;
using td::store;
// invokeWithLayer#da9b0d0d {X:Type} layer:int query:!X = X;