Commit Graph
100 Commits
Author SHA1 Message Date
link2xt b88042a902 python: display configuration failure error
When configure fails, display error comment in pytest failure message.
2022-06-20 12:39:39 +00:00
link2xt dc29ede6e3 restore pytest-rerunfailures 2022-06-20 11:52:59 +00:00
link2xt becbb03d80 python: don't use devnull@testrun.org in test_add_remove_member_remote_events()
Otherwise testrun.org refuses to send the message at all,
because it knows devnull@testrun.org does not exist,
and the message doesn't reach ac2.
2022-06-19 17:09:02 +00:00
link2xt bc604d4c24 Do not rerun python and node tests, exit on failure 2022-06-18 01:38:31 +00:00
link2xt 10f3ad6122 configure: emit errors via DC_EVENT_CONFIGURE_PROGRESS
Node test expects progress to report either success or error
eventually.

Also update the error text expected by node test.
2022-06-17 21:58:41 +00:00
link2xt 0ed3480258 Construct event channel outside of Context
This allows account manager to construct a single event channel and
inject it into all created contexts instead of aggregating events from
separate event emitters.
2022-06-11 15:52:55 +00:00
link2xt 2361042ede Disable unused chrono crate features 2022-06-13 21:54:43 +00:00
link2xt f1ded231ed node: break the loop if dc_accounts_get_next_event() returns NULL 2022-06-13 20:01:22 +00:00
link2xt fa54e8a8ac node: increase event handler queue size to 1000
Previously used value of 1 leads to deadlocks during tests shutdown.
2022-06-13 20:01:22 +00:00
link2xt 252ef4dbfb accounts: interrupt event loop from Accounts.stop_io()
This allows to interrupt event loop via dc_accounts_stop_io() even if
there are no accounts.
2022-06-13 20:00:40 +00:00
link2xt d2d788662a node: wait for event loop to stop before freeing objects
This prevents segfaults during shutdown.
2022-06-13 19:59:33 +00:00
link2xt d947479a60 Add SimplifiedText structure
Return structure from `simplify` instead of 5-tuple.
2022-06-12 21:08:32 +00:00
link2xt 8a4e07c83e Replace Freenode references with Libera Chat 2022-06-12 19:09:29 +00:00
link2xt 776a3ecd1f mimefactory: use async_std instead of std
Read files asynchronously to avoid blocking threads.
2022-06-12 18:38:10 +00:00
link2xt 7b369c9107 Remove unused DCC_IMAP_DEBUG variable 2022-06-12 12:41:05 +00:00
link2xt 1823ee04ee Remove msgs_mdns references to deleted messages during housekeeping 2022-06-12 12:38:29 +00:00
link2xt 5c0447ee29 Replace BlobError type with anyhow 2022-06-12 00:25:20 +00:00
link2xt 29eb2cc68a Remove rustfmt.toml
It contains wrong Rust edition 2018.
Without configuration rustfmt will look into Cargo.toml
and correctly detect current edition.
2022-06-11 20:43:42 +00:00
link2xt 1a171ad494 Run Python 3 instead of Python 3.7 from run-python-test.sh
User does not necessarily have python3.7 installed,
current version is 3.10.
2022-06-11 20:39:03 +00:00
link2xt c0a17df344 Limit rate of MDNs
New ratelimiter module counts number of sent messages and calculates
the time until more messages can be sent.

