Commit Graph
100 Commits
Author SHA1 Message Date
link2xt 13bc8b78d7 python: enable isolated build in tox.ini
This makes tox install build system configured in pyproject.toml
according to PEP 518 rather than assuming setuptools.
2021-11-13 03:45:58 +00:00
link2xt c7c68094d9 setup.py: restore compatibility with setup.py sdist command
Otherwise source package with version 0.0.0 is created.
2021-11-12 23:41:17 +00:00
link2xt 1379f8a055 Factor apply_group_changes out of create_or_lookup_group
`apply_group_changes` is executed regardless of whether the group is
created via `create_or_lookup_group` or found via
`lookup_chat_by_reply`. This change removes the need for
`lookup_chat_by_reply` to return `None` when group ID exists in the
database to let `create_or_lookup_group` run. As a side effect of this
Delta Chat replies to ad hoc groups are now correctly assigned to
chats when there are multiple groups with the same group ID, such as
ad hoc groups with the same member lists.
2021-11-07 18:34:44 +03:00
link2xt 5e26b5bfdc Merge pull request #2743 from deltachat/improve-gossip
Optimize Autocrypt gossip
2021-11-01 02:01:51 +03:00
link2xt 60fbb6df5a Add python test for gossip optimization 2021-10-31 22:39:05 +00:00
link2xt 3e60ee9d3e python: use datetime.fromtimestamp() instead of datetime.utcfromtimestamp()
utcfromtimestamp() is not recommended by the official documentation,
because many methods, including timestamp(), work incorrectly with
"naive" datetimes returned by utcfromtimestamp().
2021-10-31 22:39:05 +00:00
link2xt 54e79409e6 Optimize Autocrypt gossip
Update gossiped_timestamp when someone else sends autocrypt gossip in
the group, so we postpone sending gossip again ourselves.

