Commit Graph
100 Commits
Author SHA1 Message Date
Alexander Krotov 1c73021d77 Update rust toolchain to 1.45.0 2020-07-17 01:08:32 +03:00
Alexander Krotov 6067d40a6f cargo fmt 2020-07-16 11:55:51 +02:00
Alexander Krotov cde587fefa idle: drain unsolicited response channel
This prevents multiple unsolicited messages from skipping multiple IDLEs.
Also skip IDLE only if an EXISTS message was received.
2020-07-16 11:55:51 +02:00
Alexander Krotov f461e2a2fd import_backup: do not load all blobs into memory at once 2020-07-16 10:58:52 +02:00
Alexander Krotov 667364b90e Mark location-only messages as auto-generated 2020-07-15 02:16:20 +03:00
Alexander Krotov 7bb6890f26 Send MDNs for messages deleted on the server
Now MarkseenMsgOnImap sends MDN even if it can't mark the message as
seen on the server.

To prevent multiple MDNs from being sent, MarkseenMsgOnImap is postponed
until the message is detected in a folder from which it is not going to
be moved.
2020-07-14 23:26:48 +03:00
Alexander Krotov 2aa808756e Add test for MDN not sent for server deleted messages 2020-07-14 23:26:48 +03:00
Alexander Krotov 81a2e510f5 Move proxy.py from scripts/ to contrib/
This change makes it clear that core does not depend on this code.
2020-07-14 20:41:38 +02:00
Alexander Krotov 6902250d6b securejoin: do not check the signatures existance twice
Mimeparser.was_encrypted() checks if the message is an Autocrypt encrypted
message. It already means the message has a valid signature.

This commit documents a few functions to make it clear that signatures
stored in Mimeparser must be valid and must always come from encrypted
messages.

