update macos headers

This commit is contained in:
Mikhail Filimonov 2025-08-11 16:47:44 +01:00
parent 403a163692
commit 899e4cd5d1
65 changed files with 2886 additions and 1018 deletions

View file

@ -412,7 +412,6 @@ class e2e_personalContactState final : public e2e_Personal {
public:
int32 flags_;
bool is_contact_;
enum Flags : std::int32_t { IS_CONTACT_MASK = 1 };
e2e_personalContactState();
@ -798,7 +797,6 @@ class e2e_chain_groupParticipant final : public Object {
bool add_users_;
bool remove_users_;
int32 version_;
enum Flags : std::int32_t { ADD_USERS_MASK = 1, REMOVE_USERS_MASK = 2 };
e2e_chain_groupParticipant();

View file

@ -243,7 +243,7 @@ class decryptedMessage final : public DecryptedMessage {
string via_bot_name_;
int64 reply_to_random_id_;
int64 grouped_id_;
enum Flags : std::int32_t { SILENT_MASK = 32, MEDIA_MASK = 512, ENTITIES_MASK = 128, VIA_BOT_NAME_MASK = 2048, REPLY_TO_RANDOM_ID_MASK = 8, GROUPED_ID_MASK = 131072 };
enum Flags : std::int32_t { MEDIA_MASK = 512, ENTITIES_MASK = 128, VIA_BOT_NAME_MASK = 2048, REPLY_TO_RANDOM_ID_MASK = 8, GROUPED_ID_MASK = 131072 };
decryptedMessage();
@ -1252,7 +1252,7 @@ class documentAttributeAudio final : public DocumentAttribute {
string title_;
string performer_;
bytes waveform_;
enum Flags : std::int32_t { VOICE_MASK = 1024, TITLE_MASK = 1, PERFORMER_MASK = 2, WAVEFORM_MASK = 4 };
enum Flags : std::int32_t { TITLE_MASK = 1, PERFORMER_MASK = 2, WAVEFORM_MASK = 4 };
documentAttributeAudio();
@ -1280,7 +1280,6 @@ class documentAttributeVideo final : public DocumentAttribute {
int32 duration_;
int32 w_;
int32 h_;
enum Flags : std::int32_t { ROUND_MESSAGE_MASK = 1 };
documentAttributeVideo();

View file

@ -64,6 +64,10 @@ Result<int32> tl_constructor_from_string(td_api::FileType *object, const std::st
Result<int32> tl_constructor_from_string(td_api::FirebaseAuthenticationSettings *object, const std::string &str);
Result<int32> tl_constructor_from_string(td_api::GiftForResaleOrder *object, const std::string &str);
Result<int32> tl_constructor_from_string(td_api::GroupCallDataChannel *object, const std::string &str);
Result<int32> tl_constructor_from_string(td_api::GroupCallVideoQuality *object, const std::string &str);
Result<int32> tl_constructor_from_string(td_api::InlineKeyboardButtonType *object, const std::string &str);
@ -78,6 +82,8 @@ Result<int32> tl_constructor_from_string(td_api::InputCredentials *object, const
Result<int32> tl_constructor_from_string(td_api::InputFile *object, const std::string &str);
Result<int32> tl_constructor_from_string(td_api::InputGroupCall *object, const std::string &str);
Result<int32> tl_constructor_from_string(td_api::InputInlineQueryResult *object, const std::string &str);
Result<int32> tl_constructor_from_string(td_api::InputInvoice *object, const std::string &str);
@ -186,6 +192,8 @@ Result<int32> tl_constructor_from_string(td_api::TextParseMode *object, const st
Result<int32> tl_constructor_from_string(td_api::TopChatCategory *object, const std::string &str);
Result<int32> tl_constructor_from_string(td_api::UpgradedGiftAttributeId *object, const std::string &str);
Result<int32> tl_constructor_from_string(td_api::UserPrivacySetting *object, const std::string &str);
Result<int32> tl_constructor_from_string(td_api::UserPrivacySettingRule *object, const std::string &str);
@ -538,10 +546,22 @@ Status from_json(td_api::formattedText &to, JsonObject &from);
Status from_json(td_api::forumTopicIcon &to, JsonObject &from);
Status from_json(td_api::giftForResaleOrderPrice &to, JsonObject &from);
Status from_json(td_api::giftForResaleOrderPriceChangeDate &to, JsonObject &from);
Status from_json(td_api::giftForResaleOrderNumber &to, JsonObject &from);
Status from_json(td_api::giftSettings &to, JsonObject &from);
Status from_json(td_api::giveawayParameters &to, JsonObject &from);
Status from_json(td_api::groupCallDataChannelMain &to, JsonObject &from);
Status from_json(td_api::groupCallDataChannelScreenSharing &to, JsonObject &from);
Status from_json(td_api::groupCallJoinParameters &to, JsonObject &from);
Status from_json(td_api::groupCallVideoQualityThumbnail &to, JsonObject &from);
Status from_json(td_api::groupCallVideoQualityMedium &to, JsonObject &from);
@ -610,6 +630,10 @@ Status from_json(td_api::inputFileLocal &to, JsonObject &from);
Status from_json(td_api::inputFileGenerated &to, JsonObject &from);
Status from_json(td_api::inputGroupCallLink &to, JsonObject &from);
Status from_json(td_api::inputGroupCallMessage &to, JsonObject &from);
Status from_json(td_api::inputIdentityDocument &to, JsonObject &from);
Status from_json(td_api::inputInlineQueryResultAnimation &to, JsonObject &from);
@ -806,6 +830,8 @@ Status from_json(td_api::internalLinkTypeEditProfileSettings &to, JsonObject &fr
Status from_json(td_api::internalLinkTypeGame &to, JsonObject &from);
Status from_json(td_api::internalLinkTypeGroupCall &to, JsonObject &from);
Status from_json(td_api::internalLinkTypeInstantView &to, JsonObject &from);
Status from_json(td_api::internalLinkTypeInvoice &to, JsonObject &from);
@ -820,6 +846,8 @@ Status from_json(td_api::internalLinkTypeMessage &to, JsonObject &from);
Status from_json(td_api::internalLinkTypeMessageDraft &to, JsonObject &from);
Status from_json(td_api::internalLinkTypeMyStars &to, JsonObject &from);
Status from_json(td_api::internalLinkTypePassportDataRequest &to, JsonObject &from);
Status from_json(td_api::internalLinkTypePhoneNumberConfirmation &to, JsonObject &from);
@ -1124,9 +1152,9 @@ Status from_json(td_api::premiumLimitTypeShareableChatFolderCount &to, JsonObjec
Status from_json(td_api::premiumLimitTypeActiveStoryCount &to, JsonObject &from);
Status from_json(td_api::premiumLimitTypeWeeklySentStoryCount &to, JsonObject &from);
Status from_json(td_api::premiumLimitTypeWeeklyPostedStoryCount &to, JsonObject &from);
Status from_json(td_api::premiumLimitTypeMonthlySentStoryCount &to, JsonObject &from);
Status from_json(td_api::premiumLimitTypeMonthlyPostedStoryCount &to, JsonObject &from);
Status from_json(td_api::premiumLimitTypeStoryCaptionLength &to, JsonObject &from);
@ -1344,6 +1372,8 @@ Status from_json(td_api::suggestedActionExtendPremium &to, JsonObject &from);
Status from_json(td_api::suggestedActionExtendStarSubscriptions &to, JsonObject &from);
Status from_json(td_api::suggestedActionCustom &to, JsonObject &from);
Status from_json(td_api::supergroupMembersFilterRecent &to, JsonObject &from);
Status from_json(td_api::supergroupMembersFilterContacts &to, JsonObject &from);
@ -1454,6 +1484,12 @@ Status from_json(td_api::topChatCategoryCalls &to, JsonObject &from);
Status from_json(td_api::topChatCategoryForwardChats &to, JsonObject &from);
Status from_json(td_api::upgradedGiftAttributeIdModel &to, JsonObject &from);
Status from_json(td_api::upgradedGiftAttributeIdSymbol &to, JsonObject &from);
Status from_json(td_api::upgradedGiftAttributeIdBackdrop &to, JsonObject &from);
Status from_json(td_api::upgradedGiftBackdropColors &to, JsonObject &from);
Status from_json(td_api::userPrivacySettingShowStatus &to, JsonObject &from);
@ -1590,18 +1626,20 @@ Status from_json(td_api::assignStoreTransaction &to, JsonObject &from);
Status from_json(td_api::banChatMember &to, JsonObject &from);
Status from_json(td_api::banGroupCallParticipants &to, JsonObject &from);
Status from_json(td_api::blockMessageSenderFromReplies &to, JsonObject &from);
Status from_json(td_api::boostChat &to, JsonObject &from);
Status from_json(td_api::canBotSendMessages &to, JsonObject &from);
Status from_json(td_api::canPostStory &to, JsonObject &from);
Status from_json(td_api::canPurchaseFromStore &to, JsonObject &from);
Status from_json(td_api::canSendMessageToUser &to, JsonObject &from);
Status from_json(td_api::canSendStory &to, JsonObject &from);
Status from_json(td_api::canTransferOwnership &to, JsonObject &from);
Status from_json(td_api::cancelDownloadFile &to, JsonObject &from);
@ -1734,6 +1772,10 @@ Status from_json(td_api::createTemporaryPassword &to, JsonObject &from);
Status from_json(td_api::createVideoChat &to, JsonObject &from);
Status from_json(td_api::declineGroupCallInvitation &to, JsonObject &from);
Status from_json(td_api::decryptGroupCallData &to, JsonObject &from);
Status from_json(td_api::deleteAccount &to, JsonObject &from);
Status from_json(td_api::deleteAllCallMessages &to, JsonObject &from);
@ -1880,6 +1922,8 @@ Status from_json(td_api::editUserStarSubscription &to, JsonObject &from);
Status from_json(td_api::enableProxy &to, JsonObject &from);
Status from_json(td_api::encryptGroupCallData &to, JsonObject &from);
Status from_json(td_api::endGroupCall &to, JsonObject &from);
Status from_json(td_api::endGroupCallRecording &to, JsonObject &from);
@ -2054,7 +2098,7 @@ Status from_json(td_api::getChats &to, JsonObject &from);
Status from_json(td_api::getChatsForChatFolderInviteLink &to, JsonObject &from);
Status from_json(td_api::getChatsToSendStories &to, JsonObject &from);
Status from_json(td_api::getChatsToPostStories &to, JsonObject &from);
Status from_json(td_api::getCloseFriends &to, JsonObject &from);
@ -2144,11 +2188,7 @@ Status from_json(td_api::getGrossingWebAppBots &to, JsonObject &from);
Status from_json(td_api::getGroupCall &to, JsonObject &from);
Status from_json(td_api::getGroupCallInviteLink &to, JsonObject &from);
Status from_json(td_api::getGroupCallStreamSegment &to, JsonObject &from);
Status from_json(td_api::getGroupCallStreams &to, JsonObject &from);
Status from_json(td_api::getGroupCallParticipants &to, JsonObject &from);
Status from_json(td_api::getGroupsInCommon &to, JsonObject &from);
@ -2446,8 +2486,14 @@ Status from_json(td_api::getUserSupportInfo &to, JsonObject &from);
Status from_json(td_api::getVideoChatAvailableParticipants &to, JsonObject &from);
Status from_json(td_api::getVideoChatInviteLink &to, JsonObject &from);
Status from_json(td_api::getVideoChatRtmpUrl &to, JsonObject &from);
Status from_json(td_api::getVideoChatStreamSegment &to, JsonObject &from);
Status from_json(td_api::getVideoChatStreams &to, JsonObject &from);
Status from_json(td_api::getWebAppLinkUrl &to, JsonObject &from);
Status from_json(td_api::getWebAppPlaceholder &to, JsonObject &from);
@ -2466,7 +2512,9 @@ Status from_json(td_api::importContacts &to, JsonObject &from);
Status from_json(td_api::importMessages &to, JsonObject &from);
Status from_json(td_api::inviteGroupCallParticipants &to, JsonObject &from);
Status from_json(td_api::inviteGroupCallParticipant &to, JsonObject &from);
Status from_json(td_api::inviteVideoChatParticipants &to, JsonObject &from);
Status from_json(td_api::joinChat &to, JsonObject &from);
@ -2474,6 +2522,8 @@ Status from_json(td_api::joinChatByInviteLink &to, JsonObject &from);
Status from_json(td_api::joinGroupCall &to, JsonObject &from);
Status from_json(td_api::joinVideoChat &to, JsonObject &from);
Status from_json(td_api::launchPrepaidGiveaway &to, JsonObject &from);
Status from_json(td_api::leaveChat &to, JsonObject &from);
@ -2518,6 +2568,8 @@ Status from_json(td_api::pinChatMessage &to, JsonObject &from);
Status from_json(td_api::pingProxy &to, JsonObject &from);
Status from_json(td_api::postStory &to, JsonObject &from);
Status from_json(td_api::preliminaryUploadFile &to, JsonObject &from);
Status from_json(td_api::processChatFolderNewChats &to, JsonObject &from);
@ -2702,6 +2754,8 @@ Status from_json(td_api::searchEmojis &to, JsonObject &from);
Status from_json(td_api::searchFileDownloads &to, JsonObject &from);
Status from_json(td_api::searchGiftsForResale &to, JsonObject &from);
Status from_json(td_api::searchHashtags &to, JsonObject &from);
Status from_json(td_api::searchInstalledStickerSets &to, JsonObject &from);
@ -2786,7 +2840,7 @@ Status from_json(td_api::sendPhoneNumberFirebaseSms &to, JsonObject &from);
Status from_json(td_api::sendQuickReplyShortcutMessages &to, JsonObject &from);
Status from_json(td_api::sendStory &to, JsonObject &from);
Status from_json(td_api::sendResoldGift &to, JsonObject &from);
Status from_json(td_api::sendWebAppCustomRequest &to, JsonObject &from);
@ -2926,14 +2980,14 @@ Status from_json(td_api::setForumTopicNotificationSettings &to, JsonObject &from
Status from_json(td_api::setGameScore &to, JsonObject &from);
Status from_json(td_api::setGiftResalePrice &to, JsonObject &from);
Status from_json(td_api::setGiftSettings &to, JsonObject &from);
Status from_json(td_api::setGroupCallParticipantIsSpeaking &to, JsonObject &from);
Status from_json(td_api::setGroupCallParticipantVolumeLevel &to, JsonObject &from);
Status from_json(td_api::setGroupCallTitle &to, JsonObject &from);
Status from_json(td_api::setInactiveSessionTtl &to, JsonObject &from);
Status from_json(td_api::setInlineGameScore &to, JsonObject &from);
@ -3038,6 +3092,8 @@ Status from_json(td_api::setUsername &to, JsonObject &from);
Status from_json(td_api::setVideoChatDefaultParticipant &to, JsonObject &from);
Status from_json(td_api::setVideoChatTitle &to, JsonObject &from);
Status from_json(td_api::shareChatWithBot &to, JsonObject &from);
Status from_json(td_api::sharePhoneNumber &to, JsonObject &from);
@ -3048,7 +3104,7 @@ Status from_json(td_api::startGroupCallRecording &to, JsonObject &from);
Status from_json(td_api::startGroupCallScreenSharing &to, JsonObject &from);
Status from_json(td_api::startScheduledGroupCall &to, JsonObject &from);
Status from_json(td_api::startScheduledVideoChat &to, JsonObject &from);
Status from_json(td_api::stopBusinessPoll &to, JsonObject &from);
@ -3124,14 +3180,10 @@ Status from_json(td_api::toggleGeneralForumTopicIsHidden &to, JsonObject &from);
Status from_json(td_api::toggleGiftIsSaved &to, JsonObject &from);
Status from_json(td_api::toggleGroupCallEnabledStartNotification &to, JsonObject &from);
Status from_json(td_api::toggleGroupCallIsMyVideoEnabled &to, JsonObject &from);
Status from_json(td_api::toggleGroupCallIsMyVideoPaused &to, JsonObject &from);
Status from_json(td_api::toggleGroupCallMuteNewParticipants &to, JsonObject &from);
Status from_json(td_api::toggleGroupCallParticipantIsHandRaised &to, JsonObject &from);
Status from_json(td_api::toggleGroupCallParticipantIsMuted &to, JsonObject &from);
@ -3152,6 +3204,8 @@ Status from_json(td_api::toggleSupergroupCanHaveSponsoredMessages &to, JsonObjec
Status from_json(td_api::toggleSupergroupHasAggressiveAntiSpamEnabled &to, JsonObject &from);
Status from_json(td_api::toggleSupergroupHasAutomaticTranslation &to, JsonObject &from);
Status from_json(td_api::toggleSupergroupHasHiddenMembers &to, JsonObject &from);
Status from_json(td_api::toggleSupergroupIsAllHistoryAvailable &to, JsonObject &from);
@ -3170,6 +3224,10 @@ Status from_json(td_api::toggleSupergroupUsernameIsActive &to, JsonObject &from)
Status from_json(td_api::toggleUsernameIsActive &to, JsonObject &from);
Status from_json(td_api::toggleVideoChatEnabledStartNotification &to, JsonObject &from);
Status from_json(td_api::toggleVideoChatMuteNewParticipants &to, JsonObject &from);
Status from_json(td_api::transferBusinessAccountStars &to, JsonObject &from);
Status from_json(td_api::transferChatOwnership &to, JsonObject &from);
@ -3312,6 +3370,10 @@ void to_json(JsonValueScope &jv, const td_api::autosaveSettingsScopeChannelChats
void to_json(JsonValueScope &jv, const td_api::autosaveSettingsScopeChat &object);
void to_json(JsonValueScope &jv, const td_api::availableGift &object);
void to_json(JsonValueScope &jv, const td_api::availableGifts &object);
void to_json(JsonValueScope &jv, const td_api::availableReaction &object);
void to_json(JsonValueScope &jv, const td_api::availableReactions &object);
@ -3466,7 +3528,7 @@ void to_json(JsonValueScope &jv, const td_api::callDiscardReasonDisconnected &ob
void to_json(JsonValueScope &jv, const td_api::callDiscardReasonHungUp &object);
void to_json(JsonValueScope &jv, const td_api::callDiscardReasonAllowGroupCall &object);
void to_json(JsonValueScope &jv, const td_api::callDiscardReasonUpgradeToGroupCall &object);
void to_json(JsonValueScope &jv, const td_api::callId &object);
@ -3504,6 +3566,20 @@ void to_json(JsonValueScope &jv, const td_api::callbackQueryPayloadDataWithPassw
void to_json(JsonValueScope &jv, const td_api::callbackQueryPayloadGame &object);
void to_json(JsonValueScope &jv, const td_api::CanPostStoryResult &object);
void to_json(JsonValueScope &jv, const td_api::canPostStoryResultOk &object);
void to_json(JsonValueScope &jv, const td_api::canPostStoryResultPremiumNeeded &object);
void to_json(JsonValueScope &jv, const td_api::canPostStoryResultBoostNeeded &object);
void to_json(JsonValueScope &jv, const td_api::canPostStoryResultActiveStoryLimitExceeded &object);
void to_json(JsonValueScope &jv, const td_api::canPostStoryResultWeeklyLimitExceeded &object);
void to_json(JsonValueScope &jv, const td_api::canPostStoryResultMonthlyLimitExceeded &object);
void to_json(JsonValueScope &jv, const td_api::CanSendMessageToUserResult &object);
void to_json(JsonValueScope &jv, const td_api::canSendMessageToUserResultOk &object);
@ -3514,20 +3590,6 @@ void to_json(JsonValueScope &jv, const td_api::canSendMessageToUserResultUserIsD
void to_json(JsonValueScope &jv, const td_api::canSendMessageToUserResultUserRestrictsNewChats &object);
void to_json(JsonValueScope &jv, const td_api::CanSendStoryResult &object);
void to_json(JsonValueScope &jv, const td_api::canSendStoryResultOk &object);
void to_json(JsonValueScope &jv, const td_api::canSendStoryResultPremiumNeeded &object);
void to_json(JsonValueScope &jv, const td_api::canSendStoryResultBoostNeeded &object);
void to_json(JsonValueScope &jv, const td_api::canSendStoryResultActiveStoryLimitExceeded &object);
void to_json(JsonValueScope &jv, const td_api::canSendStoryResultWeeklyLimitExceeded &object);
void to_json(JsonValueScope &jv, const td_api::canSendStoryResultMonthlyLimitExceeded &object);
void to_json(JsonValueScope &jv, const td_api::CanTransferOwnershipResult &object);
void to_json(JsonValueScope &jv, const td_api::canTransferOwnershipResultOk &object);
@ -3702,6 +3764,8 @@ void to_json(JsonValueScope &jv, const td_api::chatEventSignMessagesToggled &obj
void to_json(JsonValueScope &jv, const td_api::chatEventShowMessageSenderToggled &object);
void to_json(JsonValueScope &jv, const td_api::chatEventAutomaticTranslationToggled &object);
void to_json(JsonValueScope &jv, const td_api::chatEventInviteLinkEdited &object);
void to_json(JsonValueScope &jv, const td_api::chatEventInviteLinkRevoked &object);
@ -3942,6 +4006,8 @@ void to_json(JsonValueScope &jv, const td_api::currentWeather &object);
void to_json(JsonValueScope &jv, const td_api::customRequestResult &object);
void to_json(JsonValueScope &jv, const td_api::data &object);
void to_json(JsonValueScope &jv, const td_api::databaseStatistics &object);
void to_json(JsonValueScope &jv, const td_api::date &object);
@ -4020,8 +4086,6 @@ void to_json(JsonValueScope &jv, const td_api::fileDownload &object);
void to_json(JsonValueScope &jv, const td_api::fileDownloadedPrefixSize &object);
void to_json(JsonValueScope &jv, const td_api::filePart &object);
void to_json(JsonValueScope &jv, const td_api::FileType &object);
void to_json(JsonValueScope &jv, const td_api::fileTypeNone &object);
@ -4118,11 +4182,13 @@ void to_json(JsonValueScope &jv, const td_api::gameHighScores &object);
void to_json(JsonValueScope &jv, const td_api::gift &object);
void to_json(JsonValueScope &jv, const td_api::giftForResale &object);
void to_json(JsonValueScope &jv, const td_api::giftSettings &object);
void to_json(JsonValueScope &jv, const td_api::giftUpgradePreview &object);
void to_json(JsonValueScope &jv, const td_api::gifts &object);
void to_json(JsonValueScope &jv, const td_api::giftsForResale &object);
void to_json(JsonValueScope &jv, const td_api::GiveawayInfo &object);
@ -4154,16 +4220,16 @@ void to_json(JsonValueScope &jv, const td_api::groupCall &object);
void to_json(JsonValueScope &jv, const td_api::groupCallId &object);
void to_json(JsonValueScope &jv, const td_api::groupCallInfo &object);
void to_json(JsonValueScope &jv, const td_api::groupCallParticipant &object);
void to_json(JsonValueScope &jv, const td_api::groupCallParticipantVideoInfo &object);
void to_json(JsonValueScope &jv, const td_api::groupCallParticipants &object);
void to_json(JsonValueScope &jv, const td_api::groupCallRecentSpeaker &object);
void to_json(JsonValueScope &jv, const td_api::groupCallStream &object);
void to_json(JsonValueScope &jv, const td_api::groupCallStreams &object);
void to_json(JsonValueScope &jv, const td_api::groupCallVideoSourceGroup &object);
void to_json(JsonValueScope &jv, const td_api::hashtags &object);
@ -4342,6 +4408,8 @@ void to_json(JsonValueScope &jv, const td_api::internalLinkTypeEditProfileSettin
void to_json(JsonValueScope &jv, const td_api::internalLinkTypeGame &object);
void to_json(JsonValueScope &jv, const td_api::internalLinkTypeGroupCall &object);
void to_json(JsonValueScope &jv, const td_api::internalLinkTypeInstantView &object);
void to_json(JsonValueScope &jv, const td_api::internalLinkTypeInvoice &object);
@ -4356,6 +4424,8 @@ void to_json(JsonValueScope &jv, const td_api::internalLinkTypeMessage &object);
void to_json(JsonValueScope &jv, const td_api::internalLinkTypeMessageDraft &object);
void to_json(JsonValueScope &jv, const td_api::internalLinkTypeMyStars &object);
void to_json(JsonValueScope &jv, const td_api::internalLinkTypePassportDataRequest &object);
void to_json(JsonValueScope &jv, const td_api::internalLinkTypePhoneNumberConfirmation &object);
@ -4400,6 +4470,16 @@ void to_json(JsonValueScope &jv, const td_api::internalLinkTypeVideoChat &object
void to_json(JsonValueScope &jv, const td_api::internalLinkTypeWebApp &object);
void to_json(JsonValueScope &jv, const td_api::InviteGroupCallParticipantResult &object);
void to_json(JsonValueScope &jv, const td_api::inviteGroupCallParticipantResultUserPrivacyRestricted &object);
void to_json(JsonValueScope &jv, const td_api::inviteGroupCallParticipantResultUserAlreadyParticipant &object);
void to_json(JsonValueScope &jv, const td_api::inviteGroupCallParticipantResultUserWasBanned &object);
void to_json(JsonValueScope &jv, const td_api::inviteGroupCallParticipantResultSuccess &object);
void to_json(JsonValueScope &jv, const td_api::InviteLinkChatType &object);
void to_json(JsonValueScope &jv, const td_api::inviteLinkChatTypeBasicGroup &object);
@ -4500,6 +4580,8 @@ void to_json(JsonValueScope &jv, const td_api::linkPreviewTypeExternalAudio &obj
void to_json(JsonValueScope &jv, const td_api::linkPreviewTypeExternalVideo &object);
void to_json(JsonValueScope &jv, const td_api::linkPreviewTypeGroupCall &object);
void to_json(JsonValueScope &jv, const td_api::linkPreviewTypeInvoice &object);
void to_json(JsonValueScope &jv, const td_api::linkPreviewTypeMessage &object);
@ -4634,6 +4716,8 @@ void to_json(JsonValueScope &jv, const td_api::messageInvoice &object);
void to_json(JsonValueScope &jv, const td_api::messageCall &object);
void to_json(JsonValueScope &jv, const td_api::messageGroupCall &object);
void to_json(JsonValueScope &jv, const td_api::messageVideoChatScheduled &object);
void to_json(JsonValueScope &jv, const td_api::messageVideoChatStarted &object);
@ -5268,9 +5352,9 @@ void to_json(JsonValueScope &jv, const td_api::premiumLimitTypeShareableChatFold
void to_json(JsonValueScope &jv, const td_api::premiumLimitTypeActiveStoryCount &object);
void to_json(JsonValueScope &jv, const td_api::premiumLimitTypeWeeklySentStoryCount &object);
void to_json(JsonValueScope &jv, const td_api::premiumLimitTypeWeeklyPostedStoryCount &object);
void to_json(JsonValueScope &jv, const td_api::premiumLimitTypeMonthlySentStoryCount &object);
void to_json(JsonValueScope &jv, const td_api::premiumLimitTypeMonthlyPostedStoryCount &object);
void to_json(JsonValueScope &jv, const td_api::premiumLimitTypeStoryCaptionLength &object);
@ -5726,6 +5810,10 @@ void to_json(JsonValueScope &jv, const td_api::starTransactionTypeGiftSale &obje
void to_json(JsonValueScope &jv, const td_api::starTransactionTypeGiftUpgrade &object);
void to_json(JsonValueScope &jv, const td_api::starTransactionTypeUpgradedGiftPurchase &object);
void to_json(JsonValueScope &jv, const td_api::starTransactionTypeUpgradedGiftSale &object);
void to_json(JsonValueScope &jv, const td_api::starTransactionTypeChannelPaidReactionSend &object);
void to_json(JsonValueScope &jv, const td_api::starTransactionTypeChannelPaidReactionReceive &object);
@ -5904,6 +5992,8 @@ void to_json(JsonValueScope &jv, const td_api::suggestedActionExtendPremium &obj
void to_json(JsonValueScope &jv, const td_api::suggestedActionExtendStarSubscriptions &object);
void to_json(JsonValueScope &jv, const td_api::suggestedActionCustom &object);
void to_json(JsonValueScope &jv, const td_api::supergroup &object);
void to_json(JsonValueScope &jv, const td_api::supergroupFullInfo &object);
@ -6210,6 +6300,10 @@ void to_json(JsonValueScope &jv, const td_api::updateGroupCall &object);
void to_json(JsonValueScope &jv, const td_api::updateGroupCallParticipant &object);
void to_json(JsonValueScope &jv, const td_api::updateGroupCallParticipants &object);
void to_json(JsonValueScope &jv, const td_api::updateGroupCallVerificationState &object);
void to_json(JsonValueScope &jv, const td_api::updateNewCallSignalingData &object);
void to_json(JsonValueScope &jv, const td_api::updateUserPrivacySettingRules &object);
@ -6222,9 +6316,9 @@ void to_json(JsonValueScope &jv, const td_api::updateStory &object);
void to_json(JsonValueScope &jv, const td_api::updateStoryDeleted &object);
void to_json(JsonValueScope &jv, const td_api::updateStorySendSucceeded &object);
void to_json(JsonValueScope &jv, const td_api::updateStoryPostSucceeded &object);
void to_json(JsonValueScope &jv, const td_api::updateStorySendFailed &object);
void to_json(JsonValueScope &jv, const td_api::updateStoryPostFailed &object);
void to_json(JsonValueScope &jv, const td_api::updateChatActiveStories &object);
@ -6356,12 +6450,18 @@ void to_json(JsonValueScope &jv, const td_api::upgradedGiftBackdrop &object);
void to_json(JsonValueScope &jv, const td_api::upgradedGiftBackdropColors &object);
void to_json(JsonValueScope &jv, const td_api::upgradedGiftBackdropCount &object);
void to_json(JsonValueScope &jv, const td_api::upgradedGiftModel &object);
void to_json(JsonValueScope &jv, const td_api::upgradedGiftModelCount &object);
void to_json(JsonValueScope &jv, const td_api::upgradedGiftOriginalDetails &object);
void to_json(JsonValueScope &jv, const td_api::upgradedGiftSymbol &object);
void to_json(JsonValueScope &jv, const td_api::upgradedGiftSymbolCount &object);
void to_json(JsonValueScope &jv, const td_api::user &object);
void to_json(JsonValueScope &jv, const td_api::userFullInfo &object);
@ -6468,6 +6568,10 @@ void to_json(JsonValueScope &jv, const td_api::video &object);
void to_json(JsonValueScope &jv, const td_api::videoChat &object);
void to_json(JsonValueScope &jv, const td_api::videoChatStream &object);
void to_json(JsonValueScope &jv, const td_api::videoChatStreams &object);
void to_json(JsonValueScope &jv, const td_api::videoNote &object);
void to_json(JsonValueScope &jv, const td_api::voiceNote &object);

View file

@ -67,16 +67,20 @@ class AuthData {
void set_main_auth_key(AuthKey auth_key) {
main_auth_key_ = std::move(auth_key);
}
void break_main_auth_key() {
main_auth_key_.break_key();
}
const AuthKey &get_main_auth_key() const {
// CHECK(has_main_auth_key());
return main_auth_key_;
}
bool has_main_auth_key() const {
return !main_auth_key_.empty();
}
bool need_main_auth_key() const {
return !has_main_auth_key();
}
@ -85,12 +89,15 @@ class AuthData {
CHECK(!auth_key.empty());
tmp_auth_key_ = std::move(auth_key);
}
const AuthKey &get_tmp_auth_key() const {
return tmp_auth_key_;
}
bool was_tmp_auth_key() const {
return use_pfs() && !tmp_auth_key_.empty();
}
bool need_tmp_auth_key(double now, double refresh_margin) const {
if (!use_pfs()) {
return false;
@ -103,12 +110,15 @@ class AuthData {
}
return false;
}
void drop_main_auth_key() {
main_auth_key_ = AuthKey();
}
void drop_tmp_auth_key() {
tmp_auth_key_ = AuthKey();
}
bool has_tmp_auth_key(double now) const {
if (!use_pfs()) {
return false;
@ -128,6 +138,7 @@ class AuthData {
}
return get_main_auth_key();
}
bool has_auth_key(double now) const {
if (use_pfs()) {
return has_tmp_auth_key(now);
@ -138,6 +149,7 @@ class AuthData {
bool get_auth_flag() const {
return main_auth_key_.auth_flag();
}
void set_auth_flag(bool auth_flag) {
main_auth_key_.set_auth_flag(auth_flag);
if (!auth_flag) {
@ -148,6 +160,7 @@ class AuthData {
bool get_bind_flag() const {
return !use_pfs() || tmp_auth_key_.auth_flag();
}
void on_bind() {
CHECK(use_pfs());
tmp_auth_key_.set_auth_flag(true);
@ -184,6 +197,7 @@ class AuthData {
void set_session_id(uint64 session_id) {
session_id_ = session_id;
}
uint64 get_session_id() const {
CHECK(session_id_ != 0);
return session_id_;

View file

@ -90,7 +90,7 @@ class AuthManager final : public NetActor {
tl_object_ptr<td_api::AuthorizationState> get_current_authorization_state_object() const;
private:
static constexpr size_t MAX_NAME_LENGTH = 64; // server side limit
static constexpr size_t MAX_NAME_LENGTH = 64; // server-side limit
enum class State : int32 {
None,

View file

@ -27,7 +27,7 @@ class BotRecommendationManager final : public Actor {
void get_bot_recommendations(UserId bot_user_id, bool return_local,
Promise<td_api::object_ptr<td_api::users>> &&users_promise,
Promise<td_api::object_ptr<td_api::count>> &&count_promise);
Promise<int32> &&count_promise);
void open_bot_recommended_bot(UserId bot_user_id, UserId opened_bot_user_id, Promise<Unit> &&promise);
@ -56,7 +56,7 @@ class BotRecommendationManager final : public Actor {
void load_bot_recommendations(UserId bot_user_id, bool use_database, bool return_local,
Promise<td_api::object_ptr<td_api::users>> &&users_promise,
Promise<td_api::object_ptr<td_api::count>> &&count_promise);
Promise<int32> &&count_promise);
void fail_load_bot_recommendations_queries(UserId bot_user_id, Status &&error);
@ -74,8 +74,7 @@ class BotRecommendationManager final : public Actor {
FlatHashMap<UserId, RecommendedBots, UserIdHash> bot_recommended_bots_;
FlatHashMap<UserId, vector<Promise<td_api::object_ptr<td_api::users>>>, UserIdHash> get_bot_recommendations_queries_;
FlatHashMap<UserId, vector<Promise<td_api::object_ptr<td_api::count>>>, UserIdHash>
get_bot_recommendation_count_queries_[2];
FlatHashMap<UserId, vector<Promise<int32>>, UserIdHash> get_bot_recommendation_count_queries_[2];
};
} // namespace td

View file

@ -137,7 +137,7 @@ class BusinessConnectionManager final : public Actor {
void get_current_state(vector<td_api::object_ptr<td_api::Update>> &updates) const;
private:
static constexpr size_t MAX_NAME_LENGTH = 64; // server side limit for first/last name
static constexpr size_t MAX_NAME_LENGTH = 64; // server-side limit for first/last name
struct BusinessConnection;
struct PendingMessage;

View file

@ -10,8 +10,6 @@
#include "td/telegram/CallId.h"
#include "td/telegram/DhConfig.h"
#include "td/telegram/files/FileUploadId.h"
#include "td/telegram/GroupCallId.h"
#include "td/telegram/InputGroupCallId.h"
#include "td/telegram/net/NetQuery.h"
#include "td/telegram/td_api.h"
#include "td/telegram/telegram_api.h"
@ -92,6 +90,7 @@ struct CallState {
vector<string> emojis_fingerprint;
string custom_parameters;
bool allow_p2p{false};
bool conference_supported{false};
Status error;
@ -102,8 +101,7 @@ class CallActor final : public NetQueryCallback {
public:
CallActor(Td *td, CallId call_id, ActorShared<> parent, Promise<int64> promise);
void create_call(UserId user_id, CallProtocol &&protocol, bool is_video, GroupCallId group_call_id,
Promise<CallId> &&promise);
void create_call(UserId user_id, CallProtocol &&protocol, bool is_video, Promise<CallId> &&promise);
void accept_call(CallProtocol &&protocol, Promise<Unit> promise);
@ -111,7 +109,8 @@ class CallActor final : public NetQueryCallback {
void send_call_signaling_data(string &&data, Promise<Unit> promise);
void discard_call(bool is_disconnected, int32 duration, bool is_video, int64 connection_id, Promise<Unit> promise);
void discard_call(bool is_disconnected, const string &invite_link, int32 duration, bool is_video, int64 connection_id,
Promise<Unit> promise);
void rate_call(int32 rating, string comment, vector<td_api::object_ptr<td_api::CallProblem>> &&problems,
Promise<Unit> promise);
@ -120,8 +119,6 @@ class CallActor final : public NetQueryCallback {
void send_call_log(td_api::object_ptr<td_api::InputFile> log_file, Promise<Unit> promise);
void create_conference_call(Promise<Unit> promise);
void update_call(tl_object_ptr<telegram_api::PhoneCall> call);
private:
@ -155,7 +152,6 @@ class CallActor final : public NetQueryCallback {
bool is_outgoing_{false};
bool is_video_{false};
UserId user_id_;
InputGroupCallId input_group_call_id_;
CallId local_call_id_;
int64 call_id_{0};
@ -172,8 +168,6 @@ class CallActor final : public NetQueryCallback {
void update_call_inner(tl_object_ptr<telegram_api::phone_phoneCall> call);
void update_conference_call(const telegram_api::object_ptr<telegram_api::inputGroupCall> &conference_call);
tl_object_ptr<telegram_api::inputPhoneCall> get_input_phone_call(const char *source);
bool load_dh_config();
void on_dh_config(Result<std::shared_ptr<DhConfig>> r_dh_config, bool dummy);
@ -223,8 +217,6 @@ class CallActor final : public NetQueryCallback {
void on_save_log_query_result(FileUploadId file_upload_id, Promise<Unit> promise, Result<NetQueryPtr> r_net_query);
void on_create_conference_call_result(Promise<Unit> promise, Result<NetQueryPtr> r_net_query);
void on_get_call_config_result(Result<NetQueryPtr> r_net_query);
void flush_call_state();

View file

@ -14,9 +14,9 @@
namespace td {
struct CallDiscardReason {
enum class Type : int32 { Empty, Missed, Disconnected, HungUp, Declined };
enum class Type : int32 { Empty, Missed, Disconnected, HungUp, Declined, UpgradeToGroupCall };
Type type_ = Type::Empty;
string encrypted_key_;
string slug_;
};
CallDiscardReason get_call_discard_reason(const telegram_api::object_ptr<telegram_api::PhoneCallDiscardReason> &reason);

View file

@ -8,7 +8,6 @@
#include "td/telegram/CallActor.h"
#include "td/telegram/CallId.h"
#include "td/telegram/GroupCallId.h"
#include "td/telegram/td_api.h"
#include "td/telegram/telegram_api.h"
#include "td/telegram/UserId.h"
@ -30,21 +29,18 @@ class CallManager final : public Actor {
public:
CallManager(Td *td, ActorShared<> parent);
CallId get_call_id(int64 call_id);
void update_call(telegram_api::object_ptr<telegram_api::updatePhoneCall> call);
void update_call_signaling_data(int64 call_id, string data);
void create_call(UserId user_id, CallProtocol &&protocol, bool is_video, GroupCallId group_call_id,
Promise<CallId> promise);
void create_call(UserId user_id, CallProtocol &&protocol, bool is_video, Promise<CallId> promise);
void accept_call(CallId call_id, CallProtocol &&protocol, Promise<Unit> promise);
void send_call_signaling_data(CallId call_id, string &&data, Promise<Unit> promise);
void discard_call(CallId call_id, bool is_disconnected, int32 duration, bool is_video, int64 connection_id,
Promise<Unit> promise);
void discard_call(CallId call_id, bool is_disconnected, const string &invite_link, int32 duration, bool is_video,
int64 connection_id, Promise<Unit> promise);
void rate_call(CallId call_id, int32 rating, string comment,
vector<td_api::object_ptr<td_api::CallProblem>> &&problems, Promise<Unit> promise);
@ -53,8 +49,6 @@ class CallManager final : public Actor {
void send_call_log(CallId call_id, td_api::object_ptr<td_api::InputFile> log_file, Promise<Unit> promise);
void create_conference_call(CallId call_id, Promise<Unit> promise);
private:
bool close_flag_ = false;

View file

@ -32,7 +32,7 @@ class ChannelRecommendationManager final : public Actor {
void get_channel_recommendations(DialogId dialog_id, bool return_local,
Promise<td_api::object_ptr<td_api::chats>> &&chats_promise,
Promise<td_api::object_ptr<td_api::count>> &&count_promise);
Promise<int32> &&count_promise);
void open_channel_recommended_channel(DialogId dialog_id, DialogId opened_dialog_id, Promise<Unit> &&promise);
@ -77,7 +77,7 @@ class ChannelRecommendationManager final : public Actor {
void load_channel_recommendations(ChannelId channel_id, bool use_database, bool return_local,
Promise<td_api::object_ptr<td_api::chats>> &&chats_promise,
Promise<td_api::object_ptr<td_api::count>> &&count_promise);
Promise<int32> &&count_promise);
void fail_load_channel_recommendations_queries(ChannelId channel_id, Status &&error);
@ -94,8 +94,7 @@ class ChannelRecommendationManager final : public Actor {
FlatHashMap<ChannelId, RecommendedDialogs, ChannelIdHash> channel_recommended_dialogs_;
FlatHashMap<ChannelId, vector<Promise<td_api::object_ptr<td_api::chats>>>, ChannelIdHash>
get_channel_recommendations_queries_;
FlatHashMap<ChannelId, vector<Promise<td_api::object_ptr<td_api::count>>>, ChannelIdHash>
get_channel_recommendation_count_queries_[2];
FlatHashMap<ChannelId, vector<Promise<int32>>, ChannelIdHash> get_channel_recommendation_count_queries_[2];
RecommendedDialogs recommended_channels_;
vector<Promise<td_api::object_ptr<td_api::chats>>> get_recommended_channels_queries_;

View file

@ -121,6 +121,8 @@ class ChatManager final : public Actor {
bool get_channel_stories_hidden(ChannelId channel_id) const;
bool get_channel_autotranslation(ChannelId channel_id) const;
bool can_poll_channel_active_stories(ChannelId channel_id) const;
bool can_use_premium_custom_emoji_in_channel(ChannelId channel_id) const;
@ -259,6 +261,9 @@ class ChatManager final : public Actor {
void toggle_channel_can_have_sponsored_messages(ChannelId channel_id, bool can_have_sponsored_messages,
Promise<Unit> &&promise);
void toggle_channel_has_automatic_translation(ChannelId channel_id, bool has_automatic_translation,
Promise<Unit> &&promise);
void toggle_channel_has_hidden_participants(ChannelId channel_id, bool has_hidden_participants,
Promise<Unit> &&promise);
@ -507,6 +512,7 @@ class ChatManager final : public Actor {
bool join_to_send = false;
bool join_request = false;
bool stories_hidden = false;
bool autotranslation = false;
bool is_megagroup = false;
bool is_gigagroup = false;
@ -628,8 +634,8 @@ class ChatManager final : public Actor {
class ChatLogEvent;
class ChannelLogEvent;
static constexpr size_t MAX_TITLE_LENGTH = 128; // server side limit for chat title
static constexpr size_t MAX_DESCRIPTION_LENGTH = 255; // server side limit for chat/channel description
static constexpr size_t MAX_TITLE_LENGTH = 128; // server-side limit for chat title
static constexpr size_t MAX_DESCRIPTION_LENGTH = 255; // server-side limit for chat/channel description
static constexpr int32 MAX_ACTIVE_STORY_ID_RELOAD_TIME = 3600; // some reasonable limit

View file

@ -42,7 +42,7 @@ class CommonDialogManager final : public Actor {
private:
void tear_down() final;
static constexpr int32 MAX_GET_DIALOGS = 100; // server side limit
static constexpr int32 MAX_GET_DIALOGS = 100; // server-side limit
struct CommonDialogs {
vector<DialogId> dialog_ids;

View file

@ -77,7 +77,7 @@ class ConfigManager final : public NetQueryCallback {
private:
struct AppConfig {
static constexpr int32 CURRENT_VERSION = 71;
static constexpr int32 CURRENT_VERSION = 77;
int32 version_ = 0;
int32 hash_ = 0;
telegram_api::object_ptr<telegram_api::JSONValue> config_;

View file

@ -87,7 +87,7 @@ class DialogInviteLinkManager final : public Actor {
void delete_all_revoked_dialog_invite_links(DialogId dialog_id, UserId creator_user_id, Promise<Unit> &&promise);
private:
static constexpr size_t MAX_INVITE_LINK_TITLE_LENGTH = 32; // server side limit
static constexpr size_t MAX_INVITE_LINK_TITLE_LENGTH = 32; // server-side limit
void tear_down() final;

View file

@ -252,7 +252,7 @@ class DialogManager final : public Actor {
vector<DialogId> search_dialogs_on_server(const string &query, int32 limit, Promise<Unit> &&promise);
void reload_voice_chat_on_search(const string &username);
void reload_video_chat_on_search(const string &username);
void reget_peer_settings(DialogId dialog_id);
@ -377,7 +377,7 @@ class DialogManager final : public Actor {
};
WaitFreeHashMap<string, ResolvedUsername> resolved_usernames_;
WaitFreeHashMap<string, DialogId> inaccessible_resolved_usernames_;
FlatHashSet<string> reload_voice_chat_on_search_usernames_;
FlatHashSet<string> reload_video_chat_on_search_usernames_;
FlatHashMap<string, vector<Promise<Unit>>> resolve_dialog_username_queries_;

View file

@ -162,7 +162,7 @@ class DialogParticipantManager final : public Actor {
static constexpr int32 CHANNEL_PARTICIPANT_CACHE_TIME = 1800; // some reasonable limit
static constexpr int32 MAX_GET_CHANNEL_PARTICIPANTS = 200; // server side limit
static constexpr int32 MAX_GET_CHANNEL_PARTICIPANTS = 200; // server-side limit
void tear_down() final;

View file

@ -116,7 +116,7 @@ class ForumTopicManager final : public Actor {
void on_topic_message_count_changed(DialogId dialog_id, MessageId top_thread_message_id, int diff);
private:
static constexpr size_t MAX_FORUM_TOPIC_TITLE_LENGTH = 128; // server side limit for forum topic title
static constexpr size_t MAX_FORUM_TOPIC_TITLE_LENGTH = 128; // server-side limit for forum topic title
struct Topic {
unique_ptr<ForumTopicInfo> info_;

View file

@ -0,0 +1,30 @@
//
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2025
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#pragma once
#include "td/telegram/td_api.h"
#include "td/utils/common.h"
#include "td/utils/Status.h"
namespace td {
struct GroupCallJoinParameters {
string payload_;
int32 audio_source_ = 0;
bool is_muted_ = false;
bool is_my_video_enabled_ = false;
static Result<GroupCallJoinParameters> get_group_call_join_parameters(
td_api::object_ptr<td_api::groupCallJoinParameters> &&parameters, bool allow_empty);
bool is_empty() const {
return payload_.empty();
}
};
} // namespace td

View file

@ -11,7 +11,9 @@
#include "td/telegram/GroupCallId.h"
#include "td/telegram/GroupCallParticipant.h"
#include "td/telegram/GroupCallParticipantOrder.h"
#include "td/telegram/InputGroupCall.h"
#include "td/telegram/InputGroupCallId.h"
#include "td/telegram/MessageFullId.h"
#include "td/telegram/td_api.h"
#include "td/telegram/telegram_api.h"
#include "td/telegram/UserId.h"
@ -19,6 +21,8 @@
#include "td/actor/actor.h"
#include "td/actor/MultiTimeout.h"
#include "td/e2e/e2e_api.h"
#include "td/utils/common.h"
#include "td/utils/FlatHashMap.h"
#include "td/utils/Promise.h"
@ -28,6 +32,7 @@
namespace td {
struct GroupCallJoinParameters;
class Td;
class GroupCallManager final : public Actor {
@ -51,10 +56,13 @@ class GroupCallManager final : public Actor {
void set_group_call_default_join_as(DialogId dialog_id, DialogId as_dialog_id, Promise<Unit> &&promise);
void create_voice_chat(DialogId dialog_id, string title, int32 start_date, bool is_rtmp_stream,
void create_video_chat(DialogId dialog_id, string title, int32 start_date, bool is_rtmp_stream,
Promise<GroupCallId> &&promise);
void get_voice_chat_rtmp_stream_url(DialogId dialog_id, bool revoke,
void create_group_call(td_api::object_ptr<td_api::groupCallJoinParameters> &&join_parameters,
Promise<td_api::object_ptr<td_api::groupCallInfo>> &&promise);
void get_video_chat_rtmp_stream_url(DialogId dialog_id, bool revoke,
Promise<td_api::object_ptr<td_api::rtmpUrl>> &&promise);
void get_group_call(GroupCallId group_call_id, Promise<td_api::object_ptr<td_api::groupCall>> &&promise);
@ -65,7 +73,7 @@ class GroupCallManager final : public Actor {
Promise<td_api::object_ptr<td_api::groupCall>> &&promise);
void get_group_call_streams(GroupCallId group_call_id,
Promise<td_api::object_ptr<td_api::groupCallStreams>> &&promise);
Promise<td_api::object_ptr<td_api::videoChatStreams>> &&promise);
void get_group_call_stream_segment(GroupCallId group_call_id, int64 time_offset, int32 scale, int32 channel_id,
td_api::object_ptr<td_api::GroupCallVideoQuality> quality,
@ -73,10 +81,22 @@ class GroupCallManager final : public Actor {
void start_scheduled_group_call(GroupCallId group_call_id, Promise<Unit> &&promise);
void join_group_call(GroupCallId group_call_id, DialogId as_dialog_id, int32 audio_source, string &&payload,
bool is_muted, bool is_my_video_enabled, const string &invite_hash, int64 key_fingerprint,
void join_group_call(td_api::object_ptr<td_api::InputGroupCall> &&api_input_group_call,
td_api::object_ptr<td_api::groupCallJoinParameters> &&join_parameters,
Promise<td_api::object_ptr<td_api::groupCallInfo>> &&promise);
void join_video_chat(GroupCallId group_call_id, DialogId as_dialog_id,
td_api::object_ptr<td_api::groupCallJoinParameters> &&join_parameters, const string &invite_hash,
Promise<string> &&promise);
void encrypt_group_call_data(GroupCallId group_call_id,
td_api::object_ptr<td_api::GroupCallDataChannel> &&data_channel, string &&data,
int32 unencrypted_prefix_size, Promise<string> &&promise);
void decrypt_group_call_data(GroupCallId group_call_id, DialogId participant_dialog_id,
td_api::object_ptr<td_api::GroupCallDataChannel> &&data_channel, string &&data,
Promise<string> &&promise);
void start_group_call_screen_sharing(GroupCallId group_call_id, int32 audio_source, string &&payload,
Promise<string> &&promise);
@ -100,6 +120,17 @@ class GroupCallManager final : public Actor {
void revoke_group_call_invite_link(GroupCallId group_call_id, Promise<Unit> &&promise);
void invite_group_call_participant(GroupCallId group_call_id, UserId user_id, bool is_video,
Promise<td_api::object_ptr<td_api::InviteGroupCallParticipantResult>> &&promise);
void decline_group_call_invitation(MessageFullId message_full_id, Promise<Unit> &&promise);
void delete_group_call_participants(GroupCallId group_call_id, const vector<int64> &user_ids, bool is_ban,
Promise<Unit> &&promise);
void do_delete_group_call_participants(InputGroupCallId input_group_call_id, vector<int64> user_ids, bool is_ban,
Promise<Unit> &&promise);
void invite_group_call_participants(GroupCallId group_call_id, vector<UserId> &&user_ids, Promise<Unit> &&promise);
void get_group_call_invite_link(GroupCallId group_call_id, bool can_self_unmute, Promise<string> &&promise);
@ -119,6 +150,9 @@ class GroupCallManager final : public Actor {
void toggle_group_call_participant_is_hand_raised(GroupCallId group_call_id, DialogId dialog_id, bool is_hand_raised,
Promise<Unit> &&promise);
void get_group_call_participants(td_api::object_ptr<td_api::InputGroupCall> input_group_call, int32 limit,
Promise<td_api::object_ptr<td_api::groupCallParticipants>> &&promise);
void load_group_call_participants(GroupCallId group_call_id, int32 limit, Promise<Unit> &&promise);
void leave_group_call(GroupCallId group_call_id, Promise<Unit> &&promise);
@ -129,6 +163,9 @@ class GroupCallManager final : public Actor {
void on_update_group_call_connection(string &&connection_params);
void on_update_group_call_chain_blocks(InputGroupCallId input_group_call_id, int32 sub_chain_id,
vector<string> &&blocks, int32 next_offset);
void on_update_group_call(tl_object_ptr<telegram_api::GroupCall> group_call_ptr, DialogId dialog_id);
void on_user_speaking_in_group_call(GroupCallId group_call_id, DialogId dialog_id, bool is_muted_by_admin, int32 date,
@ -142,22 +179,29 @@ class GroupCallManager final : public Actor {
vector<tl_object_ptr<telegram_api::groupCallParticipant>> &&participants,
int32 version, bool is_recursive = false);
void process_join_group_call_response(InputGroupCallId input_group_call_id, uint64 generation,
void process_join_video_chat_response(InputGroupCallId input_group_call_id, uint64 generation,
tl_object_ptr<telegram_api::Updates> &&updates, Promise<Unit> &&promise);
void process_join_group_call_presentation_response(InputGroupCallId input_group_call_id, uint64 generation,
tl_object_ptr<telegram_api::Updates> &&updates, Status status);
void register_group_call(MessageFullId message_full_id, const char *source);
void unregister_group_call(MessageFullId message_full_id, const char *source);
private:
struct GroupCall;
struct GroupCallParticipants;
struct GroupCallRecentSpeakers;
struct PendingJoinRequest;
struct PendingJoinPresentationRequest;
static constexpr int32 RECENT_SPEAKER_TIMEOUT = 60 * 60;
static constexpr int32 UPDATE_GROUP_CALL_PARTICIPANT_ORDER_TIMEOUT = 10;
static constexpr int32 CHECK_GROUP_CALL_IS_JOINED_TIMEOUT = 10;
static constexpr size_t MAX_TITLE_LENGTH = 64; // server side limit for group call/call record title length
static constexpr int32 GROUP_CALL_BLOCK_POLL_TIMEOUT = 10;
static constexpr size_t MAX_TITLE_LENGTH = 64; // server-side limit for group call/call record title length
static constexpr size_t BLOCK_POLL_COUNT = 100;
void tear_down() final;
@ -182,6 +226,16 @@ class GroupCallManager final : public Actor {
void on_sync_participants_timeout(GroupCallId group_call_id);
static void on_update_group_call_timeout_callback(void *group_call_manager_ptr, int64 call_id);
void on_update_group_call_timeout(int64 call_id);
static void on_poll_group_call_blocks_timeout_callback(void *group_call_manager_ptr, int64 call_id);
void on_poll_group_call_blocks_timeout(int64 call_id);
void on_update_group_call_message(int64 call_id);
GroupCallId get_next_group_call_id(InputGroupCallId input_group_call_id);
GroupCall *add_group_call(InputGroupCallId input_group_call_id, DialogId dialog_id);
@ -193,20 +247,22 @@ class GroupCallManager final : public Actor {
Status can_manage_group_calls(DialogId dialog_id) const;
bool can_manage_group_call(InputGroupCallId input_group_call_id) const;
bool can_manage_group_call(InputGroupCallId input_group_call_id, bool allow_owned) const;
bool can_manage_group_call(const GroupCall *group_call, bool allow_owned) const;
bool get_group_call_can_self_unmute(InputGroupCallId input_group_call_id) const;
bool get_group_call_joined_date_asc(InputGroupCallId input_group_call_id) const;
void on_voice_chat_created(DialogId dialog_id, InputGroupCallId input_group_call_id, Promise<GroupCallId> &&promise);
void on_video_chat_created(DialogId dialog_id, InputGroupCallId input_group_call_id, Promise<GroupCallId> &&promise);
void finish_get_group_call(InputGroupCallId input_group_call_id,
Result<tl_object_ptr<telegram_api::phone_groupCall>> &&result);
void finish_get_group_call_streams(InputGroupCallId input_group_call_id, int32 audio_source,
Result<td_api::object_ptr<td_api::groupCallStreams>> &&result,
Promise<td_api::object_ptr<td_api::groupCallStreams>> &&promise);
Result<td_api::object_ptr<td_api::videoChatStreams>> &&result,
Promise<td_api::object_ptr<td_api::videoChatStreams>> &&promise);
void finish_get_group_call_stream_segment(InputGroupCallId input_group_call_id, int32 audio_source,
Result<string> &&result, Promise<string> &&promise);
@ -214,6 +270,13 @@ class GroupCallManager final : public Actor {
void finish_check_group_call_is_joined(InputGroupCallId input_group_call_id, int32 audio_source,
Result<Unit> &&result);
void sync_conference_call_participants(InputGroupCallId input_group_call_id,
vector<int64> &&blockchain_participant_ids);
void on_sync_conference_call_participants(InputGroupCallId input_group_call_id,
vector<int64> &&blockchain_participant_ids,
vector<int64> &&server_participant_ids);
static const string &get_group_call_title(const GroupCall *group_call);
static bool get_group_call_is_joined(const GroupCall *group_call);
@ -240,18 +303,26 @@ class GroupCallManager final : public Actor {
bool need_group_call_participants(InputGroupCallId input_group_call_id) const;
static bool need_group_call_participants(const GroupCall *group_call);
bool need_group_call_participants(InputGroupCallId input_group_call_id, const GroupCall *group_call) const;
bool process_pending_group_call_participant_updates(InputGroupCallId input_group_call_id);
bool is_my_audio_source(InputGroupCallId input_group_call_id, const GroupCall *group_call, int32 audio_source) const;
void on_create_group_call(int32 random_id, Result<telegram_api::object_ptr<telegram_api::Updates>> &&r_updates,
Promise<td_api::object_ptr<td_api::groupCallInfo>> &&promise);
void on_get_group_call_join_payload(InputGroupCallId input_group_call_id, string &&payload);
void on_create_group_call_finished(InputGroupCallId input_group_call_id, bool is_join,
Promise<td_api::object_ptr<td_api::groupCallInfo>> &&promise);
void sync_group_call_participants(InputGroupCallId input_group_call_id);
void on_sync_group_call_participants(InputGroupCallId input_group_call_id,
Result<tl_object_ptr<telegram_api::phone_groupCall>> &&result);
static GroupCallParticipantOrder get_real_participant_order(bool can_self_unmute,
static GroupCallParticipantOrder get_real_participant_order(bool my_can_self_unmute,
const GroupCallParticipant &participant,
const GroupCallParticipants *participants);
@ -262,12 +333,12 @@ class GroupCallManager final : public Actor {
int32 version, const string &offset, bool is_load, bool is_sync);
static bool update_group_call_participant_can_be_muted(bool can_manage, const GroupCallParticipants *participants,
GroupCallParticipant &participant);
GroupCallParticipant &participant, bool force_is_admin);
void update_group_call_participants_can_be_muted(InputGroupCallId input_group_call_id, bool can_manage,
GroupCallParticipants *participants);
GroupCallParticipants *participants, bool force_is_admin);
void update_group_call_participants_order(InputGroupCallId input_group_call_id, bool can_self_unmute,
void update_group_call_participants_order(InputGroupCallId input_group_call_id, bool my_can_self_unmute,
GroupCallParticipants *participants, const char *source);
// returns participant_count_diff and video_participant_count_diff
@ -282,6 +353,24 @@ class GroupCallManager final : public Actor {
void finish_load_group_call_administrators(InputGroupCallId input_group_call_id, Result<DialogParticipants> &&result);
void try_join_group_call(InputGroupCall &&input_group_call, GroupCallJoinParameters &&join_parameters,
Promise<td_api::object_ptr<td_api::groupCallInfo>> &&promise);
void do_join_group_call(InputGroupCall &&input_group_call, GroupCallJoinParameters &&join_parameters,
telegram_api::object_ptr<telegram_api::Updates> updates,
Promise<td_api::object_ptr<td_api::groupCallInfo>> &&promise);
void on_join_group_call(InputGroupCall &&input_group_call, GroupCallJoinParameters &&join_parameters,
const tde2e_api::PrivateKeyId &private_key_id, const tde2e_api::PublicKeyId &public_key_id,
Result<telegram_api::object_ptr<telegram_api::Updates>> &&r_updates,
Promise<td_api::object_ptr<td_api::groupCallInfo>> &&promise);
void process_join_group_call_response(InputGroupCallId input_group_call_id, bool is_join, int32 audio_source,
const tde2e_api::PrivateKeyId &private_key_id,
const tde2e_api::PublicKeyId &public_key_id,
telegram_api::object_ptr<telegram_api::Updates> &&updates,
Promise<td_api::object_ptr<td_api::groupCallInfo>> &&promise);
int32 cancel_join_group_call_request(InputGroupCallId input_group_call_id, GroupCall *group_call);
int32 cancel_join_group_call_presentation_request(InputGroupCallId input_group_call_id);
@ -375,6 +464,20 @@ class GroupCallManager final : public Actor {
void update_group_call_dialog(const GroupCall *group_call, const char *source, bool force);
void on_call_state_updated(GroupCall *group_call, const char *source);
void set_blockchain_participant_ids(GroupCall *group_call, vector<int64> participant_ids);
static vector<string> get_emojis_fingerprint(const GroupCall *group_call);
void on_call_verification_state_updated(GroupCall *group_call);
void send_outbound_group_call_blockchain_messages(GroupCall *group_call);
void poll_group_call_blocks(GroupCall *group_call, int32 sub_chain_id);
void on_poll_group_call_blocks(InputGroupCallId input_group_call_id, int32 sub_chain_id);
vector<td_api::object_ptr<td_api::groupCallRecentSpeaker>> get_recent_speakers(const GroupCall *group_call,
bool for_update);
@ -404,8 +507,26 @@ class GroupCallManager final : public Actor {
FlatHashMap<InputGroupCallId, unique_ptr<GroupCall>, InputGroupCallIdHash> group_calls_;
struct BeingCreatedCall {
bool is_join_ = false;
tde2e_api::PrivateKeyId private_key_id_{};
tde2e_api::PublicKeyId public_key_id_{};
int32 audio_source_ = 0;
};
FlatHashMap<int32, BeingCreatedCall> being_created_group_calls_;
FlatHashMap<InputGroupCallId, string, InputGroupCallIdHash> group_call_join_payloads_;
struct BeingJoinedCallBlocks {
bool is_inited_[2];
vector<string> blocks_[2];
int32 next_offset_[2];
};
FlatHashMap<InputGroupCallId, BeingJoinedCallBlocks, InputGroupCallIdHash> being_joined_call_blocks_;
string pending_group_call_join_params_;
FlatHashMap<InputGroupCall, InputGroupCallId, InputGroupCallHash> real_input_group_call_ids_;
FlatHashMap<InputGroupCallId, unique_ptr<GroupCallParticipants>, InputGroupCallIdHash> group_call_participants_;
FlatHashMap<DialogId, vector<InputGroupCallId>, DialogIdHash> participant_id_to_group_call_id_;
@ -415,10 +536,14 @@ class GroupCallManager final : public Actor {
load_group_call_queries_;
FlatHashMap<InputGroupCallId, unique_ptr<PendingJoinRequest>, InputGroupCallIdHash> pending_join_requests_;
FlatHashMap<InputGroupCallId, unique_ptr<PendingJoinRequest>, InputGroupCallIdHash>
FlatHashMap<InputGroupCallId, unique_ptr<PendingJoinPresentationRequest>, InputGroupCallIdHash>
pending_join_presentation_requests_;
uint64 join_group_request_generation_ = 0;
FlatHashMap<MessageFullId, int64, MessageFullIdHash> group_call_messages_;
FlatHashMap<int64, MessageFullId> group_call_message_full_ids_;
int64 current_call_id_ = 0;
uint64 toggle_recording_generation_ = 0;
uint64 toggle_is_muted_generation_ = 0;
@ -432,6 +557,8 @@ class GroupCallManager final : public Actor {
MultiTimeout pending_send_speaking_action_timeout_{"PendingSendSpeakingActionTimeout"};
MultiTimeout recent_speaker_update_timeout_{"RecentSpeakerUpdateTimeout"};
MultiTimeout sync_participants_timeout_{"SyncParticipantsTimeout"};
MultiTimeout update_group_call_timeout_{"UpdateGroupCallTimeout"};
MultiTimeout poll_group_call_blocks_timeout_{"PollGroupCallBlocksTimeout"};
};
} // namespace td

View file

@ -78,9 +78,9 @@ struct GroupCallParticipant {
bool set_pending_is_muted(bool is_muted, bool can_manage, bool is_admin);
GroupCallParticipantOrder get_real_order(bool can_self_unmute, bool joined_date_asc) const;
GroupCallParticipantOrder get_real_order(bool my_can_self_unmute, bool joined_date_asc) const;
GroupCallParticipantOrder get_server_order(bool can_self_unmute, bool joined_date_asc) const;
GroupCallParticipantOrder get_server_order(bool my_can_self_unmute, bool joined_date_asc) const;
bool is_valid() const {
return dialog_id.is_valid();

View file

@ -95,7 +95,7 @@ class InlineQueriesManager final : public Actor {
private:
static constexpr size_t MAX_RECENT_INLINE_BOTS = 20; // some reasonable value
static constexpr int32 INLINE_QUERY_DELAY_MS = 400; // server side limit
static constexpr int32 INLINE_QUERY_DELAY_MS = 400; // server-side limit
Result<tl_object_ptr<telegram_api::InputBotInlineResult>> get_input_bot_inline_result(
td_api::object_ptr<td_api::InputInlineQueryResult> &&result, bool *is_gallery, bool *force_vertical) const;

View file

@ -0,0 +1,54 @@
//
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2025
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#pragma once
#include "td/telegram/ServerMessageId.h"
#include "td/telegram/td_api.h"
#include "td/telegram/telegram_api.h"
#include "td/utils/common.h"
#include "td/utils/HashTableUtils.h"
#include "td/utils/Status.h"
#include "td/utils/StringBuilder.h"
namespace td {
class Td;
class InputGroupCall {
string slug_;
ServerMessageId server_message_id_;
public:
static Result<InputGroupCall> get_input_group_call(Td *td,
td_api::object_ptr<td_api::InputGroupCall> &&input_group_call);
bool operator==(const InputGroupCall &other) const {
return slug_ == other.slug_ && server_message_id_ == other.server_message_id_;
}
bool operator!=(const InputGroupCall &other) const {
return !(*this == other);
}
uint32 get_hash() const {
return slug_.empty() ? server_message_id_.get() : Hash<string>()(slug_);
}
telegram_api::object_ptr<telegram_api::InputGroupCall> get_input_group_call() const;
friend StringBuilder &operator<<(StringBuilder &string_builder, InputGroupCall input_group_call);
};
struct InputGroupCallHash {
uint32 operator()(InputGroupCall input_group_call) const {
return input_group_call.get_hash();
}
};
} // namespace td

View file

@ -21,7 +21,7 @@ class InputGroupCallId {
public:
InputGroupCallId() = default;
explicit InputGroupCallId(const tl_object_ptr<telegram_api::inputGroupCall> &input_group_call);
explicit InputGroupCallId(const telegram_api::object_ptr<telegram_api::InputGroupCall> &input_group_call);
InputGroupCallId(int64 group_call_id, int64 access_hash) : group_call_id(group_call_id), access_hash(access_hash) {
}
@ -46,7 +46,7 @@ class InputGroupCallId {
return Hash<int64>()(group_call_id);
}
tl_object_ptr<telegram_api::inputGroupCall> get_input_group_call() const;
telegram_api::object_ptr<telegram_api::inputGroupCall> get_input_group_call() const;
template <class StorerT>
void store(StorerT &storer) const {

View file

@ -96,6 +96,10 @@ class LinkManager final : public Actor {
static string get_dialog_invite_link(Slice invite_hash, bool is_internal);
static string get_group_call_invite_link_slug(Slice invite_link);
static string get_group_call_invite_link(Slice slug, bool is_internal);
static string get_instant_view_link_url(Slice link);
static string get_instant_view_link_rhash(Slice link);
@ -140,6 +144,7 @@ class LinkManager final : public Actor {
class InternalLinkDialogReferralProgram;
class InternalLinkEditProfileSettings;
class InternalLinkGame;
class InternalLinkGroupCall;
class InternalLinkInstantView;
class InternalLinkInvoice;
class InternalLinkLanguage;
@ -147,6 +152,7 @@ class LinkManager final : public Actor {
class InternalLinkMainWebApp;
class InternalLinkMessage;
class InternalLinkMessageDraft;
class InternalLinkMyStars;
class InternalLinkPassportDataRequest;
class InternalLinkPremiumFeatures;
class InternalLinkPremiumGift;
@ -166,7 +172,7 @@ class LinkManager final : public Actor {
class InternalLinkUpgradedGift;
class InternalLinkUserPhoneNumber;
class InternalLinkUserToken;
class InternalLinkVoiceChat;
class InternalLinkVideoChat;
class InternalLinkWebApp;
enum class LinkType : int32 { External, TMe, Tg, Telegraph };

View file

@ -326,6 +326,8 @@ bool update_message_content_extended_media(
bool need_poll_message_content_extended_media(const MessageContent *content);
bool need_poll_conference_call_message_content(const MessageContent *content);
void set_message_content_video_start_timestamp(MessageContent *content, int32 start_timestamp);
void get_message_content_animated_emoji_click_sticker(const MessageContent *content, MessageFullId message_full_id,

View file

@ -88,7 +88,8 @@ enum class MessageContentType : int32 {
StarGift,
StarGiftUnique,
PaidMessagesRefunded,
PaidMessagesPrice
PaidMessagesPrice,
ConferenceCall
};
// increase MessageUnsupported::CURRENT_VERSION each time a new message content type is added

View file

@ -126,14 +126,15 @@ class MessagesManager final : public Actor {
static constexpr int32 SEND_MESSAGE_FLAG_DISABLE_WEB_PAGE_PREVIEW = 1 << 1;
static constexpr int32 SEND_MESSAGE_FLAG_HAS_REPLY_MARKUP = 1 << 2;
static constexpr int32 SEND_MESSAGE_FLAG_HAS_ENTITIES = 1 << 3;
// static constexpr int32 SEND_MESSAGE_FLAG_IS_POST = 1 << 4;
static constexpr int32 SEND_MESSAGE_FLAG_DISABLE_NOTIFICATION = 1 << 5;
static constexpr int32 SEND_MESSAGE_FLAG_FROM_BACKGROUND = 1 << 6;
static constexpr int32 SEND_MESSAGE_FLAG_CLEAR_DRAFT = 1 << 7;
static constexpr int32 SEND_MESSAGE_FLAG_WITH_MY_SCORE = 1 << 8;
static constexpr int32 SEND_MESSAGE_FLAG_IS_FROM_THREAD = 1 << 9;
static constexpr int32 SEND_MESSAGE_FLAG_HAS_SCHEDULE_DATE = 1 << 10;
static constexpr int32 SEND_MESSAGE_FLAG_HAS_MESSAGE = 1 << 11;
static constexpr int32 SEND_MESSAGE_FLAG_HIDE_VIA = 1 << 11;
static constexpr int32 SEND_MESSAGE_FLAG_DROP_AUTHOR = 1 << 11;
static constexpr int32 SEND_MESSAGE_FLAG_DROP_MEDIA_CAPTIONS = 1 << 12;
static constexpr int32 SEND_MESSAGE_FLAG_HAS_SEND_AS = 1 << 13;
static constexpr int32 SEND_MESSAGE_FLAG_NOFORWARDS = 1 << 14;
static constexpr int32 SEND_MESSAGE_FLAG_UPDATE_STICKER_SETS_ORDER = 1 << 15;
@ -246,9 +247,9 @@ class MessagesManager final : public Actor {
int32 total_count, vector<tl_object_ptr<telegram_api::Message>> &&messages,
Promise<Unit> &&promise);
bool on_update_message_id(int64 random_id, MessageId new_message_id, const char *source);
void wait_message_add(MessageFullId message_full_id, Promise<Unit> &&promise);
void on_update_message_video_published(MessageFullId message_full_id);
bool on_update_message_id(int64 random_id, MessageId new_message_id, const char *source);
void on_update_dialog_draft_message(DialogId dialog_id, MessageId top_thread_message_id,
tl_object_ptr<telegram_api::DraftMessage> &&draft_message, bool force = false);
@ -920,6 +921,8 @@ class MessagesManager final : public Actor {
int64 get_message_random_id(MessageFullId message_full_id);
bool need_poll_group_call_message(MessageFullId message_full_id);
void finish_gift_upgrade(MessageFullId message_full_id,
Promise<td_api::object_ptr<td_api::upgradeGiftResult>> &&promise);
@ -931,6 +934,8 @@ class MessagesManager final : public Actor {
};
Result<InvoiceMessageInfo> get_invoice_message_info(MessageFullId message_full_id);
Result<ServerMessageId> get_group_call_message_id(MessageFullId message_full_id);
Result<ServerMessageId> get_payment_successful_message_id(MessageFullId message_full_id);
Result<ServerMessageId> get_giveaway_message_id(MessageFullId message_full_id);
@ -1556,13 +1561,13 @@ class MessagesManager final : public Actor {
class SetDialogFolderIdOnServerLogEvent;
class UpdateDialogNotificationSettingsOnServerLogEvent;
static constexpr size_t MAX_GROUPED_MESSAGES = 10; // server side limit
static constexpr int32 MAX_GET_DIALOGS = 100; // server side limit
static constexpr int32 MAX_GET_HISTORY = 100; // server side limit
static constexpr int32 MAX_SEARCH_MESSAGES = 100; // server side limit
static constexpr size_t MAX_GROUPED_MESSAGES = 10; // server-side limit
static constexpr int32 MAX_GET_DIALOGS = 100; // server-side limit
static constexpr int32 MAX_GET_HISTORY = 100; // server-side limit
static constexpr int32 MAX_SEARCH_MESSAGES = 100; // server-side limit
static constexpr int32 MIN_CHANNEL_DIFFERENCE = 1;
static constexpr int32 MAX_CHANNEL_DIFFERENCE = 100;
static constexpr int32 MAX_BOT_CHANNEL_DIFFERENCE = 100000; // server side limit
static constexpr int32 MAX_BOT_CHANNEL_DIFFERENCE = 100000; // server-side limit
static constexpr size_t MIN_DELETED_ASYNCHRONOUSLY_MESSAGES = 2;
static constexpr size_t MAX_UNLOADED_MESSAGES = 5000;
@ -1994,8 +1999,12 @@ class MessagesManager final : public Actor {
bool update_message_fact_check(const Dialog *d, Message *m, unique_ptr<FactCheck> &&fact_check, bool need_save);
void on_unread_message_mention_removed(Dialog *d, const Message *m, const char *source);
bool update_message_contains_unread_mention(Dialog *d, Message *m, bool contains_unread_mention, const char *source);
void on_unread_message_reaction_removed(Dialog *d, const Message *m, const char *source);
bool remove_message_unread_reactions(Dialog *d, Message *m, const char *source);
void read_message_content_from_updates(MessageId message_id, int32 read_date);
@ -2287,8 +2296,6 @@ class MessagesManager final : public Actor {
void send_update_message_send_succeeded(Dialog *d, MessageId old_message_id, const Message *m,
bool *need_update_dialog_pos);
void send_update_video_published(MessageFullId message_full_id);
void send_update_message_content(const Dialog *d, Message *m, bool is_message_in_dialog, const char *source);
void send_update_message_content_impl(DialogId dialog_id, const Message *m, const char *source) const;
@ -3122,7 +3129,7 @@ class MessagesManager final : public Actor {
update_scheduled_message_ids_; // new_message_id -> temporary_id
FlatHashMap<MessageFullId, MessageId, MessageFullIdHash> messages_to_restore_; // new_message_id -> temporary_id
FlatHashSet<MessageFullId, MessageFullIdHash> published_video_message_full_ids_;
FlatHashMap<MessageFullId, vector<Promise<Unit>>, MessageFullIdHash> awaited_message_full_ids_;
const char *debug_add_message_to_dialog_fail_reason_ = "";

View file

@ -75,7 +75,7 @@ bool operator!=(const OrderInfo &lhs, const OrderInfo &rhs);
StringBuilder &operator<<(StringBuilder &string_builder, const OrderInfo &order_info);
unique_ptr<OrderInfo> get_order_info(tl_object_ptr<telegram_api::paymentRequestedInfo> order_info);
unique_ptr<OrderInfo> get_order_info(telegram_api::object_ptr<telegram_api::paymentRequestedInfo> order_info);
tl_object_ptr<td_api::orderInfo> get_order_info_object(const unique_ptr<OrderInfo> &order_info);

View file

@ -144,7 +144,7 @@ class PollManager final : public Actor {
bool was_invalidated_ = false; // the list needs to be invalidated when voters are changed
};
static constexpr int32 MAX_GET_POLL_VOTERS = 50; // server side limit
static constexpr int32 MAX_GET_POLL_VOTERS = 50; // server-side limit
static constexpr int32 UNLOAD_POLL_DELAY = 600; // some reasonable value
class SetPollAnswerLogEvent;

View file

@ -110,7 +110,7 @@ class QuickReplyManager final : public Actor {
void get_current_state(vector<td_api::object_ptr<td_api::Update>> &updates) const;
private:
static constexpr size_t MAX_GROUPED_MESSAGES = 10; // server side limit
static constexpr size_t MAX_GROUPED_MESSAGES = 10; // server-side limit
struct QuickReplyMessage {
QuickReplyMessage() = default;

View file

@ -94,8 +94,12 @@ class Requests {
Promise<string> create_text_request_promise(uint64 id);
Promise<string> create_data_request_promise(uint64 id);
Promise<string> create_http_url_request_promise(uint64 id);
Promise<int32> create_count_request_promise(uint64 id);
template <class T>
void on_request(uint64 id, const T &) = delete;
@ -627,11 +631,11 @@ class Requests {
void on_request(uint64 id, const td_api::getStory &request);
void on_request(uint64 id, const td_api::getChatsToSendStories &request);
void on_request(uint64 id, const td_api::getChatsToPostStories &request);
void on_request(uint64 id, const td_api::canSendStory &request);
void on_request(uint64 id, const td_api::canPostStory &request);
void on_request(uint64 id, td_api::sendStory &request);
void on_request(uint64 id, td_api::postStory &request);
void on_request(uint64 id, td_api::editStory &request);
@ -711,7 +715,7 @@ class Requests {
void on_request(uint64 id, td_api::sendCallSignalingData &request);
void on_request(uint64 id, const td_api::discardCall &request);
void on_request(uint64 id, td_api::discardCall &request);
void on_request(uint64 id, td_api::sendCallRating &request);
@ -725,7 +729,7 @@ class Requests {
void on_request(uint64 id, td_api::createVideoChat &request);
void on_request(uint64 id, const td_api::createGroupCall &request);
void on_request(uint64 id, td_api::createGroupCall &request);
void on_request(uint64 id, const td_api::getVideoChatRtmpUrl &request);
@ -733,25 +737,33 @@ class Requests {
void on_request(uint64 id, const td_api::getGroupCall &request);
void on_request(uint64 id, const td_api::startScheduledGroupCall &request);
void on_request(uint64 id, const td_api::startScheduledVideoChat &request);
void on_request(uint64 id, const td_api::toggleGroupCallEnabledStartNotification &request);
void on_request(uint64 id, const td_api::toggleVideoChatEnabledStartNotification &request);
void on_request(uint64 id, td_api::joinGroupCall &request);
void on_request(uint64 id, td_api::joinVideoChat &request);
void on_request(uint64 id, td_api::startGroupCallScreenSharing &request);
void on_request(uint64 id, const td_api::endGroupCallScreenSharing &request);
void on_request(uint64 id, td_api::setGroupCallTitle &request);
void on_request(uint64 id, td_api::setVideoChatTitle &request);
void on_request(uint64 id, const td_api::toggleGroupCallMuteNewParticipants &request);
void on_request(uint64 id, const td_api::toggleVideoChatMuteNewParticipants &request);
void on_request(uint64 id, const td_api::revokeGroupCallInviteLink &request);
void on_request(uint64 id, const td_api::inviteGroupCallParticipants &request);
void on_request(uint64 id, const td_api::inviteGroupCallParticipant &request);
void on_request(uint64 id, const td_api::getGroupCallInviteLink &request);
void on_request(uint64 id, const td_api::declineGroupCallInvitation &request);
void on_request(uint64 id, const td_api::banGroupCallParticipants &request);
void on_request(uint64 id, const td_api::inviteVideoChatParticipants &request);
void on_request(uint64 id, const td_api::getVideoChatInviteLink &request);
void on_request(uint64 id, td_api::startGroupCallRecording &request);
@ -771,15 +783,21 @@ class Requests {
void on_request(uint64 id, const td_api::toggleGroupCallParticipantIsHandRaised &request);
void on_request(uint64 id, td_api::getGroupCallParticipants &request);
void on_request(uint64 id, const td_api::loadGroupCallParticipants &request);
void on_request(uint64 id, const td_api::leaveGroupCall &request);
void on_request(uint64 id, const td_api::endGroupCall &request);
void on_request(uint64 id, const td_api::getGroupCallStreams &request);
void on_request(uint64 id, const td_api::getVideoChatStreams &request);
void on_request(uint64 id, td_api::getGroupCallStreamSegment &request);
void on_request(uint64 id, td_api::getVideoChatStreamSegment &request);
void on_request(uint64 id, td_api::encryptGroupCallData &request);
void on_request(uint64 id, td_api::decryptGroupCallData &request);
void on_request(uint64 id, const td_api::upgradeBasicGroupChatToSupergroupChat &request);
@ -1245,6 +1263,8 @@ class Requests {
void on_request(uint64 id, const td_api::toggleSupergroupCanHaveSponsoredMessages &request);
void on_request(uint64 id, const td_api::toggleSupergroupHasAutomaticTranslation &request);
void on_request(uint64 id, const td_api::toggleSupergroupHasHiddenMembers &request);
void on_request(uint64 id, const td_api::toggleSupergroupHasAggressiveAntiSpamEnabled &request);
@ -1451,7 +1471,7 @@ class Requests {
void on_request(uint64 id, td_api::stopPoll &request);
void on_request(uint64 id, const td_api::hideSuggestedAction &request);
void on_request(uint64 id, td_api::hideSuggestedAction &request);
void on_request(uint64 id, const td_api::hideContactCloseBirthdays &request);
@ -1539,6 +1559,8 @@ class Requests {
void on_request(uint64 id, td_api::transferGift &request);
void on_request(uint64 id, td_api::sendResoldGift &request);
void on_request(uint64 id, td_api::getReceivedGifts &request);
void on_request(uint64 id, const td_api::getReceivedGift &request);
@ -1547,6 +1569,10 @@ class Requests {
void on_request(uint64 id, const td_api::getUpgradedGiftWithdrawalUrl &request);
void on_request(uint64 id, const td_api::setGiftResalePrice &request);
void on_request(uint64 id, td_api::searchGiftsForResale &request);
void on_request(uint64 id, td_api::createInvoiceLink &request);
void on_request(uint64 id, td_api::refundStarPayment &request);

View file

@ -74,7 +74,7 @@ class SavedMessagesManager final : public Actor {
void get_current_state(vector<td_api::object_ptr<td_api::Update>> &updates) const;
private:
static constexpr int32 MAX_GET_HISTORY = 100; // server side limit
static constexpr int32 MAX_GET_HISTORY = 100; // server-side limit
static constexpr int64 MIN_PINNED_TOPIC_ORDER = static_cast<int64>(2147000000) << 32;

View file

@ -47,15 +47,17 @@ class SendCodeHelper {
telegram_api::object_ptr<telegram_api::emailVerifyPurposeLoginSetup> get_email_verify_purpose_login_setup() const;
Slice phone_number() const {
const string &get_phone_number() const {
return phone_number_;
}
Slice phone_code_hash() const {
const string &get_phone_code_hash() const {
return phone_code_hash_;
}
template <class StorerT>
void store(StorerT &storer) const;
template <class ParserT>
void parse(ParserT &parser);

View file

@ -47,6 +47,7 @@ class StarGift {
int32 num_ = 0;
int32 unique_availability_issued_ = 0;
int32 unique_availability_total_ = 0;
int64 resale_star_count_ = 0;
friend bool operator==(const StarGift &lhs, const StarGift &rhs);
@ -84,6 +85,8 @@ class StarGift {
td_api::object_ptr<td_api::upgradedGift> get_upgraded_gift_object(Td *td) const;
td_api::object_ptr<td_api::giftForResale> get_gift_for_resale_object(Td *td) const;
td_api::object_ptr<td_api::SentGift> get_sent_gift_object(Td *td) const;
void add_dependencies(Dependencies &dependencies) const;

View file

@ -9,6 +9,7 @@
#include "td/telegram/DialogId.h"
#include "td/telegram/files/FileId.h"
#include "td/telegram/MessageEntity.h"
#include "td/telegram/StarGiftAttributeId.h"
#include "td/telegram/td_api.h"
#include "td/telegram/telegram_api.h"
@ -42,6 +43,8 @@ class StarGiftAttributeSticker {
td_api::object_ptr<td_api::upgradedGiftSymbol> get_upgraded_gift_symbol_object(const Td *td) const;
StarGiftAttributeId get_id(Td *td, bool is_model) const;
template <class StorerT>
void store(StorerT &storer) const;
@ -57,6 +60,7 @@ inline bool operator!=(const StarGiftAttributeSticker &lhs, const StarGiftAttrib
class StarGiftAttributeBackdrop {
string name_;
int32 id_ = 0;
int32 center_color_ = 0;
int32 edge_color_ = 0;
int32 pattern_color_ = 0;
@ -81,6 +85,8 @@ class StarGiftAttributeBackdrop {
td_api::object_ptr<td_api::upgradedGiftBackdrop> get_upgraded_gift_backdrop_object() const;
StarGiftAttributeId get_id() const;
template <class StorerT>
void store(StorerT &storer) const;

View file

@ -0,0 +1,71 @@
//
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2025
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#pragma once
#include "td/telegram/td_api.h"
#include "td/telegram/telegram_api.h"
#include "td/utils/common.h"
#include "td/utils/HashTableUtils.h"
#include "td/utils/Status.h"
#include "td/utils/StringBuilder.h"
namespace td {
class StarGiftAttributeId {
enum class Type : int32 { None, Model, Pattern, Backdrop };
Type type_ = Type::None;
int64 sticker_id_ = 0;
int32 backdrop_id_ = 0;
StarGiftAttributeId(Type type, int64 sticker_id, int32 backdrop_id);
static Result<StarGiftAttributeId> get_star_gift_attribute_id(
const td_api::object_ptr<td_api::UpgradedGiftAttributeId> &attribute);
telegram_api::object_ptr<telegram_api::StarGiftAttributeId> get_input_star_gift_attribute_id_object() const;
friend struct StarGiftAttributeIdHash;
friend bool operator==(const StarGiftAttributeId &lhs, const StarGiftAttributeId &rhs);
friend StringBuilder &operator<<(StringBuilder &string_builder, const StarGiftAttributeId &attribute_id);
public:
StarGiftAttributeId() = default;
explicit StarGiftAttributeId(telegram_api::object_ptr<telegram_api::StarGiftAttributeId> attribute);
static StarGiftAttributeId model(int64 sticker_id);
static StarGiftAttributeId pattern(int64 sticker_id);
static StarGiftAttributeId backdrop(int32 backdrop_id);
static Result<vector<StarGiftAttributeId>> get_star_gift_attribute_ids(
const vector<td_api::object_ptr<td_api::UpgradedGiftAttributeId>> &attributes);
static vector<telegram_api::object_ptr<telegram_api::StarGiftAttributeId>> get_input_star_gift_attribute_ids_object(
const vector<StarGiftAttributeId> &attributes);
};
struct StarGiftAttributeIdHash {
uint32 operator()(StarGiftAttributeId star_gift_attribute_id) const {
return star_gift_attribute_id.backdrop_id_ ? Hash<int32>()(star_gift_attribute_id.backdrop_id_)
: Hash<int64>()(star_gift_attribute_id.sticker_id_);
}
};
bool operator==(const StarGiftAttributeId &lhs, const StarGiftAttributeId &rhs);
inline bool operator!=(const StarGiftAttributeId &lhs, const StarGiftAttributeId &rhs) {
return !(lhs == rhs);
}
StringBuilder &operator<<(StringBuilder &string_builder, const StarGiftAttributeId &attribute_id);
} // namespace td

View file

@ -18,7 +18,7 @@ namespace td {
class Td;
class StarGiftId {
enum class Type : int32 { Empty, ForUser, ForDialog };
enum class Type : int32 { Empty, ForUser, ForDialog, Slug };
Type type_ = Type::Empty;
ServerMessageId server_message_id_;
@ -26,6 +26,8 @@ class StarGiftId {
DialogId dialog_id_;
int64 saved_id_ = 0;
string slug_;
friend bool operator==(const StarGiftId &lhs, const StarGiftId &rhs);
friend StringBuilder &operator<<(StringBuilder &string_builder, const StarGiftId &star_gift_id);
@ -37,6 +39,8 @@ class StarGiftId {
StarGiftId(DialogId dialog_id, int64 saved_id);
static StarGiftId from_slug(const string &slug);
explicit StarGiftId(const string &star_gift_id);
bool is_empty() const {

View file

@ -38,7 +38,7 @@ class StarGiftManager final : public Actor {
StarGiftManager &operator=(StarGiftManager &&) = delete;
~StarGiftManager() final;
void get_gift_payment_options(Promise<td_api::object_ptr<td_api::gifts>> &&promise);
void get_gift_payment_options(Promise<td_api::object_ptr<td_api::availableGifts>> &&promise);
void on_get_star_gift(const StarGift &star_gift, bool from_server);
@ -61,6 +61,9 @@ class StarGiftManager final : public Actor {
void transfer_gift(BusinessConnectionId business_connection_id, StarGiftId star_gift_id, DialogId receiver_dialog_id,
int64 star_count, Promise<Unit> &&promise);
void send_resold_gift(const string &gift_name, DialogId receiver_dialog_id, int64 star_count,
Promise<Unit> &&promise);
void get_saved_star_gifts(BusinessConnectionId business_connection_id, DialogId dialog_id, bool exclude_unsaved,
bool exclude_saved, bool exclude_unlimited, bool exclude_limited, bool exclude_unique,
bool sort_by_value, const string &offset, int32 limit,
@ -72,6 +75,13 @@ class StarGiftManager final : public Actor {
void get_star_gift_withdrawal_url(StarGiftId star_gift_id, const string &password, Promise<string> &&promise);
void set_star_gift_price(StarGiftId star_gift_id, int64 resale_star_count, Promise<Unit> &&promise);
void get_resale_star_gifts(int64 gift_id, const td_api::object_ptr<td_api::GiftForResaleOrder> &order,
const vector<td_api::object_ptr<td_api::UpgradedGiftAttributeId>> &attributes,
const string &offset, int32 limit,
Promise<td_api::object_ptr<td_api::giftsForResale>> &&promise);
void register_gift(MessageFullId message_full_id, const char *source);
void unregister_gift(MessageFullId message_full_id, const char *source);

View file

@ -75,6 +75,8 @@ class StickersManager final : public Actor {
StickerFormat get_sticker_format(FileId file_id) const;
int64 get_sticker_id(FileId sticker_id) const;
bool is_premium_custom_emoji(CustomEmojiId custom_emoji_id, bool default_result) const;
bool have_sticker(StickerSetId sticker_set_id, int64 sticker_id);
@ -464,9 +466,9 @@ class StickersManager final : public Actor {
static constexpr int32 MAX_FEATURED_STICKER_SET_VIEW_DELAY = 5;
static constexpr int32 OLD_FEATURED_STICKER_SET_SLICE_SIZE = 20;
static constexpr int32 MAX_FOUND_STICKERS = 100; // server side limit
static constexpr size_t MAX_STICKER_SET_TITLE_LENGTH = 64; // server side limit
static constexpr size_t MAX_STICKER_SET_SHORT_NAME_LENGTH = 64; // server side limit
static constexpr int32 MAX_FOUND_STICKERS = 100; // server-side limit
static constexpr size_t MAX_STICKER_SET_TITLE_LENGTH = 64; // server-side limit
static constexpr size_t MAX_STICKER_SET_SHORT_NAME_LENGTH = 64; // server-side limit
static constexpr size_t MAX_GET_CUSTOM_EMOJI_STICKERS = 200; // server-side limit
static constexpr int32 EMOJI_KEYWORDS_UPDATE_DELAY = 3600;
@ -607,8 +609,6 @@ class StickersManager final : public Actor {
class UploadStickerFileCallback;
int64 get_sticker_id(FileId sticker_id) const;
CustomEmojiId get_custom_emoji_id(FileId sticker_id) const;
PhotoFormat get_sticker_set_thumbnail_format(const StickerSet *sticker_set) const;

View file

@ -220,7 +220,7 @@ class StoryManager final : public Actor {
void update_dialogs_to_send_stories(ChannelId channel_id, bool can_send_stories);
void can_send_story(DialogId dialog_id, Promise<td_api::object_ptr<td_api::CanSendStoryResult>> &&promise);
void can_send_story(DialogId dialog_id, Promise<td_api::object_ptr<td_api::CanPostStoryResult>> &&promise);
void send_story(DialogId dialog_id, td_api::object_ptr<td_api::InputStoryContent> &&input_story_content,
td_api::object_ptr<td_api::inputStoryAreas> &&input_areas,
@ -373,7 +373,7 @@ class StoryManager final : public Actor {
td_api::object_ptr<td_api::stories> get_stories_object(int32 total_count, const vector<StoryFullId> &story_full_ids,
const vector<StoryId> &pinned_story_ids) const;
static td_api::object_ptr<td_api::CanSendStoryResult> get_can_send_story_result_object(const Status &error,
static td_api::object_ptr<td_api::CanPostStoryResult> get_can_post_story_result_object(const Status &error,
bool force = false);
FileSourceId get_story_file_source_id(StoryFullId story_full_id);

View file

@ -7,7 +7,9 @@
#pragma once
#include "td/telegram/DialogId.h"
#include "td/telegram/MessageEntity.h"
#include "td/telegram/td_api.h"
#include "td/telegram/telegram_api.h"
#include "td/utils/common.h"
#include "td/utils/HashTableUtils.h"
@ -16,6 +18,8 @@
namespace td {
class UserManager;
struct SuggestedAction {
enum class Type : int32 {
Empty,
@ -32,11 +36,16 @@ struct SuggestedAction {
BirthdaySetup,
PremiumGrace,
StarsSubscriptionLowBalance,
UserpicSetup
UserpicSetup,
Custom
};
Type type_ = Type::Empty;
DialogId dialog_id_;
int32 otherwise_relogin_days_ = 0;
string custom_type_;
FormattedText title_;
FormattedText description_;
string url_;
void init(Type type);
@ -48,9 +57,11 @@ struct SuggestedAction {
explicit SuggestedAction(Slice action_str);
SuggestedAction(const UserManager *user_manager, telegram_api::object_ptr<telegram_api::pendingSuggestion> action);
SuggestedAction(Slice action_str, DialogId dialog_id);
explicit SuggestedAction(const td_api::object_ptr<td_api::SuggestedAction> &suggested_action);
explicit SuggestedAction(td_api::object_ptr<td_api::SuggestedAction> &&suggested_action);
bool is_empty() const {
return type_ == Type::Empty;
@ -58,7 +69,7 @@ struct SuggestedAction {
string get_suggested_action_str() const;
td_api::object_ptr<td_api::SuggestedAction> get_suggested_action_object() const;
td_api::object_ptr<td_api::SuggestedAction> get_suggested_action_object(const UserManager *user_manager) const;
template <class StorerT>
void store(StorerT &storer) const;
@ -74,7 +85,8 @@ struct SuggestedActionHash {
};
inline bool operator==(const SuggestedAction &lhs, const SuggestedAction &rhs) {
return lhs.type_ == rhs.type_ && lhs.dialog_id_ == rhs.dialog_id_;
return lhs.type_ == rhs.type_ && lhs.dialog_id_ == rhs.dialog_id_ && lhs.custom_type_ == rhs.custom_type_ &&
lhs.url_ == rhs.url_;
}
inline bool operator!=(const SuggestedAction &lhs, const SuggestedAction &rhs) {
@ -85,16 +97,24 @@ inline bool operator<(const SuggestedAction &lhs, const SuggestedAction &rhs) {
if (lhs.dialog_id_ != rhs.dialog_id_) {
return lhs.dialog_id_.get() < rhs.dialog_id_.get();
}
return static_cast<int32>(lhs.type_) < static_cast<int32>(rhs.type_);
if (lhs.type_ != rhs.type_) {
return static_cast<int32>(lhs.type_) < static_cast<int32>(rhs.type_);
}
if (lhs.custom_type_ != rhs.custom_type_) {
return lhs.custom_type_ == rhs.custom_type_;
}
return lhs.url_ < rhs.url_;
}
td_api::object_ptr<td_api::updateSuggestedActions> get_update_suggested_actions_object(
const vector<SuggestedAction> &added_actions, const vector<SuggestedAction> &removed_actions, const char *source);
const UserManager *user_manager, const vector<SuggestedAction> &added_actions,
const vector<SuggestedAction> &removed_actions, const char *source);
bool update_suggested_actions(vector<SuggestedAction> &suggested_actions,
bool update_suggested_actions(const UserManager *user_manager, vector<SuggestedAction> &suggested_actions,
vector<SuggestedAction> &&new_suggested_actions);
bool remove_suggested_action(vector<SuggestedAction> &suggested_actions, SuggestedAction suggested_action);
bool remove_suggested_action(const UserManager *user_manager, vector<SuggestedAction> &suggested_actions,
SuggestedAction suggested_action);
void dismiss_suggested_action(SuggestedAction action, Promise<Unit> &&promise);

View file

@ -7,6 +7,7 @@
#pragma once
#include "td/telegram/MessageEntity.h"
#include "td/telegram/MessageFullId.h"
#include "td/telegram/td_api.h"
#include "td/telegram/telegram_api.h"
@ -27,7 +28,8 @@ class TranslationManager final : public Actor {
Promise<td_api::object_ptr<td_api::formattedText>> &&promise);
void translate_text(FormattedText text, bool skip_bot_commands, int32 max_media_timestamp,
const string &to_language_code, Promise<td_api::object_ptr<td_api::formattedText>> &&promise);
MessageFullId message_full_id, const string &to_language_code,
Promise<td_api::object_ptr<td_api::formattedText>> &&promise);
private:
void tear_down() final;

View file

@ -115,7 +115,7 @@ class UpdatesManager final : public Actor {
static vector<std::pair<const telegram_api::Message *, bool>> get_new_messages(
const telegram_api::Updates *updates_ptr);
static vector<InputGroupCallId> get_update_new_group_call_ids(const telegram_api::Updates *updates_ptr);
static InputGroupCallId get_update_new_group_call_id(const telegram_api::Updates *updates_ptr);
void process_updates_users_and_chats(telegram_api::Updates *updates_ptr);
@ -623,6 +623,7 @@ class UpdatesManager final : public Actor {
void on_update(tl_object_ptr<telegram_api::updatePhoneCallSignalingData> update, Promise<Unit> &&promise);
void on_update(tl_object_ptr<telegram_api::updateGroupCallConnection> update, Promise<Unit> &&promise);
void on_update(tl_object_ptr<telegram_api::updateGroupCallChainBlocks> update, Promise<Unit> &&promise);
void on_update(tl_object_ptr<telegram_api::updateGroupCall> update, Promise<Unit> &&promise);
void on_update(tl_object_ptr<telegram_api::updateGroupCallParticipants> update, Promise<Unit> &&promise);

View file

@ -449,7 +449,7 @@ class UserManager final : public Actor {
void on_deleted_contacts(const vector<UserId> &deleted_contact_user_ids);
int32 get_imported_contact_count(Promise<Unit> &&promise);
void get_imported_contact_count(Promise<int32> &&promise);
std::pair<vector<UserId>, vector<int32>> change_imported_contacts(vector<Contact> &contacts, int64 &random_id,
Promise<Unit> &&promise);
@ -752,8 +752,8 @@ class UserManager final : public Actor {
class UserLogEvent;
class SecretChatLogEvent;
static constexpr int32 MAX_GET_PROFILE_PHOTOS = 100; // server side limit
static constexpr size_t MAX_NAME_LENGTH = 64; // server side limit for first/last name
static constexpr int32 MAX_GET_PROFILE_PHOTOS = 100; // server-side limit
static constexpr size_t MAX_NAME_LENGTH = 64; // server-side limit for first/last name
static constexpr int32 MAX_ACTIVE_STORY_ID_RELOAD_TIME = 3600; // some reasonable limit

View file

@ -28,6 +28,8 @@ class UserStarGift {
int64 upgrade_star_count_ = 0;
int64 transfer_star_count_ = 0;
int32 date_ = 0;
int32 can_transfer_at_ = 0;
int32 can_resell_at_ = 0;
int32 can_export_at_ = 0;
bool is_name_hidden_ = false;
bool is_saved_ = false;

View file

@ -10,7 +10,7 @@
namespace td {
constexpr int32 MTPROTO_LAYER = 201;
constexpr int32 MTPROTO_LAYER = 203;
enum class Version : int32 {
Initial, // 0

View file

@ -550,8 +550,7 @@ class FileManager final : public Actor {
Result<string> get_suggested_file_name(FileId file_id, const string &directory);
void read_file_part(FileId file_id, int64 offset, int64 count, int left_tries,
Promise<td_api::object_ptr<td_api::filePart>> promise);
void read_file_part(FileId file_id, int64 offset, int64 count, int left_tries, Promise<string> promise);
void delete_file(FileId file_id, Promise<Unit> promise, const char *source);

View file

@ -13,7 +13,6 @@
#include "td/utils/common.h"
#include "td/utils/format.h"
#include "td/utils/logging.h"
#include "td/utils/misc.h"
#include "td/utils/Slice.h"
#include "td/utils/Status.h"
#include "td/utils/StorerBase.h"
@ -229,8 +228,6 @@ BufferSlice log_event_store_impl(const T &data, const char *file, int line) {
BufferSlice value_buffer{storer_calc_length.get_length()};
auto ptr = value_buffer.as_mutable_slice().ubegin();
LOG_CHECK(is_aligned_pointer<4>(ptr)) << ptr;
LogEventStorerUnsafe storer_unsafe(ptr);
store(data, storer_unsafe);

View file

@ -45,8 +45,8 @@ uint64 get_md5_string_hash(const string &str) TD_WARN_UNUSED_RESULT;
// calculates hash of list of uint64
int64 get_vector_hash(const vector<uint64> &numbers) TD_WARN_UNUSED_RESULT;
// returns emoji corresponding to the specified number
string get_emoji_fingerprint(uint64 num);
// returns 4 emoji corresponding to the specified 32-byte buffer
vector<string> get_emoji_fingerprints(const unsigned char *buffer);
// checks whether currency amount is valid
bool check_currency_amount(int64 amount);

View file

@ -149,7 +149,7 @@ class Session final
PendingQueries pending_queries_;
std::map<mtproto::MessageId, Query> sent_queries_;
std::deque<NetQueryPtr> pending_invoke_after_queries_;
ListNode sent_queries_list_;
ListNode sent_query_list_;
struct ConnectionInfo {
int8 connection_id_ = 0;
@ -197,7 +197,7 @@ class Session final
double wakeup_at_ = 0.0;
// mtproto::AuthData should be the last field, because it's size is about 32 KB
// mtproto::AuthData should be the last field, because its size is about 32 KB
mtproto::AuthData auth_data_;
void on_handshake_ready(Result<unique_ptr<mtproto::AuthKeyHandshake>> r_handshake);

View file

@ -228,8 +228,8 @@ class Scheduler {
unique_ptr<ObjectPool<ActorInfo>> actor_info_pool_;
int32 actor_count_ = 0;
ListNode pending_actors_list_;
ListNode ready_actors_list_;
ListNode pending_actors_;
ListNode ready_actors_;
KHeap<double> timeout_queue_;
FlatHashMap<ActorInfo *, std::vector<Event>> pending_events_;

View file

@ -111,7 +111,7 @@ ActorOwn<ActorT> Scheduler::register_actor_impl(Slice name, ActorT *actor_ptr, A
send_later(actor_id, Event::start());
do_migrate_actor(actor_info, sched_id);
} else {
pending_actors_list_.put(weak_info->get_list_node());
pending_actors_.put(weak_info->get_list_node());
if (ActorTraits<ActorT>::need_start_up) {
send_later(actor_id, Event::start());
}

View file

@ -45,13 +45,13 @@ class BinlogKeyValue final : public KeyValueSyncInterface {
Slice key;
Slice value;
template <class StorerT>
void store(StorerT &&storer) const {
void store(StorerT &storer) const {
storer.store_string(key);
storer.store_string(value);
}
template <class ParserT>
void parse(ParserT &&parser) {
void parse(ParserT &parser) {
key = parser.template fetch_string<Slice>();
value = parser.template fetch_string<Slice>();
}
@ -84,7 +84,10 @@ class BinlogKeyValue final : public KeyValueSyncInterface {
name,
[&](const BinlogEvent &binlog_event) {
Event event;
event.parse(TlParser(binlog_event.get_data()));
TlParser event_parser(binlog_event.get_data());
event.parse(event_parser);
event_parser.fetch_end();
LOG_CHECK(event_parser.get_error() == nullptr) << event_parser.get_status();
if (event.key.empty()) {
LOG(ERROR) << "Have event with empty key";
return;
@ -109,7 +112,10 @@ class BinlogKeyValue final : public KeyValueSyncInterface {
void external_init_handle(const BinlogEvent &binlog_event) {
Event event;
event.parse(TlParser(binlog_event.get_data()));
TlParser event_parser(binlog_event.get_data());
event.parse(event_parser);
event_parser.fetch_end();
LOG_CHECK(event_parser.get_error() == nullptr) << event_parser.get_status();
if (event.key.empty()) {
LOG(ERROR) << "Have external event with empty key";
return;

View file

@ -43,7 +43,7 @@ struct GroupParticipant {
td::int64 user_id{0};
td::int32 flags{0};
PublicKey public_key{};
td::int32 version{0};
td::int32 version{1};
bool add_users() const {
return (flags & GroupParticipantFlags::AddUsers) != 0;
}

View file

@ -23,7 +23,7 @@ class Mnemonic {
static td::Result<Mnemonic> create(std::vector<td::SecureString> words, td::SecureString password);
struct Options {
Options();
int words_count = 24;
int word_count = 24;
td::SecureString password;
td::SecureString entropy;
};

View file

@ -54,6 +54,11 @@ class Result {
return std::holds_alternative<T>(data_);
}
// Check if the result is an error
bool is_error() const {
return std::holds_alternative<Error>(data_);
}
T &value() {
return std::get<T>(data_);
}
@ -283,8 +288,8 @@ Result<StorageBlockchainState> storage_get_blockchain_state(StorageId);
using CallId = std::int64_t;
using CallChannelId = std::int32_t;
struct CallParticipant {
UserId user_id;
PublicKeyId public_key_id;
UserId user_id{};
PublicKeyId public_key_id{};
int permissions{};
};

View file

@ -41,6 +41,7 @@ enum class ErrorCode : int {
CallFailed = 601,
CallKeyAlreadyUsed = 602
};
inline std::string_view error_string(ErrorCode error_code) {
switch (error_code) {
case ErrorCode::Any:

View file

@ -64,7 +64,7 @@ class tl_config_parser {
tl_tree *read_type_expr(int *var_count);
tl_tree *read_nat_expr(int *var_count);
tl_tree *read_expr(int *var_count);
std::vector<arg> read_args_list(int *var_count);
std::vector<arg> read_args(int *var_count);
tl_combinator *read_combinator();
tl_type *read_type();

View file

@ -21,7 +21,7 @@ class StealingQueue {
// tries to put a value
// returns if succeeded
// only owner is allowed to to do this
// only owner is allowed to do this
template <class F>
void local_push(T value, F &&overflow_f) {
while (true) {

View file

@ -14,7 +14,7 @@ namespace td {
// checks whether the string is an emoji; variation selectors are ignored
bool is_emoji(Slice str);
// checks whether emoji ends on a Fitzpatrick modifier and returns it's number or 0
// checks whether emoji ends on a Fitzpatrick modifier and returns its number or 0
int get_fitzpatrick_modifier(Slice emoji);
// removes all Fitzpatrick modifier from the end of the string

View file

@ -12,7 +12,6 @@
#include "td/utils/SharedSlice.h"
#include "td/utils/Slice.h"
#include "td/utils/SliceBuilder.h"
#include "td/utils/StackAllocator.h"
#include "td/utils/Status.h"
#include "td/utils/tl_parsers.h"
#include "td/utils/tl_storers.h"
@ -287,19 +286,10 @@ string serialize(const T &object) {
size_t length = calc_length.get_length();
string key(length, '\0');
if (!is_aligned_pointer<4>(key.data())) {
auto ptr = StackAllocator::alloc(length);
MutableSlice data = ptr.as_slice();
TlStorerUnsafe storer(data.ubegin());
store(object, storer);
CHECK(storer.get_buf() == data.uend());
key.assign(data.begin(), data.size());
} else {
MutableSlice data = key;
TlStorerUnsafe storer(data.ubegin());
store(object, storer);
CHECK(storer.get_buf() == data.uend());
}
MutableSlice data = key;
TlStorerUnsafe storer(data.ubegin());
store(object, storer);
CHECK(storer.get_buf() == data.uend());
return key;
}
@ -310,7 +300,6 @@ SecureString serialize_secure(const T &object) {
size_t length = calc_length.get_length();
SecureString key(length, '\0');
CHECK(is_aligned_pointer<4>(key.data()));
MutableSlice data = key.as_mutable_slice();
TlStorerUnsafe storer(data.ubegin());
store(object, storer);

View file

@ -13,11 +13,8 @@
#include "td/utils/Status.h"
#include "td/utils/UInt.h"
#include <array>
#include <cstring>
#include <limits>
#include <memory>
#include <string>
namespace td {
@ -26,11 +23,7 @@ class TlParser {
size_t data_len = 0;
size_t left_len = 0;
size_t error_pos = std::numeric_limits<size_t>::max();
std::string error;
std::unique_ptr<int32[]> data_buf;
static constexpr size_t SMALL_DATA_ARRAY_SIZE = 6;
std::array<int32, SMALL_DATA_ARRAY_SIZE> small_data_array;
string error;
alignas(4) static const unsigned char empty_data[sizeof(UInt512)];