- Warn about failures to parse Autocrypt-Gossip header
- Move gossip-related methods into ChatId impl
- Fix a "gossi_pp_ed" typo
2021-11-01 01:17:51 +03:00
link2xt 3a014477e7 Fix dc_truncate proptest (#2781)
It was failing for approx_chars = 0.

Also reduce approx_chars range so approx_chars = 0 is tested more frequently.
2021-10-31 11:44:15 +01:00
link2xt 90d8c8baf5 Only apply ephemeral timers to non-special chats 2021-10-31 02:19:27 +03:00
link2xt 1dee17f980 Resultify dc_receive_imf::save_locations() 2021-10-31 02:19:27 +03:00
link2xt 6aeb21d3af dc_receive_imf: do not ignore lookup_by_contact errors 2021-10-31 02:19:27 +03:00
link2xt 4747ae2f1c Make is_dc_message and allow_creation immutable 2021-10-31 02:19:27 +03:00
link2xt 7968f55191 Trash messages instead of hiding them 2021-10-31 02:19:27 +03:00
link2xt 33aa3556d2 Use system resolver configuration instead of Google DNS for MX queries 2021-10-31 01:56:27 +03:00
link2xt ebb89e20b4 fixup! Modernize python setup 2021-10-28 22:03:52 +00:00
link2xt 8ef6b6089f receive_imf: simplify message state calculation
- Make `state` variable immutable.
- Don't mark contact requests as fresh when fetching existing messages: this is not needed since there is no contact request chat anymore.
- Don't mark messages from blocked chats as noticed, this is not needed since messages go to blocked chat anyway instead of contact request chat.
2021-10-28 01:59:54 +03:00
link2xt 5b5b26122e Modernize python setup
Use pyproject.toml instead of deprecated setup.py arguments and unpin dependencies in tox.ini.
2021-10-28 00:34:33 +03:00
link2xt ee3b40a59a Remove double reference from lookup_chat_by_reply argument 2021-10-23 12:34:36 +00:00
link2xt e511b87955 Remove unnecessary mut qualifier 2021-10-23 12:21:24 +00:00
link2xt 6061d71492 cargo: update strum to 0.22 2021-10-12 21:12:46 +00:00
link2xt dbd8814d2c Refactor qr module 2021-10-10 15:11:01 +03:00
link2xtandFloris Bruynooghe a3562c5940 Remove get_summarytext_by_raw
Use `Summary.truncated_text()` instead.

Co-Authored-By: Floris Bruynooghe <flub@devork.be>
2021-10-09 22:13:42 +03:00
link2xt 6e3c2fc839 dc_receive_imf: simplify timestamp calculation
Reduce the number of mutable variables and out parameters in
`add_parts`.

Also don't call `dc_create_smeared_timestamp` if there is no `Date`
header. Timestamps are only supposed to be "created" when the message
is sent, not received, to make sure sent messages are sorted properly
in MUAs that only use the date for sorting. Delta Chat uses database
IDs for sorting in addition to timestamps, so it can sort messages
with equal timestamps properly.

Update `dc_smeared_time` documentation.

Turn `dc_smeared_time` and `dc_create_smeared_timestamp` comments into
documentation comments.
2021-10-09 13:44:59 +03:00
link2xt 30e616f74f Increase MSRV to 1.51.0 and cargo update 2021-10-09 12:08:07 +03:00
link2xt 6c59b0de85 Remove unused Imap.interrupt
It is always set to `None`.
2021-10-03 01:14:50 +00:00
link2xt acbf363fc8 Try to lock strict TLS if certificate checks are automatic 2021-09-26 19:03:04 +03:00
link2xt 2309c7ca13 Emit events from account manager
Errors and warnings are emitted with a special 0 account ID.
2021-09-25 18:25:52 +03:00
link2xt 89d8b26192 Downgrade zeroize_derive to 1.1.0
Version 1.2.0 is not supported by Rust 1.48.0
2021-09-25 12:21:27 +00:00
link2xt ee32a7b00a Remove minor versions from deltachat_derive and deltachat-ffi
Also run `cargo update`
2021-09-25 12:15:59 +00:00
link2xt 1dbbf6b3be Create configured folders if they are deleted 2021-09-25 02:51:32 +03:00
link2xt f8a4a88fb2 Accept &str instead of AsRef<str> in fetch_new_mesages() 2021-09-25 02:51:32 +03:00
link2xt 3096193d58 ephemeral: always apply timers from system messages
Also extend the tests to catch regressions.
2021-09-25 02:51:23 +03:00
link2xt 085a899de2 Fix ephemeral timer rollback protection
Implement get_previous_message() that only looks for the last
Message-ID in the References: header instead of using
get_parent_message() which falls back to using other Message-IDs from
References and In-Reply-To field.
2021-09-20 01:54:51 +03:00
link2xt b07e20b955 ephemeral: add failing rollback protection test 2021-09-20 01:54:51 +03:00
link2xt 4e8724694a Notify about incoming contact requests 2021-09-19 04:06:01 +03:00
link2xt 47bf67e658 Resultification 2021-09-18 21:56:02 +03:00
link2xt 7bb7748b6b Deduplicate peerstates during housekeeping 2021-09-18 21:31:57 +03:00
link2xt 1afd2f2d66 Fix clippy warnings in repl 2021-09-18 10:29:32 +00:00
link2xt 48f1ef3641 Remove minor versions from Cargo.toml 2021-09-17 22:06:41 +00:00
link2xt e95911a484 Update OpenSSL 2021-09-17 21:50:44 +00:00
link2xt b1af486e10 Log all decisions when applying ephemeral timer to chats
This should make it easier to debug problems related to timer
rollbacks and reported failure to disable the timer in some chats.
2021-09-18 00:48:33 +03:00
link2xt 6f3dd7f0c2 Use saturating addition for ephemeral timers
Integer overflows crash the application by default.

On a first sight this is only a potential crash that can't be
triggered, because timestamps are stored as i64 and ephemeral timer
duration is u32.
2021-09-12 19:23:54 +03:00
link2xt 15dcd62652 imap: remove unnecessary Imap.connected variable
It is always the same as Imap.session.is_some().
2021-09-12 19:23:44 +03:00
link2xt 1bef623c89 Update changelog 2021-09-12 12:31:27 +00:00
link2xt 7745db8310 Ignore MDNs sent to self
These sometimes arrive happen due to a bug in previous versions of
Delta Chat.
2021-09-12 02:18:50 +03:00
link2xt 1d1491c95d Introduce summary module
summary::Summary replaces Lot in the Rust API for methods returning
chatlist summaries.  Lot is a legacy type for C API compatibility, so
Summary can be converted into Lot.
2021-09-12 01:32:33 +03:00
link2xt 02a1abc0d5 Remove emit_event! macro 2021-09-05 22:45:30 +03:00
link2xt 40fe65716f ffi: add RwLock to dc_accounts_t for thread safety 2021-09-05 18:53:17 +03:00
link2xt d05b399eac accounts: remove unnecessary Arc<RwLock<_>> from Config.inner 2021-09-05 18:53:17 +03:00
link2xt 7f819de49f Always check certificate when connecting over SOCKS5 in Automatic mode
There is a real risk of an active attack when connecting to non-.onion
servers over Tor, as bad Tor exit nodes are cheap to set up.

It's probably not needed for .onion domains, but we don't make an
exception for now.
2021-09-05 06:18:54 +03:00
link2xt 5f065b245f Resultification 2021-09-05 06:18:38 +03:00
link2xt d33177a721 accounts: remove Arc and RwLock from Accounts.accounts
Also make Accounts uncloneable. It is still possible to derive Clone,
but does not make sense to do so, as .clone() creates two separate
account managers which use the same files but different unsynchronized
in-memory data structures.
2021-09-04 20:33:11 +03:00
link2xt 51c6467feb Release 1.60.0 2021-08-29 19:09:25 +03:00
link2xt 6a60ae2f09 accounts: keep event emitter from closing when there are no accounts (#2636) 2021-08-29 17:43:58 +02:00
link2xt 7be0583628 scripts/coverage.sh: use POSIX command instead of which (#2637)
Debian deprecated `which` in `debianutils` in favor of `command`.

`which` outputs this to stderr now:
/usr/bin/which: this version of `which' is deprecated; use `command -v' in scripts instead.
2021-08-29 17:43:25 +02:00
link2xt 9dedcad220 imap: use anyhow for error handling 2021-08-29 17:57:29 +03:00
link2xt 3aa2b57ac1 Never ignore SQL errors when reading SOCKS5 settings
Otherwise we may accidentally connect directly due to temporary error.
2021-08-22 23:30:34 +03:00
link2xt ab1de69fbc mimeparser: rename MimeMessage.get() into MimeMessage.get_header() 2021-08-22 23:21:22 +03:00
link2xt a163be9248 Log dc_get_chatlist() errors
Previously errors such as empty query ("missing query") silently
returned NULL.
2021-08-22 16:43:30 +03:00
link2xt 2b7bf11b05 Rust documentation improvements
Document all public modules and some methods.

Make some internal public symbols private.
2021-08-22 15:34:14 +02:00
link2xt 3440daca1a Reduce message length limit to 5000 chars (#2615)
- Use the same limit for info: full text can be read in HTML anyway.
- Remove DC_MAX_GET_{TEXT,INFO}_LEN constants from deltachat.h
- Fix a typo: s/DC_ELLIPSE/DC_ELLIPSIS/
- Do not truncate the text when loading from the database.
- Update the documentation: limit is in Rust chars, not bytes
2021-08-21 21:02:14 +02:00
link2xt ade39fe026 fix: do not set WantsMdn param for outgoing messages
This bug sometimes results in sending read receipts to self in
multi-device setups.

It happens consistently in a setup where the first device is
configured to move messages to DeltaChat folder and the second device
is not. When both devices receive BCC-self message simultaneously, the
first device moves the message to DeltaChat folder, while the second
device tries to mark the message as seen in the Inbox. Regardless of
whether the second device marks the message as seen successfully or
fails because the message is already moved by the first device,
`Job.markseen_msg_on_imap()` sends the read receipt to the From
address.
2021-08-15 20:39:28 +03:00
link2xt 20bf41b4e6 Set timestamps for system messages
Previously system messages were always added to the end of the chat,
even if the message triggering them was sent earlier.  This is
especially important for messages about disappearing timer reset
triggered by classic email messages, as they should be placed right
after the message resetting the timer.
2021-08-08 23:03:38 +03:00
link2xt 5a5b80c960 Resultify get_chat_id_by_grpid and create_or_lookup_mailinglist
Use `Option` instead of `Error` to indicate that no chat ID is found.
2021-08-08 16:26:02 +03:00
link2xt 4071fe53a0 Fix clippy warnings in deltachat-ffi 2021-08-07 12:03:25 +00:00
link2xt c3062976c0 Allow clippy::bool_assert_comparison
assert_eq!(var, false) is easier to read than assert!(!var).
2021-08-07 11:48:51 +00:00
link2xt 85efc0ea26 Fix clippy warnings 2021-08-07 11:47:50 +00:00
link2xt 4ef80aaea5 ci: update Rust and Python versions used for testing
- Use latest stable for rustfmt and clippy.
- Update Rust in rust-toolchain and coredeps Docker container to 1.54.0
  and test against it.
- Test against 1.48.0 to ensure libdeltachat can be compiled with Debian
  bullseye "rustc" and "cargo".
2021-08-07 14:22:54 +03:00
link2xt 0f86800f5d ci: build python wheels automatically for py-* tags 2021-08-07 14:22:54 +03:00
link2xt 9c2035538c dc_receive_imf: use None instead of ChatId::new(0) 2021-08-07 00:37:31 +03:00
link2xt 0276938975 ci: update perl
Old miniperl segfaults on the latest manylinux image
2021-08-07 00:00:00 +03:00
link2xt 0f0072f5a2 dc_receive_imf: don't create chats when MDNs are received 2021-08-01 13:21:16 +03:00
link2xt 09066571be message: don't ignore invalid arguments to handle_mdn 2021-08-01 13:21:02 +03:00
link2xt 8963dab7a4 message: better error handling in handle_mdn 2021-08-01 13:21:02 +03:00
link2xt 265d54e431 message: bubble up SQL errors in handle_mdn()
Previously handle_mdn() returned Ok(None) in response to SQL errors as
if SQL simply returned no rows.
2021-08-01 13:21:02 +03:00
link2xt ffb17c4e61 Fix nightly clippy errors 2021-08-01 01:46:17 +03:00
link2xt 44bd9f93b4 job: fix delete_msg_on_imap documentation 2021-07-31 22:42:14 +03:00
link2xt 5287a3de40 dc_receive_imf: avoid cloning rfc724_mid String 2021-07-31 22:23:56 +03:00
link2xt 6f644f5c7c dc_receive_imf: extract insert_msg_id from created_db_entries
This makes add_parts() accept one argument less
2021-07-31 22:23:56 +03:00
link2xt 31b930b2fa add_parts: make mime_in_reply_to and mime_references immutable 2021-07-31 22:23:56 +03:00
link2xt 0574aeb768 dc_receive_imf: return ChatId from add_parts() 2021-07-31 22:23:56 +03:00
link2xt bf68bc14a4 dc_receive_imf: remove dead code
mimeparser ensures that mails have at least one part.

Besides that, add_parts() handles the case of no parts just fine.
2021-07-31 22:23:56 +03:00
link2xt 5856936f49 accounts: update EventEmitter on add_account (#2559)
* accounts: update EventEmitter on add_account

* accounts: do not lock waiting for EventEmitter in dc_accounts_add_account

Otherwise dc_accounts_add_account blocks until an event arrives on
some existing account.
2021-07-27 15:27:08 +02:00
link2xt 532060d8b7 Update async-smtp
New version supports @yggmail addresses.
2021-07-24 03:42:18 +03:00
link2xt f88f4155ae Update changelog 2021-07-24 15:58:14 +03:00
link2xt 065b574d93 Remove deaddrop chat
Contact request chats are not merged into a single virtual "deaddrop"
chat anymore. Instead, they are shown in the chatlist the same way as
other chats, but sending of messages to them is not allowed and MDNs
are not sent automatically until the chat is "accepted" by the user.

New API:
- dc_chat_is_contact_request(): returns true if chat is a contact
request.  In this case option to accept and block the chat via
dc_accept_chat() and dc_block_chat() should be shown in the UI.
- dc_accept_chat(): accept contact request and unblock the chat
- dc_block_chat(): decline contact request and block the chat

Removed API:
- dc_create_chat_by_msg_id(): deprecated 2021-02-07 in favor of
  dc_decide_on_contact_request()
- dc_marknoticed_contact(): deprecated 2021-02-07 in favor of
  dc_decide_on_contact_request()
- dc_decide_on_contact_request(): this call requires a message ID from
  deaddrop chat as input. As deaddrop chat is removed, this call can't
  be used anymore.
- dc_msg_get_real_chat_id(): use dc_msg_get_chat_id() instead, the
  only difference between these calls was in handling of deaddrop chat
- removed DC_CHAT_ID_DEADDROP and DC_STR_DEADDROP constants
2021-07-24 15:58:14 +03:00
link2xt eff64ed9b0 Remove strict domain checks for EmailAddress::from_str
They prevent "user@localhost" addresses from being parsed, which are
useful for running online tests against local server.
2021-07-17 22:27:27 +03:00
link2xt aec8332544 mimeparser: use mailparse to parse RFC 2231 filenames
mailparse supports RFC 2231 since version 0.13.5, so there is no need
for our own code to support it.
2021-07-17 14:31:16 +03:00
link2xt f96d04e80f ci: trigger doxygen rebuild on every commit 2021-07-03 17:57:43 +03:00
link2xt c1d3e9358d ci: remove references to CircleCI
It is not used anymore.
2021-07-03 17:57:43 +03:00
link2xt 8700cf0aba dc_receive_imf: remove cleanup() closure
Do not send any events in case of `add_parts` error.
2021-06-28 09:16:10 +03:00
link2xt a6ad457065 dc_receive_imf: fix a typo ("reveive") 2021-06-27 20:52:35 +03:00
link2xt f113b43046 Use current timestamp instead of 0 for messages without Date:
Otherwise receiving a message without `Date:` in an empty chat pushes
it to the bottom of chatlist.
2021-06-26 23:20:07 +03:00
link2xt 0b3eece26d Use smeared timestamps for chat creation times 2021-06-26 23:20:07 +03:00
link2xt 8ce9a78d6c chatlist: resultify get_msg_id, get_summary and get_summary2
Avoid using MsgId::new(0) in place of `None` in the Rust part.
Zero ID is only used in FFI part now.
2021-06-26 17:04:55 +03:00
link2xt ad266fe82f dc_receive_imf: exit early if Message-ID is duplicate
Do not process names, avatars, location XMLs, message signature
etc. for duplicate messages.

Previously only `add_parts` was stopped early, but not
`dc_receive_imf`. Also, `dc_receive_imf` processed From: and To:
fields and applied names to contacts even before checking the
Message-ID.

Fake Message-ID generation procedure is changed to operate on raw
header values to avoid interacting with the database.
2021-06-26 15:20:47 +03:00
link2xt a411fe1e01 Remove InvalidMsgId error type 2021-06-20 17:52:30 +03:00
link2xt 8ea773628d Use anyhow for key.rs error handling 2021-06-19 22:52:32 +03:00
link2xt a47c0486ae Store mime_headers as BLOBs
Raw MIME messages may contain non-ASCII characters. Attempting to
store them as TEXT by using String::from_utf8_lossy results in
non-ASCII characters being replaced with Unicode U+FFFD "REPLACEMENT
CHARACTER" which is later incorrectly decoded when attempting to parse
`mime_headers` content into HTML.
2021-06-19 17:49:26 +03:00
link2xt c08df8d3da Do not count info messages for deaddrop chat
Info messages are not displayed in contact requests, so they should
not be counted in get_msg_cnt() and get_fresh_msg_cnt() too.
2021-06-19 17:40:07 +03:00