Also one unwrap() is eliminated in encrypted_and_signed(). It is possible
to further simplify encrypted_and_signed() by skipping the was_encrypted()
check, because the function only returns true if there is a matching
signature, but it is helpful for debugging to distinguish between
non-Autocrypt messages and messages whose fingerprint does not match.
2020-07-13 12:36:14 +02:00
Alexander Krotov 6cb75114c1 Cleanup test_basic_imap_api() 2020-07-13 01:53:28 +03:00
Alexander Krotov d54ade5891 Start ephemeral timer for non-fresh messages 2020-07-13 01:20:16 +03:00
Alexander Krotov 0da21aa9f6 dc_receive_imf: rename timer into ephemeral_timer 2020-07-13 01:15:51 +03:00
Alexander Krotov 1e84e81e7d imap: expunge folder before IDLE if needed
This ensures Inbox is expunged timely in setups that don't watch
DeltaChat folder.
2020-07-13 00:54:20 +03:00
Alexander Krotov d3eb209d27 Add test for immediate server deletion 2020-07-13 00:54:20 +03:00
Alexander Krotov 49a6a5b23c testplugin.py: print HTTP response text on error 2020-07-12 22:58:57 +03:00
Alexander Krotov 4f78e2e14e Do not show an error on IMAP connection failure
It is annoying as it happens every time the server is rebooted.
2020-07-12 17:17:26 +02:00
Alexander Krotov 7da69a4644 Add dc_msg_get_ephemeral_{timer, timestamp}() 2020-07-11 22:25:17 +03:00
Alexander Krotov 8efe7cade7 Rename part_mut into part 2020-07-11 21:43:02 +03:00
Alexander Krotov 18e4abc1df Remove some and deny new indexing and slicing 2020-07-11 21:43:02 +03:00
Alexander Krotov e2c532704a Fix documentation typo 2020-07-11 00:04:38 +03:00
Alexander Krotov f28a0db7d0 Store typed timer in ChatEphemeralTimerModified event 2020-07-10 02:55:17 +03:00
Alexander Krotov e5d5009d6a Emit ChatEphemeralTimerModified when user changes the timer 2020-07-10 02:52:45 +03:00
Alexander Krotov 0ae8663eed imap: call dc_receive_imf sequentially
Parallel processing of messages results in bugs such as messages sent by
a new member being processed before the message that adds this member to
the chat, even when it has lower UID. In this case, messages are shown as
"[Unknown sender for this chat. See 'info' for more details.]", while
there is a message "Member ... added" right before, because writing the
information about new member to the database takes longer then reading
old index from the database.
2020-07-10 00:40:52 +03:00
Alexander Krotov d1ec0e2de6 Fix Chatlist::try_load() doc comment 2020-07-09 23:19:33 +03:00
Alexander Krotov 7f8f871813 Make ephemeral timer changes not ephemeral 2020-07-08 20:25:05 +03:00
Alexander Krotov 43c4816739 Display source for IMAP IDLE errors 2020-07-08 01:32:49 +03:00
Alexander Krotov 1b5d08e6ee Start ephemeral timers during housekeeping 2020-07-08 01:16:01 +03:00
Alexander Krotov bb9603661a Fix a typo 2020-07-07 22:38:50 +03:00
Alexander Krotov d9314227ee Do not duplicate system messages about timer changes
Instead, replace them with localized stock strings using set_better_msg.
2020-07-02 14:20:55 +03:00
Alexander Krotov 6050f0e2a1 Always schedule next ephemeral task after message deletion
If no messages were deleted, it means the task was scheduled earlier
then needed and should be rescheduled.
2020-07-01 22:18:36 +03:00
Alexander Krotov d4dea0d5c6 Schedule ephemeral task 1 second later
This accounts for 1-second rounding, otherwise the task is always too early.
2020-07-01 22:18:36 +03:00
Alexander Krotov 0b187131b2 Cargo.toml: disable LTO 2020-07-01 20:35:50 +03:00
Alexander Krotov 5a28b669f9 Set ephemeral timer for info messages 2020-07-01 20:32:37 +03:00
Alexander Krotov d59475f9bb Fix a typo in UnknownSenderForChat 2020-07-01 19:11:48 +03:00
Alexander Krotov db6623d0cf Add stock strings for ephemeral timer changes 2020-07-01 12:31:51 +03:00
Alexander Krotov 059caee527 Add "by me" to "Ephemeral message timer changed to"
Otherwise this message looks different on other devices of the sender.
2020-07-01 12:31:51 +03:00
Alexander Krotov 97599bd78e dc_array: remove unused binding 2020-07-01 12:31:11 +03:00
Alexander Krotov d6b30c9703 Fix python test for ephemeral timer 2020-07-01 09:32:08 +03:00
Alexander Krotov 7a7dcc8b8f constants.rs: remove unused DC_STR_* constants
They are also outdated.
2020-07-01 07:55:22 +03:00
Alexander Krotov d79c918c9e Replace 1 with DC_CONTACT_ID_SELF 2020-07-01 00:59:07 +03:00
Alexander Krotov 56518420bc Add get_marker method to dc_array_t 2020-06-30 01:21:18 +03:00
Alexander Krotov 615a76f35e Add timestamp to DayMarker
With this change, API user does not need to look at the timestamp of
the next message to display the day marker, but can get the timestamp
directly from the marker. This way there is no database query and no
risk of error as a result of database being busy or message being deleted.
2020-06-30 01:21:18 +03:00
Alexander Krotov 0c47489a3b Use ephemeral::Timer in MsgId.ephemeral_timer() method 2020-06-29 23:04:34 +03:00
Alexander Krotov f931a905a7 Remove useless comment 2020-06-29 23:04:34 +03:00
Alexander Krotov 7d048ac419 Add autodelete timers 2020-06-29 23:04:34 +03:00
Alexander Krotov 41fe3db79d Add ChatItem type
ChatItem can represent markers as enum variants instead of special MsgIds.
2020-06-29 00:30:17 +03:00
Alexander Krotov 42f6a7c77c Remove dc_array_get_raw
It does not work with typed arrays, such as locations and messages.