Rate limiter is currently applied only to MDNs. Other messages are
sent without rate limiting even if quota is exceeded, but MDNs are not
sent until ratelimiter allows sending again.
2022-06-11 19:47:04 +00:00
link2xt e993b37f1e python: autoformat setup.py and install_python_bindings.py 2022-06-11 15:35:30 +00:00
link2xt 05abaa8461 Remove unused extern crates 2022-06-04 22:58:46 +00:00
link2xt 13e724c8ea Remove unused error module 2022-06-04 20:55:07 +00:00
link2xt 0a51db3005 Enable clippy::unused_async lint 2022-06-04 17:46:17 +00:00
link2xt 303c4f1f6d Remove Action::FetchExistingMsgs 2022-06-04 00:28:15 +00:00
link2xt 925b3e254c imex: do not remove our database if backup cannot be imported
We may still want to try importing another backup into
the same database.
2022-06-03 23:11:38 +00:00
link2xt 558850e68f sql: do not reset our database if backup cannot be decrypted 2022-06-03 23:08:31 +00:00
link2xt ce47942ba3 bump version to 1.85.0 2022-06-02 20:19:22 +00:00
link2xt aaf3a17ada python: build wheels for python 3.10
Recent manylinux2014 images contain Python 3.10 and Python 3.11.
Python 3.11 is in beta, so adding only Python 3.10.
2022-06-02 20:14:36 +00:00
link2xt 24d967d6f4 dehtml: update for quick-xml 0.23 2022-06-01 22:03:43 +00:00
link2xt aa3974abaf Revert async-global-executor to 2.0.4
2.1.0 does not support Rust 1.56.0
2022-06-01 21:29:39 +00:00
link2xt 8f8c375758 Make parse_sync_items() non-async 2022-06-01 20:59:21 +00:00
link2xt 12dd092133 Update uuid dependency 2022-06-01 20:36:27 +00:00
link2xt 93b0a3c854 cargo update 2022-06-01 20:25:52 +00:00
link2xt d5c488cc7e Reduce number of possible ongoing process states
This ensures that no invalid states are possible,
like the one where cancel channel exists, but
no ongoing process is running, or the one where
the ongoing process is not allocated, but
should not be stopped.
2022-05-29 18:23:31 +00:00
link2xt 62b50c87d4 Delete outgoing MDNs detected in the Sent folder
Gmail saves all outgoing messages to the Sent folder,
including MDNs. Delete MDNs sent by Delta Chat immediately
to keep DeltaChat or INBOX clean.
2022-05-29 17:14:07 +00:00
link2xt 3b63d40352 Update changelog 2022-05-29 17:12:25 +00:00
link2xt 25fd404273 dc_tools: replace custom InvalidEmailError with anyhow 2022-05-29 17:11:58 +00:00
link2xt 8cee14fa3a pgp: replace custom PgpKeygenError with anyhow 2022-05-29 17:11:58 +00:00
link2xt 7def6e70ba mimeparser: explicitly handle decryption errors
mimeparser now handles try_decrypt() errors instead of simply logging
them. If try_decrypt() returns an error, a single message bubble
with an error is added to the chat.

The case when encrypted part is found in a non-standard MIME structure
is not treated as an encryption failure anymore. Instead, encrypted
MIME part is presented as a file to the user, so they can download the
part and decrypt it manually.

Because try_decrypt() errors are handled by mimeparser now,
try_decrypt() was fixed to avoid trying to load private_keyring if the
message is not encrypted. In tests the context receiving message
usually does not have self address configured, so loading private
keyring via Keyring::new_self() fails together with the try_decrypt().
2022-05-28 21:08:48 +00:00
link2xt 64abe54b15 node: fix warnings about const 2022-05-24 23:54:36 +00:00
link2xt ba74a40b6d Do not skip Sent and Spam folders on Gmail
Skipping of all [Gmail] folders was introduced to avoid scanning
virtual "[Gmail]/All Mail" folder. However, it also skips Sent and
Spam folders which reside inside [Gmail]. As a result
configured_sentbox_folder becomes unset after folder scan, making it
impossible to watch Sent folder, and Spam folder is never scanned.

This change makes Delta Chat identify virtual Gmail folders by their
flags, so virtual folders are skipped while Sent and Spam folders are
still scanned.
2022-05-21 13:04:53 +00:00
link2xt ba0f5ee81d securejoin: replace thiserror with anyhow
Refactoring to reduce the number of custom error types.
2022-05-21 13:04:53 +00:00
link2xt 0725fe38f8 Disable clippy unwrap/expect lints again
They still fail on tests
2022-05-21 14:12:23 +00:00
link2xt 73341394ee Reduce unwrap and expect usage 2022-05-21 14:12:23 +00:00
link2xt 9c41f0fdb9 Fix failure to decrypt first message to self after key change
The problem was in the handle_fingerprint_change() function which
attempted to add a warning about fingerprint change to all chats with
the contact.

This failed because of the SQL query failing to find the contact for
self in the `contacts` table. So the warning was not added, but at the
same time the whole decryption process failed.

