Commit Graph

10311 Commits

Author SHA1 Message Date
levlam
238d154ed7 Immediately fetch affected messages. 2024-01-26 00:30:49 +03:00
levlam
168bba072d Remove UpdatesManager::init_sessions, because sessions are inited now by choosing of random one to send request, and init_sessions isn't called after temporary key is changed. 2024-01-25 22:33:44 +03:00
levlam
233633b705 Don't postpone updates with pts_count > 1, because they can partly overlap with getDifference results. 2024-01-25 22:28:07 +03:00
levlam
c9a357f80d Support gaps with 0 pts_count in UpdatesManager::on_get_pts_update. 2024-01-25 22:02:11 +03:00
levlam
2acbcdbb60 Allow sending messages to user after receiving a message from them. 2024-01-25 20:56:10 +03:00
levlam
8c2375fdfe Invalidate user_full_contact_require_premium_ when contact_require_premium changes. 2024-01-25 20:51:52 +03:00
levlam
c95cb5d75c Minor imrovements. 2024-01-25 20:06:07 +03:00
levlam
c2ccf0d784 Add some emptiness checks. 2024-01-25 19:37:56 +03:00
levlam
f2262cdcfb Add checks for null user. 2024-01-25 19:11:54 +03:00
levlam
4464a8479b Use FlatHashSet to check internal options. 2024-01-25 18:50:37 +03:00
levlam
dfdad00dca Don't warn about topic changed to or from Author Hidden. 2024-01-25 18:08:53 +03:00
levlam
07e381eaab Add SavedMessagesTopicId::is_author_hidden. 2024-01-25 18:04:32 +03:00
levlam
b97773457b Don't set explicitly source.is_outgoing for messages forwarded from the user. 2024-01-25 18:01:51 +03:00
levlam
db1644bb13 Add and use SavedReactionTag constructor. 2024-01-25 17:29:29 +03:00
levlam
04ec06ef4f Update tag labels locally. 2024-01-25 17:12:02 +03:00
levlam
2b442c1caa Add ReactionManager::reget_saved_messages_tags. 2024-01-25 17:04:02 +03:00
levlam
650ca8844d Init SavedMessagesTopic with real_forward_from_dialog_id. 2024-01-25 16:45:24 +03:00
levlam
2f1423a284 Allow forwardSource without source message. 2024-01-25 16:23:00 +03:00
levlam
81f1d61e7f Improve Saved Messages tag documentation. 2024-01-25 14:58:32 +03:00
levlam
096fc39bd1 Cache reaction tag hash. 2024-01-25 14:29:22 +03:00
levlam
09122ba596 Update SavedReactionTag comparison operator. 2024-01-25 14:13:06 +03:00
levlam
0cbda12b4c Remove handling of some sendMessage error messages. 2024-01-24 22:05:22 +03:00
levlam
faf975ccc9 Use UserId::get_user_ids instead of explicit transform. 2024-01-24 21:40:14 +03:00
levlam
7628646b63 Fix Java build. 2024-01-24 21:35:50 +03:00
levlam
b8799a7e8c Fix source.is_outgoing flag. 2024-01-24 20:44:07 +03:00
levlam
a14091ff81 Improve LastForwardedMessageInfo logging. 2024-01-24 20:03:42 +03:00
levlam
56d75e7c53 Don't keep full message source for initially forwarded messages. 2024-01-24 20:01:29 +03:00
levlam
d7e35f4c44 Improve privacy settings. 2024-01-24 18:59:53 +03:00
levlam
94141a18dd Make canSendMessageToUser response strongly typed. 2024-01-19 22:14:03 +03:00
levlam
0a6207700d Use GetIsPremiumRequiredToContactQuery to check unknown users. 2024-01-19 21:55:24 +03:00
levlam
5624f91155 Add td_api::canSendMessageToUser. 2024-01-19 15:35:57 +03:00
levlam
59de70bd87 Keep flag UserFull.contact_require_premium. 2024-01-19 15:01:07 +03:00
levlam
ecbbef18e2 Document that setNewChatPrivacySettings can be used only by Premium users. 2024-01-19 14:37:16 +03:00
levlam
a3ac41e283 Add user.restricts_new_chats. 2024-01-19 14:35:37 +03:00
levlam
c8e4622da4 Add td_api::newChatPrivacySettings and methods for getting and setting it. 2024-01-19 14:25:24 +03:00
levlam
2504de4978 Add td_api::setReadDatePrivacySettings. 2024-01-09 17:56:47 +03:00
levlam
252ca3135c Add td_api::getReadDatePrivacySettings. 2024-01-09 17:11:22 +03:00
levlam
e85694e6ff Support other global privacy settings. 2024-01-09 16:00:59 +03:00
levlam
d950add490 Reget global privacy settings before setting them. 2024-01-09 15:54:25 +03:00
levlam
9802119ff7 Return GlobalPrivacySettings from get_global_privacy_settings. 2024-01-09 15:14:45 +03:00
levlam
b2f8a8e5d6 Support UserFull.read_dates_private. 2024-01-09 14:56:32 +03:00
levlam
d6eca27e58 Improve td_api::MessageReadDate. 2024-01-09 14:47:04 +03:00
levlam
5fc554166f Add Message.can_get_read_date. 2024-01-09 13:50:11 +03:00
levlam
5baf9f52f8 Add internal "pm_read_date_expire_period" option. 2024-01-09 13:41:59 +03:00
levlam
5fb64e7ccd Add td_api::getMessageReadDate. 2024-01-09 13:37:29 +03:00
levlam
0e032795b6 Add by_my_privacy_settings flag to td_api::UserStatus. 2024-01-09 12:34:02 +03:00
levlam
b171fbe373 Update layer to 172. 2024-01-09 12:09:10 +03:00
levlam
9fe83feeeb Add td_api::ReactionUnavailabilityReason. 2024-01-24 17:11:41 +03:00
levlam
33ec7a21a8 Update Saved Messages tag count when tags are added from another app or message is deleted. 2024-01-24 12:31:12 +03:00
levlam
2351a83227 Add and use get_chosen_tags. 2024-01-24 12:01:20 +03:00
levlam
1b15b2825c Add and use SavedReactionTags::calc_hash(). 2024-01-24 00:25:02 +03:00
levlam
839969e255 Allow tags with label but without count. 2024-01-23 23:11:12 +03:00
levlam
588b889e4c Check Saved Messages tags for validness. 2024-01-23 23:04:47 +03:00
levlam
cb70c0fa97 Update saved reaction tags after changing them locally. 2024-01-23 22:56:00 +03:00
levlam
ae18e3de6b Add availableReaction.is_tag. 2024-01-23 21:28:39 +03:00
levlam
956c35d6e0 Add td_api::setSavedMessagesTagLabel. 2024-01-23 19:04:31 +03:00
levlam
e7953c067c Send GetSavedReactionTagsQuery ordered with SendReactionQuery. 2024-01-23 17:04:03 +03:00
levlam
1c53d32aba Return default tag reactions first for tags. 2024-01-23 16:49:50 +03:00
levlam
9a09125d62 Support telegram_api::updateSavedReactionTags. 2024-01-23 16:39:15 +03:00
levlam
291cd4203a Add td_api::updateSavedMessagesTags. 2024-01-23 16:23:35 +03:00
levlam
9df2ba6e64 Add td_api::getSavedMessagesTags. 2024-01-23 16:01:27 +03:00
levlam
e6611cdb8f Add td_api::searchSavedMessages. 2024-01-22 21:14:02 +03:00
levlam
e8f96d2520 Support adding tags to a message. 2024-01-22 20:25:19 +03:00
levlam
61277da56f Move message_id checks to get_message_active_reactions. 2024-01-22 20:15:02 +03:00
levlam
b9afcbb70c Support reaction tags in getMessageAvailableReactions. 2024-01-22 20:03:05 +03:00
levlam
ed4f18bfaf Don't allow to call get_id() on non-abstract classes. 2024-01-22 19:46:12 +03:00
levlam
eb80098431 Add td_api::messageReactions and messageReactions.are_tags. 2024-01-22 19:37:05 +03:00
levlam
0823ee492e Add enum ReactionListType. 2024-01-18 20:53:43 +03:00
levlam
f4388dfc5c Add ReactionList.is_loaded_from_database. 2024-01-18 20:12:22 +03:00
levlam
74aab0a7b2 Load default tag reactions. 2024-01-18 20:08:37 +03:00
levlam
20c4815a12 Add td_api::setPinnedSavedMessagesTopics. 2024-01-18 19:38:26 +03:00
levlam
af43242ca7 Add td_api::toggleSavedMessagesTopicIsPinned. 2024-01-18 19:22:31 +03:00
levlam
ae7e290789 Add td_api::updatePinnedSavedMessagesTopics. 2024-01-18 18:51:34 +03:00
levlam
643b896958 Add td_api::premiumLimitTypePinnedSavedMessagesTopicsCount. 2024-01-18 18:34:39 +03:00
levlam
30dad21fae Add MessagesManager::fix_delete_message_min_max_dates. 2024-01-18 17:47:59 +03:00
levlam
8c358a4fc5 Add SavedMessagesTopicId::is_valid_status. 2024-01-18 17:38:15 +03:00
levlam
788d169e69 Add td_api::deleteSavedMessagesTopicMessagesByDate. 2024-01-18 17:29:09 +03:00
levlam
5002f25c0a Add td_api::getSavedMessagesTopicMessageByDate. 2024-01-18 16:45:45 +03:00
levlam
26d63f605b Rename chat permission to can_create_topics. 2024-01-17 12:22:56 +03:00
levlam
93370af38d Add td_api::deleteSavedMessagesTopicHistory. 2024-01-16 22:42:43 +03:00
levlam
40f8bffec8 Add td_api::getSavedMessagesTopicHistory. 2024-01-16 19:19:38 +03:00
levlam
d9f2fe57a6 Add td_api::getPinnedSavedMessagesTopics. 2024-01-16 17:32:11 +03:00
levlam
79a66c06cc Add td_api::getSavedMessagesTopics. 2024-01-16 16:26:58 +03:00
levlam
16fc47fb88 Add getChatSparseMessagePositions.saved_messages_topic. 2024-01-16 14:12:57 +03:00
levlam
f76c384f90 Add getChatMessageCalendar.saved_messages_topic. 2024-01-16 14:00:14 +03:00
levlam
8f019eeb73 Add getChatMessageCount.saved_messages_topic. 2024-01-16 00:30:37 +03:00
levlam
7e3107b1d3 Add SavedMessagesTopicId::is_valid_in. 2024-01-15 23:25:51 +03:00
levlam
3eba7d4f2b Add getChatMessagePosition.saved_messages_topic. 2024-01-15 20:39:47 +03:00
levlam
7d71562a24 Add searchChatMessages.saved_messages_topic_id. 2024-01-15 19:43:03 +03:00
levlam
341b59cb6c Duplicate fields from origin to source if appropriate. 2024-01-15 18:56:59 +03:00
levlam
85c4cd4642 Add SavedMessagesTopicId class. 2024-01-13 12:06:31 +03:00
levlam
0aeb11dee8 Add message.saved_messages_topic. 2024-01-12 16:06:10 +03:00
levlam
09e0add01f Add Message.saved_messages_dialog_id. 2024-01-12 15:38:12 +03:00
levlam
2ff04387b8 Add more information to forwardSource. 2024-01-12 00:23:33 +03:00
levlam
91aef01e7e Add td_api::forwardSource. 2024-01-11 22:48:22 +03:00
levlam
1dca0272be Add class LastForwardedMessageInfo. 2024-01-11 22:33:12 +03:00
levlam
b287f2f177 Remove unused init_stickers_manager fucntion. 2024-01-11 21:46:12 +03:00
levlam
10f77aee95 Move get_dialog_reply_markup implementation to ReplyMarkup.cpp. 2024-01-11 20:35:02 +03:00
levlam
645102e4ed Make MessageForwardInfo fields private. 2024-01-11 20:13:43 +03:00
levlam
6b180bcfd9 Add MessageForwardInfo::copy_message_forward_info. 2024-01-11 20:10:14 +03:00
levlam
c30c6168b5 Add and use MessageForwardInfo::need_change_warning. 2024-01-11 19:59:14 +03:00
levlam
edb02aa4c4 Add MessageForwardInfo::is_imported(). 2024-01-11 19:39:32 +03:00
levlam
8c6024808a Add and use MessagesManager::get_message_original_date. 2024-01-11 19:36:00 +03:00
levlam
b3a94f187f Use public constructor to create legacy-parsed MessageForwardInfo. 2024-01-11 19:29:49 +03:00
levlam
5ccb67f28e Improve MessageForwardInfo field names. 2024-01-11 19:24:01 +03:00
levlam
d59abc099d Add MessageForwardInfo getters. 2024-01-11 19:11:16 +03:00
levlam
3ba660a655 Add some MessageForwardInfo methods. 2024-01-11 18:46:10 +03:00
levlam
3cb8ef9807 Store MessageForwardInfo as the whole. 2024-01-11 18:20:53 +03:00
levlam
2ff1a93d5b Add td_api::cancelRecoveryEmailAddressVerification. 2024-01-11 14:51:29 +03:00
levlam
562374088c Remove setTdlibParameters.enable_storage_optimizer/ignore_file_names parameters in favor of "use_storage_optimizer" and "ignore_file_names" options. 2024-01-11 13:54:23 +03:00
levlam
bf6345248f Return keywords in searchEmojis. 2024-01-05 15:21:35 +03:00
levlam
f4bafbdc86 Add separate td_api::getKeywordEmojis. 2024-01-05 14:36:01 +03:00
levlam
4dc89d0b8d Add StickersManager::prepare_search_emoji_query. 2024-01-05 14:20:00 +03:00
levlam
0b5b4b8dab Add synchronous td_api::getCountryFlagEmoji. 2024-01-05 13:42:46 +03:00
levlam
a9d1269567 Add more information to chatBoostFeatures. 2024-01-02 17:32:30 +03:00
levlam
8e2ef00696 Apply message self-destruct type changes for being sent messages. 2024-01-02 15:38:43 +03:00
levlam
052f6cb20c Allow to send self-destructing video notes and voice notes. 2024-01-02 14:51:16 +03:00
levlam
139b61e4b6 Add td_api::messageExpiredVideoNote and td_api::messageExpiredVoiceNote. 2024-01-02 14:27:11 +03:00
levlam
be8b21cdf4 Update layer to 171. 2024-01-02 03:23:51 +03:00
levlam
2b0d3f6091 Improve error message. 2024-01-25 17:33:11 +03:00
levlam
90cc7a5f9c Improve logging. 2024-01-24 16:31:47 +03:00
levlam
741c80cf13 Fix log message. 2024-01-24 16:06:43 +03:00
levlam
fbd6f27d7b Don't reload config on restart for bots. 2024-01-24 15:38:11 +03:00
levlam
a262f0a5f7 Avoid some initialization for bots. 2024-01-24 15:24:16 +03:00
levlam
e7fbcd9d2a Call G()->is_test_dc() only once. 2024-01-24 15:01:14 +03:00
levlam
f24bc41596 Move setting of default option values from ContactsManager to OptionManager. 2024-01-24 14:59:09 +03:00
levlam
13c94c7731 Don't init BackgroundManager for bots. 2024-01-24 14:48:17 +03:00
levlam
0c0c24e7d0 Don't log updateOption for bots. 2024-01-24 14:40:56 +03:00
levlam
5bbfc1cf5d Update premium options on launch only for regular users. 2024-01-23 21:03:04 +03:00
levlam
3cb6ed90db Directly use thread-unsafe key value when initializing it. 2024-01-23 20:36:29 +03:00
levlam
0c8e63c2f5 Optimize set_default_integer_option. 2024-01-23 20:29:31 +03:00
levlam
8d2d2de0d0 Add set_default_integer_option lambda-helper. 2024-01-23 20:16:26 +03:00
levlam
0190bf2b1f Use for_each instead of a temporary map in OptionManager::OptionManager. 2024-01-23 19:42:28 +03:00
levlam
cd3cc873f0 Fix usage of unsupported chat identifier. 2024-01-23 19:05:39 +03:00
levlam
60f2f75b78 Minor improvements. 2024-01-22 13:11:04 +03:00
levlam
ee8f00c7a1 Improve InternalLinkType documentation. 2024-01-22 12:55:18 +03:00
levlam
1f116cdd99 Reuse the same PublicRsaKeySharedMain object. 2024-01-22 02:52:58 +03:00
levlam
0dd1934090 Use separate implementations for main and CDN RSA keys. 2024-01-22 02:15:26 +03:00
levlam
e52d08da74 Use PublicRsaKeyInterface in AuthDataShared. 2024-01-22 01:55:16 +03:00
levlam
d5c3456085 Remove default NerQueryDispatcher constructor. 2024-01-22 01:39:31 +03:00
levlam
b4c075593e Log received message info. 2024-01-21 01:50:20 +03:00
levlam
674b380bd5 Never ask for ack for service queries. 2024-01-21 01:31:24 +03:00
levlam
09c6bad8bd Remove pinned message notification only if new pinned message is added to Mentions. 2024-01-20 03:30:10 +03:00
levlam
2a9393ff7a Add "process_pinned_messages_as_mentions" option to allow keep previous behavior. 2024-01-19 22:23:26 +03:00
levlam
121fbe535f Create dependent chats right after Message object creation. 2024-01-18 15:21:44 +03:00
levlam
021c0bd02d Improve logging. 2024-01-18 14:59:53 +03:00
levlam
e5f9e4c400 Decrease UPDATE_APPLY_WARNING_TIME and improve logging. 2024-01-17 16:50:08 +03:00
levlam
14c93b1772 Fix added_message_full_id initialization. 2024-01-16 21:40:25 +03:00
levlam
6d910597e5 Delete message from map after using. 2024-01-16 21:36:24 +03:00
levlam
c2277a1044 Add source to get_user_full_force. 2024-01-15 14:12:00 +03:00
Liru Færs
0f98d76683
Fix DialogActionManager::send_dialog_action in secret chats (#2756)
* Fix DialogActionManager::send_dialog_action in secret chats 

The code in `DialogActionManager::send_dialog_action` made the assumption that since we'd either have early returned or `DialogManager::have_input_peer` would be true, and therefore the else block of the conditional, which intended to set input_peer, should have done so successfully.

However, `DialogManager::have_input_peer` will return true for secret chats when `contacts_manager->have_input_encrypted_peer`
And `DialogManager::get_input_peer` will return a `nullptr` for secret chats by design (I believe this is because they operate using structures that are currently incompatible)

This should fix the root of a crash that happens when typing in or sending messages to secret chats on:
Telegram X 0.26.4.1678-arm64-v8a (99b10675)
TDLib: 1.8.23 (tdlib/td@4bafdc2)

* Move CHECK below SecretChat case instead per feedback
2024-01-15 01:02:56 +03:00
levlam
58c457ab5f Add NotificationManager::parse_push_notification_attach. 2024-01-14 23:05:35 +03:00
levlam
3e8d368ba5 Add NotificationManager::add_push_notification_user. 2024-01-14 22:52:52 +03:00
levlam
ffdb02374e Simplify Manager actor reset. 2024-01-13 02:08:28 +03:00
levlam
916e5de43e Simplify code for manager reset. 2024-01-13 01:28:15 +03:00
levlam
96fee82699 Use separate initialization functions for different Manager types. 2024-01-13 00:59:17 +03:00
levlam
8b97d2e8e4 Move binlog events processing to Td::process_binlog_events. 2024-01-13 00:42:49 +03:00
levlam
0aa8816c28 Don't always treat pins as mentions. 2024-01-12 18:15:19 +03:00
levlam
4bafdc2b71 Fix MessagesManager::drop_dialog_last_pinned_message_id. 2024-01-12 12:16:51 +03:00
levlam
5d7c69d0d1 Remove CallManager::Update typedef. 2024-01-11 13:36:38 +03:00
levlam
d029eff807 Minor improvements. 2024-01-11 00:12:16 +03:00
levlam
21418140bd Fix removal of message reply for failed to send forwarded messages. 2024-01-10 22:01:39 +03:00
levlam
a10f03cde1 Add sanity check. 2024-01-10 21:41:13 +03:00
levlam
5e0301db45 Improve fatal error message on app downgrade. 2024-01-10 21:20:17 +03:00
levlam
17a412a04a Don't delete notifications when initializing last_new_message_id. There should be no old notifications anyway (2). 2024-01-10 21:08:43 +03:00
levlam
bc5b1f4e19 Remove unavailable messages from the list of linked messages. 2024-01-10 20:22:45 +03:00
levlam
509908edda Don't register users/channels in unknown channels. 2024-01-10 20:07:56 +03:00
levlam
7f844b637f Correctly update self speculative channel status while joining it. 2024-01-10 18:03:41 +03:00
levlam
1fa64892e1 Don't count non-member creator in administrator count. 2024-01-10 17:49:17 +03:00
levlam
44eba3d214 Combine JoinChannel queries. 2024-01-10 17:42:14 +03:00
levlam
faee94b680 Apply message auto-delete time from chat creation message. 2024-01-10 17:20:13 +03:00
levlam
4d51b2c875 Move create_new_chat/create_new_channel to ContactsManager. 2024-01-10 17:09:09 +03:00
levlam
a409af0973 Move migrate_dialog_to_megagroup to ContactsManager. 2024-01-10 15:57:19 +03:00
levlam
1bc8e90c10 Move create_new_secret_chat to ContactsManager. 2024-01-10 15:20:16 +03:00
levlam
da031b3faa Allow \r and other empty entities as a separator between MarkdownV2 blockquotes. 2024-01-10 14:36:27 +03:00
levlam
ce8a4b6d21 tg_cli: use preset message_thread_id_ in requests where it is optional. 2024-01-10 13:16:37 +03:00
levlam
c6154c43aa Don't store message interaction info for bots. 2024-01-09 10:59:24 +03:00
levlam
3817f2cb6b Minor improvements. 2024-01-08 19:26:34 +03:00
levlam
7b6ce8b822 Move reload_dialog_info to DialogManager. 2024-01-08 19:20:22 +03:00
levlam
9a90089879 Move check_dialog_username to DialogManager. 2024-01-08 19:14:41 +03:00
levlam
466c841b4e Move send_update_add_chat_members_privacy_forbidden to DialogParticipantManager. 2024-01-08 18:57:44 +03:00
levlam
127b7ad086 Add DialogParticipantManager::speculative_add_channel_user. 2024-01-08 18:50:18 +03:00
levlam
b1d72276a7 Move set_channel_participant_status and similar methods to DialogParticipantManager. 2024-01-08 18:44:13 +03:00
levlam
9660a7f2b1 Move set_dialog_participant_status and similar methods to DialogParticipantManager. 2024-01-08 18:15:21 +03:00
levlam
50b5a6e9bf Move channel participant cache to DialogParticipantManager. 2024-01-08 18:03:04 +03:00
levlam
bba173ea7d Move get_channel_participant to DialogParticipantManager. 2024-01-08 17:45:04 +03:00
levlam
f8565154a1 Move get_dialog_participant to DialogParticipantManager. 2024-01-08 17:35:24 +03:00
levlam
f1a4579e67 Move bot chat member updates to DialogParticipantManager. 2024-01-08 17:27:32 +03:00
levlam
82e59914cd Minor improvements. 2024-01-08 15:42:21 +03:00
levlam
d832d5a70f Move chat administrators to DialogParticipantManager. 2024-01-08 15:23:16 +03:00
levlam
d1251e47a6 Move chat join request processing to DialogParticipantManager. 2024-01-08 14:36:18 +03:00
levlam
b579fcd3e0 Rename DialogOnlineMemberManager to DialogParticipantManager. 2024-01-08 14:22:44 +03:00
levlam
55faa7ad0b Fix parameter name. 2024-01-08 14:15:15 +03:00
levlam
e4c816d33c Move methods for chat invite link management to DialogInviteLinkManager. 2024-01-08 14:09:58 +03:00
levlam
5a1b4b8d71 Move DialogAccessByInviteLink to DialogInviteLinkManager. 2024-01-08 13:40:28 +03:00
levlam
409778b760 Move check/join by chat invite link to DialogInviteLinkManager. 2024-01-08 13:25:31 +03:00
levlam
ebf2f95681 Add DialogInviteLinkManager. 2024-01-08 12:43:31 +03:00
levlam
90b8acff67 Add and use BotCommands::update_all_bot_commands. 2024-01-08 01:44:58 +03:00
levlam
b4ac2653cd Move delete_dialog to DialogManager. 2024-01-08 01:27:49 +03:00
levlam
64c646b9de Use resolve_dialog_username internally. 2024-01-08 00:31:07 +03:00