Use dc_array_get_id in a loop instead.
2020-06-26 01:22:10 +03:00
Alexander Krotov 09833eb74d dc_array: introduce MsgIds variant
This avoids allocation of u32 vector.
2020-06-26 01:22:10 +03:00
Alexander Krotov 2c11df46a7 dc_array: remove unnecessary "as u32" cast 2020-06-26 01:22:10 +03:00
Alexander Krotov 443ad04f46 Mark all dc_array method as pub(crate)
This make it easier to find unused methods.
2020-06-26 01:22:10 +03:00
Alexander Krotov f2d09cc51e dc_array: simplify and test search_id
This also makes it possible to search for location IDs.
2020-06-26 01:22:10 +03:00
Alexander Krotov 83dde57afa Remove unused dc_array methods 2020-06-26 01:22:10 +03:00
Alexander Krotov fdacf98b69 handle_mdn: compare from_id to DC_CONTACT_ID_LAST_SPECIAL
DC_MSG_ID_LAST_SPECIAL has the same value, but from_id is not a msg id.
2020-06-26 01:11:15 +03:00
Alexander Krotov 93797bc82f Switch to sanitize-filename-reader-friendly
One advantage is that it does not depend on any crates, so there is a
higher chance of dropping regex crate eventually.
2020-06-23 14:37:35 +03:00
Alexander Krotov a031151587 Fix two +nightly clippy suggestions 2020-06-23 03:17:07 +03:00
Alexander Krotov 8de1bc6cbd sql: fix potential panic in maybe_add_file
When maybe_add_file was called with "$BLOBDIR" it tried to remove 9
bytes from the string, while it only contains 8.
2020-06-22 13:22:37 +03:00
Alexander Krotov cf09942737 deltachat-ffi: use as_deref() as suggested by clippy 2020-06-22 12:37:29 +03:00
Alexander Krotov e3af3a24a8 README: add link to Free Pascal bindings 2020-06-21 20:14:30 +03:00
Alexander Krotov 7bfadb14ea Fix a typo (prover -> provider) 2020-06-21 20:13:06 +03:00
Alexander Krotov 2a623541d7 configure/mod.rs: forbid indexing and slicing 2020-06-19 14:24:53 +03:00
Alexander Krotov 0007e93e80 scheduler: forbid indexing and slicing 2020-06-19 14:24:53 +03:00
Alexander Krotov c655fd8a64 contact: forbid indexing and slicing 2020-06-19 14:24:53 +03:00
Alexander Krotov ad531876fd contact: simplify name normalization
This removes one indexing operation and reduces surprises when comma
means something other than first name and last name separator.
2020-06-19 14:24:53 +03:00
Alexander Krotov 53bee68acb smtp/mod.rs: forbid indexing and slicing 2020-06-19 00:56:01 +03:00
Alexander Krotov b5400cf551 Refactor imap/mod.rs to avoid indexing
Also replace assert! with debug_assert!
2020-06-19 00:56:01 +03:00
Alexander Krotov baba91c054 pgp: refactor and document pk_decrypt()
Avoid unnecessary indexing, decompress only once and check if the message
is Signed before trying to verify it.
2020-06-17 11:48:29 +03:00
Alexander Krotov 7d80179ed1 Re-enable lto=true for release builds 2020-06-16 23:12:07 +03:00
Alexander Krotov f7c7f414ed refactor: remove .unwrap() from Peerstate.has_verified_key() 2020-06-15 00:47:25 +03:00
Alexander Krotov dad6381519 run_bot_process: remove account from _accounts before starting the bot
Otherwise wait_configure_and_start_io() will start account, and it will
operate on the same database as the bot.
2020-06-13 06:36:07 +02:00
Alexander Krotov e03246d105 refactor: replace calc_timestamps with calc_sort_timestamp 2020-06-12 09:13:56 +02:00
Alexander Krotov f5156f3df6 IMAP: logout from the server with a LOGOUT command
CLOSE, which was used previously, only expunges messages and deselects
folder, and it should only be called if some folder is selected. For that,
Imap.close_folder() method is used.
2020-06-11 13:54:14 +02:00
Alexander Krotov 19b53c76da Add strict_tls support 2020-06-10 10:52:53 +03:00
Alexander Krotov 7de23f86b1 Do not reply to messages that can't be decrypted
This commit fixes the test broken in previous commit.
2020-06-08 23:16:35 +02:00
Alexander Krotov 35566f5ea5 Extend undecipherable group test
Reply to group messages assigned to 1:1 chat on ac4 and see where they
end up on ac1 and ac2. Currently they contain group ID in Reply-To field
and go to group chat, so the test is failing.
2020-06-08 23:16:35 +02:00
Alexander Krotov 34579974c3 Don't make ad-hoc groups when message cannot be decrypted
This fixes the test added in the parent commit.
2020-06-08 23:16:35 +02:00
Alexander Krotov c6f19ea0a4 Add failing test for undecipherable group messages 2020-06-08 23:16:35 +02:00
Alexander Krotov 64ab955ad7 create_or_lookup_group: streamline group ID parsing 2020-06-08 19:25:36 +03:00
Alexander Krotov 39faddc74d create_or_lookup_adhoc_group: move comment to the correct place
The comment is related to member list processing, not mailing list check.
2020-06-08 08:30:26 +03:00
Alexander Krotov f0f020d9d2 chat: get rid of ChatId.is_error()
get_rowid should not return 0, as we have inserted a row right above.

And using is_error() instead of comparing row_id to 0 is a strange way
to check this condition.

As all functions that actually returned 0 chat ID to indicate error have
been removed, the function is gone too.
2020-06-06 19:49:57 +03:00
Alexander Krotov 5239f2edad dc_receive_imf: replace chat_id.is_error() with chat_id.is_unset()
Both methods do the same: compare chat_id to 0. However, in these cases
0 refers to the state when chat_id is not determined yet, because no
corresponding chat has been found.