The fix is to skip handle_fingerprint_change() for self addreses.
2022-05-23 10:09:29 +00:00
link2xt 1d522edb01 python: fix Chat.is_group() documentation
False is returned not only for 1:1 chat, but also in
other cases, such as mailing lists.
2022-05-23 11:56:56 +02:00
link2xt b7d2828f60 Trim last newline in the chat encryption info
Android seems to display it, making the message box larger.
2022-05-21 17:03:48 +00:00
link2xt deece15648 imap: do not unnecessarily SELECT folder in move_delete_messages()
If there are no MOVE/DELETE operations pending, the folder
should not be SELECTed.

When `only_fetch_mvbox` is enabled, `fetch_new_messages` skips
most folders, but `move_delete_messages` always selects the
folder even if there are no operations pending. Selecting
all folders wastes time during folder scan and turns
recent messages into non-recent.
2022-05-21 15:09:46 +00:00
link2xt d06683489f Update to Rust 1.61.0 2022-05-21 14:28:55 +00:00
link2xt 6d189dab98 Fix race condition in alloc_ongoing()
Hold the same write lock while checking if ongoing
process is already allocated and while allocating it.
Otherwise it is possible for two parallel processes
running alloc_ongoing() to decide that no ongoing
process is allocated and allocate two ongoing processes.
2022-05-17 18:25:51 +02:00
link2xt 47db1349a9 securejoin: remove unused error types related to ongoing processes
securejoin no longer allocates ongoing processes
2022-05-16 21:50:45 +02:00
link2xt d790a5fba9 Update link to K-9 Mail blog post 2022-05-15 23:38:27 +00:00
link2xt 715664273b Repair encrypted mails turned into attachments
Google Workspace has an option "Append footer" which appends standard
footer defined by administrator to all outgoing messages. However,
there is no plain text part in encrypted messages sent by Delta Chat,
so Google Workspace turn the message into multipart/mixed MIME, where
the first part is an empty plaintext part with a footer and the second
part is the original encrypted message.

This commit makes Delta Chat attempt to repair such messages,
similarly to how it already repairs "Mixed Up" MIME structure in
`get_mixed_up_mime`.
2022-05-14 15:18:51 +00:00
link2xt 8168bcece5 Improve Chat.get_encryption_info() format
Group contacts by peerstate and make it easier
to find contacts that prevent encryption by sorting them
to the top of the list.
2022-05-14 14:01:46 +02:00
link2xt bd5b9573f6 Deprecate marker1before argument of dc_get_chat_msgs() 2022-05-13 20:55:43 +02:00
link2xt 5a85255be9 Reduce number of generic impl AsRef 2022-05-08 21:21:40 +00:00
link2xt 60d3960f3a scheduler: make Scheduler stateless
Scheduler has no Stopped state anymore. If Scheduler exists, it is
always started. Scheduler is stopped via Scheduler.stop(), which
consumes Scheduler and cannot fail.
2022-05-08 18:53:15 +00:00
link2xt 7bcb03f1ec Replace SendMdn job with smtp_mdns table
Unlike jobs which are executed before sending normal messages, MDNs
from `smtp_mdns` table are sent after sending messages from `smtp`
table. This way normal messages have higher priority than MDNs.

There are no SMTP jobs anymore. All jobs are IMAP jobs, so
`jobs.thread` column is not used anymore.
2022-05-08 18:33:41 +00:00
link2xt 904e8966c0 Replace location jobs with async location loop
Locations are now sent in the background regardless
of whether SMTP loop is interrupted or not.
2022-05-01 23:08:34 +00:00
link2xt 3a10f0155f Remove panics from the scheduler and simplify start/stop_io()
Hold scheduler lock during the whole procedure of scheduler starting
and stopping. This ensures that two processes can't get two read locks
in parallel and start loops or send the stop signal twice.

Also remove shutdown channels: it is enough to wait
for the loop handle without receiving a shutdown signal
from the end of the loop.
2022-04-30 18:08:01 +00:00
link2xt 48f2c4e14b Correctly escape messages consisting of a dot in SMTP protocol
Actual bugfix is in the async-smtp crate.
2022-04-30 13:30:31 +00:00
link2xt aae4f0bb7b Trash location.kml messages
Assign location.kml message parts to the trash chat,
but return non-trash chat_id so locations are assigned
to the correct chat.

