Alexander Krotov
3ee81cbee0
Revert "imap: simplify select_folder() interface"
...
This reverts commit b614de2f80 .
2020-05-13 11:36:33 +02:00
Alexander Krotov
cc56edc91d
Log precheck_imf errors
2020-05-11 00:19:14 +03:00
bjoern
c5eb112f5a
Merge pull request #1465 from deltachat/smtp-network-error
...
Better SMTP ErrorNetwork message
2020-05-10 23:05:20 +02:00
B. Petersen
aa292ac6b8
do normal receive_imf() if message-id is empty or if prefetch failed for other reasons. there are servers not sending a message ids, this and other cases is handled in receive_imf() - but not in prefetch (would be too much to maintain, also we need more information). this normal processing also prevents trying over the same message over and over as the server_uid is updated.
2020-05-10 22:43:04 +02: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
Hocuri
a586a1d525
Fix #1120 Contact requests are not shown when name of sender includes a comma character ( #1438 )
...
* First try making get_recipients use MailHeader (nice and functional)
* Get it to compile by using not-so-functional style
* Add "empty-from" test, drop unnecessary check for error; continue using addrparse_header() instead of addrparse()
* Try to use functional style, unfortunately, I can't get the compiler to accept it
* Do it imperative-style: Do not overwrite To with Cc and vice versa
* Use addrparse_header() once more
* Still addrparse_header()
* Clippy
* Fix compile errors in tests
* Fix typo
* Fix tests again ;-)
* Code style
* Code style; try a HashMap<addr: String, display_name: String> as an address list but I am not convinced
* Code style; Use Vec<SingleInfo> as address list
* Clippy
* Add tests
* Add another test
* Remove stale comments
2020-05-07 13:55:09 +02: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
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
979d7c5625
Do not ignore database read errors in precheck_imf
...
If precheck_imf fails to check if message with the same rfc724_mid
already exists, the same message may be downloaded twice. Instead,
abort the whole operation and retry later.
2020-04-23 15:36:45 +03:00
Friedel Ziegelmayer
24f4cbbb27
refactor: replace failure
...
- failure is deprecated
- thiserror for deriving Error impl
- anyhow for highlevel error handling
2020-04-10 22:39:28 +02:00
Alexander Krotov
3163ef87c6
imap: display errors with {}, not {:?}
2020-04-01 23:27:15 +03:00
Alexander Krotov
33150615a1
Improve logging for server UID updates in precheck_imf()
...
Log all folders and UIDs and warn about UID changes without folder change.
2020-04-01 20:06:27 +03:00
Alexander Krotov
65fdfac866
Remove unused dest_uid argument from Imap.mv()
...
It was always set to 0 because we don't know the destination UID.
2020-04-01 20:06:27 +03:00
Alexander Krotov
efb7280e99
Do not schedule delayed DeleteMsgOnImap jobs
...
All IMAP deletion jobs are scheduled either immediately, or later by
job::add_imap_deletion_jobs().
2020-04-01 20:06:27 +03:00
Alexander Krotov
6db03356b5
Return AlreadyDone from Imap.delete_msg if message is gone
...
This way DeleteMsgOnImap will remove invalid server_uid from the database.
2020-04-01 20:06:27 +03:00
Alexander Krotov
8f7a456a39
Use 0 value for "delete_server_after" default.
...
Now 0 means "never delete", 1 means "delete at once" and other values
indicate the number of seconds after which them message should be
deleted from the server.
Configuration value interpretation is moved into
Context.get_config_delete_server_after() function.
2020-04-01 20:06:27 +03:00
Alexander Krotov
6d216af507
Delete BCC-self messages after "delete_server_after" time
2020-04-01 20:06:27 +03:00
Alexander Krotov
98bd64621a
Refactor Imap.delete_msg() error handling
...
Mutable UID reference is removed. Instead, ImapActionResult is
returned immediately.
If message has changed and UID does not correspond to expected
message, ImapActionResult::Failed is returned. Temprorary IMAP errors
result in ImapActionResult::RetryLater.
On the job side, ImapActionResult::RetryLater does not result in
immediate job retry anymore. Instead, job is retried with a backoff.
2020-04-01 20:06:27 +03:00
Alexander Krotov
d78ea882c8
Update mailparse to 0.12
2020-03-31 18:11:44 +02:00
B. Petersen
e09a0a548f
using first() instead of [0]
2020-03-25 18:10:02 +01:00
B. Petersen
ab8d75b192
remove now unused ImapConfig.imap_delimiter
2020-03-25 13:23:29 +01:00
B. Petersen
e135c969c9
figure out and use folder-delimiter provided by LIST command
2020-03-25 13:16:23 +01:00
B. Petersen
36e7090466
force folder-reconfigure on dc_configure()
2020-03-25 02:39:48 +01:00
B. Petersen
f28f177c6b
use constant for folders_configured cache
2020-03-24 19:18:18 +01:00
Alexander Krotov
4714fb6887
Reset server_folder and server_uid in Imap.empty_folder()
...
This way we avoid trying to delete already deleted messages in the future.
2020-03-09 01:21:12 +03:00
Alexander Krotov
3c342339a1
imap: use parse_message_id from mimeparser
2020-02-22 16:41:07 +01:00
Alexander Krotov
33463856c5
Use mailparse::msgidparse to parse Message-IDs
2020-02-22 16:41:07 +01:00
Alexander Krotov
6b6be3b03d
Fix some "`" code markup
2020-02-18 05:06:11 +03:00
Alexander Krotov
1fa9aa88a8
Search for Flag::Deleted and Flag::Seen with == instead of match
2020-02-17 10:50:34 +01:00
Alexander Krotov
08c77c2668
fetch_single_msg: use if let Some(...) instead of is_empty()
2020-02-17 10:50:34 +01:00
Alexander Krotov
793ebe1b0f
imap: move IdleHandle from session.rs to idle.rs
2020-02-17 10:50:34 +01:00
Alexander Krotov
4c42acc7e1
Factor src/imap/session.rs out of src/imap/client.rs
2020-02-17 10:50:34 +01:00
Alexander Krotov
4eb9660bfa
Move src/imap_client.rs into src/imap/client.rs
2020-02-17 10:50:34 +01:00
Alexander Krotov
772127d9d8
Remove outdated comment
...
delete_msg no longer returns an integer
2020-02-16 03:43:25 +03:00
Alexander Krotov
04bb6997a2
Remove unused imap::idle::Error::ImapError variant
2020-02-14 22:33:36 +01:00
Alexander Krotov
9008a65c14
Remove DC_IMAP_SEEN constant
...
Replace "flags" integer with a "seen" boolean.
2020-02-13 13:55:06 +01:00
Alexander Krotov
4e07e4c7f3
Fix a typo (bbc-self instead of bcc-self)
2020-02-12 23:15:04 +03:00
Alexander Krotov
beb91271de
Unlock session before calling add_flag_finalized
...
add_flag_finalized tries to lock session again and IMAP thread deadlocks
if session is not unlocked.
2020-02-12 11:38:18 +00:00
Alexander Krotov
7e9585ebc5
cargo fmt
2020-02-12 11:38:18 +00:00
Alexander Krotov
0c4b3f71e5
Check for MOVE capability before using MOVE command
2020-02-12 11:38:18 +00:00
holger krekel
875e89e71a
better event information for moved messages
2020-02-11 20:38:14 +01:00
Alexander Krotov
66fdb447f7
Rename get_headerdef into get_header_value
2020-02-11 01:59:41 +03:00
Alexander Krotov
c801775a39
Implement get_headerdef method for MailHeader slices
2020-02-11 01:59:41 +03:00
Alexander Krotov
3150901b6e
Improve logs for prefetch checks
2020-02-09 23:28:29 +00:00
Alexander Krotov
4f6745b742
Check if contact is blocked or accepted before downloading it
2020-02-09 23:28:29 +00:00
Alexander Krotov
4fd4cc709d
Prefetch FROM field
2020-02-09 23:28:29 +00:00
Alexander Krotov
0fac463144
Prefetch Message-ID header instead of envelope
...
Envelope has the same Message-ID, but using other fields from the
envelope, such as From field, is error-prone. They may contain values
different from the message body. As we don't parse the envelope later on,
it is better not to fetch it during prefetch too.
2020-02-09 23:28:29 +00:00
Alexander Krotov
d809dfac65
Do not download messages that are not displayed
2020-02-09 23:28:29 +00:00
Alexander Krotov
ea11a5274e
Remove unwrap() in prefetch_get_message_id
2020-02-09 23:28:29 +00:00