All functions that returned 0 to indicate error have already been
resultified.
2020-06-06 18:29:35 +03:00
Alexander Krotov cd751a64cb python tests: fix typos 2020-06-06 16:11:59 +03:00
Alexander Krotov 6d9ff3d248 Enable strict TLS certificate checks by default 2020-06-06 00:08:29 +02:00
Alexander Krotov 3e2bfc35e3 Delete hidden expired messages
The condition remains from the time when expired messages were hidden
instead of being moved into trash chat. As a result, old hidden
messages, such as location messages, were not deleted.
2020-05-15 20:46:41 +03:00
Alexander Krotov 3ee81cbee0 Revert "imap: simplify select_folder() interface"
This reverts commit b614de2f80.
2020-05-13 11:36:33 +02:00
Alexander Krotov c185d5b0b5 Fix python lint error about unused format 2020-05-12 11:02:27 +02:00
Alexander Krotov cc56edc91d Log precheck_imf errors 2020-05-11 00:19:14 +03:00
Alexander Krotov c36227e2fc Better SMTP ErrorNetwork message
It uses stock string, just as for IMAP errors, and is distinguishable
from IMAP errors: protocol is specified in the error message now.
2020-05-10 23:24:03 +03:00
Alexander Krotov 2f6bae4e2a sql: do not send DC_EVENT_ERROR on database errors
These errors are usually just "database busy" errors, it is enough to
write them to the log instead of displaying to the user.
2020-05-10 17:51:01 +03:00
Alexander Krotov 0fefe11bfd Do not return "empty rfc724_mid" errors from rfc724_mid_cnt
This function should only return temporary errors, e.g. database errors,
as precheck_imf() and dc_receive_imf::add_parts() treat them as such,
retrying the fetch on failure. When permanent errors, like missing
Message-ID, are bubbled up, they cause infinite fetch loop.
2020-05-10 16:43:26 +03:00
Alexander Krotov 2dbb1bbbea Do not reply to hidden messages
Especially with read receipts, it is wrong, because they are never
encrypted and their Message-IDs are not known to other users in a group.
2020-05-09 19:11:23 +03:00
Alexander Krotov 5fd9b20213 Parse attachment filenames from Content-Type "name" attribute
Outlook specifies filename there and omits Content-Disposition.
2020-05-06 00:37:36 +03:00
Alexander Krotov 6543c7c26f fetch_single_msg: do not ignore dc_receive_imf errors
If error is ignored, the message will never be fetched again, even if
there was a database write error.

dc_receive_imf itself is modified to ignore unrecoverable errors, to
prevent endless refetching of incorrect messages.
2020-05-04 18:19:32 +03:00
Alexander Krotov 3035c8af30 Always describe the context of the displayed error 2020-05-04 16:35:42 +03:00
Alexander Krotov e8763e936d imap: simplify select_folder() interface
Accept AsRef<str> instead of Option<impl AsRef<str>>.

There is no need to pass None to force expunge anymore.
2020-04-30 23:48:41 +03:00
Alexander Krotov c41a6b87b8 imap: always close folder before selecting if expunge is needed 2020-04-30 23:48:41 +03:00
Alexander Krotov 46253039df Return BTreeMap instead of HashMap from get_info()
BTreeMap is sorted by keys when iterated, making it easier to find the
required line.
2020-04-28 21:26:04 +03:00
Alexander Krotov 46fb6a21ee job: perform no more than 20 IMAP jobs in a row
Let the thread load new messages. This may happen when user switches
the setting to delete messages on the server on and there are a lot of
messages to delete.
2020-04-25 01:43:35 +03:00
Alexander Krotov fc03f4c87a job: generate IMAP deletion jobs dynamically
This prevents generation of a large number of jobs when IMAP deletion
setting is enabled for the first time. Writing jobs to the database
locks it for readers and may cause UI freezing, because chatlist and
messages can't be read until all jobs are written.

Note that on failure job will be written to the database, to make sure
it is postponed instead of being retried immediately.
2020-04-24 21:06:57 +03:00
Alexander Krotov 502ec2a56f job: new API for dynamic job creation
Job::new() can be used to create jobs in-memory

Job.update() is replaced with Job.save() which can create new database
entries and consumes Job to avoid the need to update job ID after saving
it to the database.
2020-04-24 21:06:57 +03:00
Alexander Krotov 66d5c3f620 job: derive PartialEq for Action
This makes it possible to compare action priorities in Rust code.
2020-04-24 21:06:57 +03:00