Due to a bug introduced in
7968f55191
previously location.kml messages resulted in
empty message bubbles on the receiver.
2022-04-24 19:43:59 +00:00
link2xt d033dcf395 Run python tests in a single thread
Work around mailcow rate limits
2022-04-25 15:43:47 +02:00
link2xt 5ef2a85c10 python: do not crash in get_locations() when location has no marker 2022-04-25 15:05:34 +02:00
link2xt 8c0bc9080c Create "Junk" folder in test_dont_show_emails()
This folder may not exist on the test server.
2022-04-24 00:20:41 +00:00
link2xt 6bf2c5415f Don't count IMAP jobs in scheduler
The limit on the number of jobs executed in a row was introduced to
prevent large queues of small jobs like MarkseenMsgOnImap, MoveMsg and
DeleteMsgOnImap from delaying message fetching. Since all these jobs
are now removed and IMAP operations they did are now batched, it is
impossible to have 20 or more queued IMAP jobs.
2022-04-23 19:53:10 +00:00
link2xt 2f31033a88 Ignore messages from all spam folders if there are many
For example, if there is both a Spam and Junk folder,
both of them should be ignored, even though only one
of them can be a ConfiguredSpamFolder.
2022-04-23 19:23:31 +00:00
link2xt 9ef0b43c36 Remove job::{Action,Thread}::Unknown variants 2022-04-17 00:00:00 +00:00
link2xt dfbfd4fe74 Remove housekeeping job
Run housekeeping directly from the inbox loop
instead of creating inbox loop job.
2022-04-17 00:00:00 +00:00
link2xt a8cf05ea5d accounts: retry remove_account multiple times on failure
When removing an account, try 60 times with 1 second sleep in between
in case removal of database files fails. This happens on Windows
platform sometimes due to a known bug in r2d2 which may result in 30
seconds delay until all connections are closed [1].

[1] https://github.com/sfackler/r2d2/issues/99
2022-04-19 14:14:38 +02:00
link2xt a63464765c dc_receive_imf: remove Received: based draft detection heuristic
Proper draft detection was implemented in
bf7f64d50b

Removing this heuristic also removes the need to pass IMAP folder name
around.
2022-04-17 00:00:00 +00:00
link2xt e9fe8ce118 Merge branch 'markseen-imap-loop' 2022-04-17 17:55:25 +03:00
link2xt 1fa892c239 Rename store_seen_flags into store_seen_flags_on_imap 2022-04-17 14:55:10 +00:00
link2xt 1afbbbc737 Rename markseen_on_imap to markseen_on_imap_table and document it 2022-04-17 11:56:48 +00:00
link2xt 66c4de2607 Mark messages as seen in IMAP loop
MarkseenMsgOnImap job, that was responsible for marking messages as
seen on IMAP and sending MDNs, has been removed.

Messages waiting to be marked as seen are now stored in a
single-column imap_markseen table consisting of foreign keys pointing
to corresponding imap table records.

Messages are marked as seen in batches in the inbox loop. UIDs are
grouped by folders to reduce the number of requests, including folder
selection requests. UID grouping logic has been factored out of
move_delete_messages into UidGrouper iterator to avoid code duplication.

Messages are marked as seen right before fetching from the inbox
folder. This ensures that even if new messages arrive into inbox while
the connection has another folder selected to mark messages there, all
messages are fetched before going IDLE. Ideally marking messages as
seen should be done after fetching and moving, as it is a low-priority
task, but this requires skipping IDLE if UIDNEXT has advanced since
previous time inbox has been selected. This is outside of the scope of
this change.

