Commit Graph

8527 Commits

Author SHA1 Message Date
levlam
66234ae253 Fix IPv6 usage on WatchOS. 2023-06-11 13:25:06 +03:00
levlam
e3256e7b4c Use td::append if possible. 2023-06-10 23:14:03 +03:00
levlam
8096cf0439 Register replies to messages in different chats. 2023-06-09 13:44:15 +03:00
levlam
1886bcf850 Make update_message_max_reply_media_timestamp const. 2023-06-08 20:14:38 +03:00
levlam
bc618b855e Replace all message reply-related fields simultaneously. 2023-06-08 20:09:42 +03:00
levlam
6f082a40d2 Improve MessagesManager::create_message_to_send. 2023-06-08 13:39:36 +03:00
levlam
e8ee1c5149 Don't force getChatHistory response for only_local requests. 2023-06-07 15:23:09 +03:00
levlam
7d83f2e15a Remove redundant check, existing also in get_history_impl. 2023-06-07 15:14:45 +03:00
levlam
677219a251 Simplify OrderedMessages::auto_attach_message. 2023-06-07 13:23:13 +03:00
levlam
dec814ce34 Fix auto_attach_message. 2023-06-07 13:14:24 +03:00
levlam
ea217b10c1 Add MessagesManager::set_message_reply. 2023-06-07 00:57:27 +03:00
levlam
302a8c137b Add comment about missing is_changed update. 2023-06-06 14:36:49 +03:00
levlam
2aaf0f5290 Fix attach_menu_enabled updating. 2023-06-06 14:34:07 +03:00
levlam
771771a2c7 Check reply_in_dialog_id in relevant places. 2023-06-06 14:32:56 +03:00
levlam
31eee9d084 Explicitly pass encoding to htmlspecialchars. 2023-06-05 00:05:21 +03:00
levlam
ad8d1f8964 Explicitly pass flags to htmlspecialchars to have consistent behavior. 2023-06-04 23:10:06 +03:00
levlam
9b8bb82897 tg_cli: improve as_message_sender. 2023-06-03 22:12:45 +03:00
levlam
4580cfc23b Skip unsupported sponsored messages. 2023-06-02 13:01:32 +03:00
levlam
75e00df016 Ensure ordering between messages.getMessagesReactions and channels.readMessageContents. 2023-06-01 15:53:13 +03:00
levlam
6b342e9b0d Ignore reaction changes while there is a pending request to read unread reactions. 2023-06-01 15:31:05 +03:00
levlam
04525f6f6b Completely ignore global drafts in forum chats. 2023-05-31 17:54:31 +03:00
levlam
e599d16fc2 Make DraftMessage fields private and improve their names. 2023-05-31 17:46:06 +03:00
levlam
0b56f92190 Add methods to DraftMessage class. 2023-05-31 17:35:56 +03:00
levlam
978eb97c72 Improve get_draft_message. 2023-05-31 17:19:31 +03:00
levlam
ad5655d359 Add and use add_draft_message_dependencies. 2023-05-31 16:34:12 +03:00
levlam
33cbb2f438 Move ClearAllDraftsQuery to DraftMessage.cpp. 2023-05-31 16:23:23 +03:00
levlam
394ce38278 Move GetAllDraftsQuery to DraftMessage.cpp. 2023-05-31 16:17:20 +03:00
levlam
1aeaaaa733 Move SaveDraftMessageQuery to DraftMessage.cpp. 2023-05-31 15:57:30 +03:00
levlam
ec4d9836ee Add and use need_update_draft_message. 2023-05-31 15:29:37 +03:00
levlam
0ebc404ec5 Move file_loader logging to DEBUG by default. 2023-05-31 14:44:17 +03:00
levlam
1ff0e66eb0 Drop ready_size when delete partial remote location. 2023-05-30 12:29:12 +03:00
levlam
716481ca73 Don't allow message date change for server messages after sending. 2023-05-28 23:07:39 +03:00
levlam
8cc992e15e Add MessagesManager::on_get_messages_from_database. 2023-05-28 22:44:27 +03:00
levlam
0907c4fda5 Improve action order in on_get_history_from_database. 2023-05-28 11:15:15 +03:00
levlam
b64f8260f9 Remove manual load_messages call if receive no new messages from database. 2023-05-28 01:17:32 +03:00
levlam
1cf48ab89b Improve log messages. 2023-05-27 23:02:47 +03:00
levlam
b0ff4376e3 tg_cli: remove legacy api_id/api_hash options. 2023-05-27 21:39:04 +03:00
levlam
e1ecdf8399 Check wait_size and quick_ack first. 2023-05-26 13:24:55 +03:00
levlam
5ed34993be Save top_thread_message_id in RequestWebViewQuery. 2023-05-25 17:31:34 +03:00
levlam
a8be92146d Add class DocumentsManager::Subtype. 2023-05-25 13:57:12 +03:00
levlam
54b34e9180 Add more checks for scheduled messages. 2023-05-25 12:13:47 +03:00
levlam
dd7fe47db8 Add FileManager::copy_file_id. 2023-05-24 15:28:40 +03:00
levlam
526b602b61 Fix variable use after move. 2023-05-24 14:53:10 +03:00
levlam
0150094c0f Get chat history if receive a chat in chat list without last message. 2023-05-24 12:53:52 +03:00
levlam
7385ca726b Allow messageEmpty in response to messages.getDialogs. 2023-05-24 01:46:00 +03:00
levlam
54e967861c Fail sending of messages from yet_unsent_media_queues_ on restart. 2023-05-23 17:01:51 +03:00
levlam
d01f1ab20a Limit the number of concurrent getChannelDifference requests. 2023-05-23 14:57:04 +03:00
levlam
5a59c933fb Add missing semicolons after CHECK. 2023-05-22 19:31:58 +03:00
levlam
1aa1185185 Fix misprint. 2023-05-22 19:21:42 +03:00
levlam
7bc891aa0b Repeat channels.getDifference if expected PTS/message_id wasn't reached. 2023-05-22 19:19:36 +03:00
levlam
398fbeadf1 Add MessagesManager::schedule_get_channel_difference function. 2023-05-22 18:23:40 +03:00
levlam
89c47026e0 Fix compilation error with old compilers. 2023-05-22 16:00:14 +03:00
levlam
9756d174ee Clear contains_mention/contains_unread_mention message flags for bots. 2023-05-22 15:52:51 +03:00
levlam
fc82657626 Add create_photo function. 2023-05-22 15:35:25 +03:00
levlam
3d4b4ac014 Simplify inputMessageContent processing. 2023-05-21 23:28:34 +03:00
levlam
c70ef59cde Add get_input_thumbnail_photo_size. 2023-05-21 23:05:28 +03:00
levlam
c18818013a Add get_input_photo_size function. 2023-05-21 16:35:33 +03:00
levlam
f831357538 Make some constructors constexpr. 2023-05-21 13:21:49 +03:00
levlam
d65541d45a Use get_message_file_ids if possible. 2023-05-20 00:49:16 +03:00
levlam
3861b927ba Remove outdated comment superseded by static_assert. 2023-05-19 14:17:44 +03:00
levlam
45dfc6e51b Use FlatHashSet to store unallowed boundaries. 2023-05-19 14:03:22 +03:00
levlam
d510bc8435 Use FlatHashSet to store common TLDs. 2023-05-19 14:00:49 +03:00
levlam
1da3955271 Move Photo merging to merge_photos function. 2023-05-18 17:03:56 +03:00
levlam
2d60dadfe6 Improve important comment visibility. 2023-05-18 15:44:00 +03:00
AYMENJD
b844da31d4 Fix misprint. 2023-05-18 15:00:38 +03:00
levlam
348a209ab7 Fix includes. 2023-05-18 14:33:00 +03:00
levlam
fe4b1a16ef Fix warning. 2023-05-18 02:11:44 +03:00
levlam
cbb10e0f3d Remove 4-letter usernames from the list of short usernames. 2023-05-18 02:05:58 +03:00
levlam
f3a1407f8f Simplify constant FlatHashSet initialization. 2023-05-18 02:03:39 +03:00
levlam
20b312b144 Don't replace "Request aborted" errors for files. 2023-05-17 13:52:47 +03:00
levlam
d93c06fceb Remove unsafe Status::operator==. 2023-05-17 13:45:26 +03:00
levlam
5b09f60629 Log message_id of all outgoing messages. 2023-05-17 13:19:40 +03:00
levlam
bce488f6bf Log message_id of all incoming packets. 2023-05-17 13:00:21 +03:00
levlam
b48668e8bb Fix misprint. 2023-05-16 21:53:55 +03:00
levlam
7df9b39186 Improve logging of server time difference updates. 2023-05-15 20:23:38 +03:00
levlam
43e4746d2a Remove uninitialized MsgInfo.session_id. 2023-05-15 19:40:27 +03:00
levlam
93d283aca6 Improve parameter names. 2023-05-15 19:30:44 +03:00
levlam
64312c9b04 Drop some Sqlite PMC values when dialog database is recreated. 2023-05-15 19:02:58 +03:00
levlam
88ab425758 Reload marks as unread if there is no message database. 2023-05-15 18:20:24 +03:00
levlam
e626b5f68f Drop binlog events if message database was deleted. 2023-05-15 18:16:55 +03:00
levlam
8880e56967 Remove expected error logging. 2023-05-15 15:55:56 +03:00
levlam
9cd859d313 Resave sticker set without stickers only if it has already been inited. 2023-05-15 15:27:23 +03:00
levlam
9b4de71f28 Remove expected error logging. 2023-05-15 14:49:37 +03:00
levlam
48a97d5497 Resave changed sticker set to database. 2023-05-15 14:10:35 +03:00
levlam
012424074b Expect that short name of sticker sets can change. 2023-05-15 14:00:37 +03:00
levlam
5f5f4029e0 Fix error logging. 2023-05-15 13:40:02 +03:00
levlam
18646d6d49 Load expired messages from database in small batches. 2023-05-15 13:28:23 +03:00
levlam
a14a07c33d Remove lower bound check for ttl_expires_at. 2023-05-15 13:04:03 +03:00
levlam
7d3fea5a70 Improve log messages. 2023-05-15 12:37:49 +03:00
levlam
c7b9d54fdb Fix inputChannelFromMessage support. 2023-05-15 11:47:05 +03:00
levlam
5d499d594c Reset server time difference if it is more than 15 seconds in the future. 2023-05-14 23:11:23 +03:00
levlam
a395337265 Fix session_id type. 2023-05-14 23:00:56 +03:00
levlam
f29774acc6 Fix message_id type. 2023-05-14 22:42:58 +03:00
levlam
c9f83caf9f Reset server time difference after a "MessageId is too high" error. 2023-05-14 21:58:54 +03:00
levlam
edf0aaaa2a Fix misprint in error message. 2023-05-14 01:41:23 +03:00
levlam
f61b5900dd Pass Dialog to read_history_outbox. 2023-05-13 03:51:27 +03:00
levlam
57d3928a50 Pass Dialog to read_history_inbox. 2023-05-13 03:46:43 +03:00
levlam
7dffab5a92 Add MessagesManager::clear_dialog_message_list. 2023-05-13 03:37:35 +03:00
levlam
26bacbb787 Don't send updateNewMessage for yet unsent messages to bots. 2023-05-12 16:58:21 +03:00
levlam
da8b0770ec Don't call add_message_to_dialog_message_list for bots. 2023-05-12 16:44:57 +03:00
levlam
484bd135d1 Add MessagesManager::add_message_to_dialog_message_list. 2023-05-12 16:29:21 +03:00
levlam
f265a154b9 Refactor reply markup removal. 2023-05-12 14:25:00 +03:00
levlam
83648d58d4 Remove now unneeded has_qts_messages checks. 2023-05-11 21:54:28 +03:00
levlam
da91824003 Simplify OrderedMessages::insert. 2023-05-11 20:31:09 +03:00
levlam
432ee4c2c4 Remove now redundant parameters have_previous/have_next from add_message_to_dialog. 2023-05-11 20:27:00 +03:00
levlam
2f091e93cc Improve variable names. 2023-05-11 19:54:48 +03:00
levlam
fca143dca8 Pass from_update == true first time when adding failed_to_send messages. 2023-05-11 19:43:30 +03:00
levlam
87b658f2e2 Explicitly attach messages to the next in on_get_history. 2023-05-11 19:21:58 +03:00
levlam
042c75df63 Mark on_get_message parameters as const. 2023-05-11 17:52:53 +03:00
levlam
f1a12e26b2 Early drop unneeded reply_markup_message_id. 2023-05-11 16:54:17 +03:00
levlam
8495dbe580 Always ignore non-personal RemoveKeyboard/ForceReply keyboards. 2023-05-11 16:37:07 +03:00
levlam
492db8032e Immediately call add_scheduled_message_to_dialog for scheduled messages. 2023-05-11 15:46:54 +03:00
levlam
70b3057627 Avoid redundant message_id checks; it has already been checked. 2023-05-11 13:49:22 +03:00
levlam
bbde50ba03 Use "message" for unique_ptr<Message> variables. 2023-05-11 13:26:41 +03:00
levlam
0cc22ca3da Fix saving of are_media_timestamp_entities_found. 2023-05-11 13:20:39 +03:00
levlam
666af51345 Add MessagesManager::fix_new_message. 2023-05-11 13:12:04 +03:00
levlam
1a4e91a207 Don't try to load from database previously failed to load dialogs in add_dialog. 2023-05-11 12:14:25 +03:00
levlam
ed127c1b8d Add MessagesManager::add_dialog_for_new_message. 2023-05-11 12:12:43 +03:00
levlam
7e82f0f860 Move expected logging from ERROR to INFO. 2023-05-11 00:31:15 +03:00
levlam
372509e838 Always call on_message_deleted_from_database from delete_message_from_database. 2023-05-10 23:26:50 +03:00
levlam
151291dc50 Remove redundant assignments. 2023-05-10 23:05:34 +03:00
levlam
c612ef6764 Explicitly create Dialog before adding a message to it. 2023-05-10 20:56:33 +03:00
levlam
11210427a4 Explicitly pass from_database to add_message_to_dialog. 2023-05-10 20:41:02 +03:00
levlam
cc6082c458 Check that last and last_new messages aren't changed by bots. 2023-05-10 20:00:01 +03:00
levlam
d672fa9faa Check that database message ids aren't set for bots. 2023-05-10 19:35:11 +03:00
levlam
04d9879607 Add OrderedMessages::empty(). 2023-05-10 18:57:17 +03:00
levlam
887b69ec0e Remove unused field. 2023-05-10 15:41:57 +03:00
levlam
de22159b7f Don't keep exact remote location for bots. 2023-05-10 15:29:38 +03:00
levlam
37c46b8b12 Increase min_gzipped_size for bots. 2023-05-10 02:06:24 +03:00
levlam
59fcab80a1 Don't send updateMessageContent for yet unsent messages to bots. 2023-05-10 02:00:20 +03:00
levlam
6c5c26db7f Immediately ignore user photo if it's identifier is still the same. 2023-05-10 01:50:06 +03:00
levlam
b41bb654e4 Drop via_bot when recending failed to send message. 2023-05-10 01:13:32 +03:00
levlam
e00c66123a Reopen sessions after receiving MTPROTO_CLUSTER_INVALID. 2023-05-09 01:10:14 +03:00
levlam
c41fb7f6df Drop reopen_sessions_after_get_config_ after successful session reopen. 2023-05-09 01:08:45 +03:00
levlam
ce76e164a9 Update basic group position when it is joined or left. 2023-05-08 17:29:50 +03:00
levlam
ac8c4718d3 Reload information about empty joined chats once to check whether they are still joined. 2023-05-08 17:17:35 +03:00
levlam
cda4c97b2d Document that changePhoneNumber can be used only by the official mobile apps now. 2023-05-08 13:01:54 +03:00
levlam
a2439e9f55 Sort directly received IP addresses. 2023-05-07 01:43:00 +03:00
levlam
a05c86d6ec Improve replies for bots. 2023-05-06 21:47:10 +03:00
levlam
7eb512a0b2 Disable ordered messages for bots. 2023-05-06 02:39:17 +03:00
levlam
22a82c117d Find unloadable messages using LRU. 2023-05-06 02:37:53 +03:00
levlam
b482ffbbeb Check that bots doesn't use suffix load. 2023-05-06 01:56:29 +03:00
levlam
ad20309a1d Don't use last_new_message_id by bots. 2023-05-06 01:46:11 +03:00
levlam
47b225c11f Move limit increase to OrderedMessages::get_history. 2023-05-05 16:31:33 +03:00
levlam
aef0cfe4bc Add OrderedMessages::get_history. 2023-05-05 16:03:03 +03:00
levlam
96979d91b6 Check parameters first in MessagesManager::get_dialog_history. 2023-05-05 15:37:50 +03:00
levlam
dbcf3e5eec Use more empty names for unused parameters. 2023-05-05 14:18:46 +03:00
levlam
c0911577f7 Use empty name for unused move constructor/assignment parameter. 2023-05-05 13:51:19 +03:00
levlam
c2795ca904 Remove OrderedMessages::Iterator copy constructor. 2023-05-05 13:02:54 +03:00
levlam
a7c963dabb Add OrderedMessage::Iterator::clear. 2023-05-05 12:51:48 +03:00