MDNs are now queued independently of marking the messages as seen.
SendMdn job is created directly rather than after marking the message
as seen on IMAP. Previously sending MDNs was done in MarkseenMsgOnImap
avoid duplicate MDN sending by setting $MDNSent flag together with
\Seen flag and skipping MDN sending if the flag is already set. This
is not the case anymore as $MDNSent flag support has been removed in
9c077c98cd and duplicate MDN sending in
multi-device case is avoided by synchronizing Seen status since
833e5f46cc as long as the server
supports CONDSTORE extension.
2022-04-17 09:50:04 +00:00
link2xt 213e67dea2 Merge branch 'faster_fetch' 2022-04-17 09:47:42 +00:00
link2xt 86c884fe1e Update the comment before delete_expired_imap_messages 2022-04-17 09:47:17 +00:00
link2xt 14ab3c8651 Remove unused stop-token dependency
stop-token 0.2.0 is required by async-imap. This Cargo.toml entry
additionally pulled in unused stop-token 0.7.0.
2022-04-16 11:24:23 +00:00
link2xt f75f8ad76d Interrupt ephemeral loop when new messages are fetched 2022-04-12 22:26:44 +00:00
link2xt 574b78cf31 Interrupt ephemeral loop when delete_device_after is set 2022-04-12 22:26:44 +00:00
link2xt 92f0e8472b Take delete_device_after into account when calculating ephemeral loop timeout 2022-04-12 22:26:44 +00:00
link2xt 26c38070ec Disable unused async-smtp transports
By default file and sendmail transports are enabled,
but deltachat does not use them.
2022-04-09 11:36:32 +00:00
link2xt 494a7f1db9 Update to Rust 1.60
It re-enables incremental compilation.
2022-04-09 09:10:51 +00:00
link2xt de91063fbe scheduler: add comment about fake-idle timeout 2022-04-03 19:30:56 +00:00
link2xt 3d95272707 smtp: retry message sending automatically if loop is not interrupted 2022-04-03 18:55:29 +00:00
link2xt a8ab7c9c04 smtp: do not try to use stale connections
Previously first try used an old connection and. If using stale
connection, an immediate retry was performed using a new connection.

Now if connection is stale, it is closed immediately without trying to
use it.

This should reduce the delay in cases when old connection is unusable.
2022-04-03 13:11:27 +00:00
link2xt 332892b468 ephemeral: clear more fields in delete_expired_messages
These fields are cleared in other places,
but in the case of delete_device_after setting
only txt column was cleared previously.
2022-04-02 17:10:09 +00:00
link2xt 6392300311 job: remove unnecessary anyhow::Error import 2022-04-02 17:06:22 +00:00
link2xt 8c2b9f9901 Do not overwrite better_msg if apply_group_changes returns None 2022-03-27 11:23:45 +00:00
link2xt e9a733a789 Pass better message around instead of mutating mimeparser
This change is aimed at decoupling parsing and
add_parts() stages to eventually separate parsing
from database changes and pipeline message parsing and
decryption.
2022-03-27 11:23:45 +00:00
link2xt 33ba8dabe0 Increase python test timeout 2022-03-27 08:48:43 +00:00
link2xt 0842e54f52 Add ephemeral_timestamp index for msgs table
This reduced get_chat_msgs() benchmark time from 400ms to 170ms.
2022-03-26 20:19:49 +00:00
link2xt 08d34e41c6 Return results from add_parts() via structure
Replaced mutable out parameters with explicit return of structure.
Also moved all decisions about emitted events out of add_parts(). Chat
ID is removed from created_db_entries as it is the same for all parts.
2022-03-26 16:38:08 +00:00
link2xt 26ae8accd4 Automatically unblock chats with outgoing messages 2022-03-20 18:03:10 +00:00
link2xt 7d26968bb3 Try to start ephemeral timers only if some message has nonzero timer 2022-03-20 18:12:01 +00:00
link2xt 83464a882e Optimize markseen_msgs
Use a single SELECT statement for all messages
and start ephemeral timers for all messages at once.
2022-03-20 14:57:14 +00:00
link2xt a3ba19db96 Resultify delete_poi_location() 2022-03-19 17:29:54 +00:00
link2xt d9e9c849e1 imap: do not delete duplicates
Currently if user moves the message into some other folder and then
moves the message back, the message is considered duplicate even
though previous copy was already deleted. This is a common problem
reported by users at least twice.

Keeping duplicates does no harm except for additional storage usage.
If the message is later deleted by the user, all the copies on the
server will be deleted. anyway.
2022-03-19 15:51:17 +00:00
link2xt a997322efb Update MSRV to 1.56 and current version to 1.59
This is needed to support Rust 2021 edition required by the latest versions of `ed25519` and `image` crates.
2022-03-16 10:56:16 +01:00