Commit Graph
100 Commits
Author SHA1 Message Date
link2xt 24602ed8a8 Use .first_word() to get enhanced status code (#2202)
.get(0) gets the whole first line
2021-02-08 01:51:31 +01:00
Alexander Krotov 8412affe37 ffi: remove dc_is_io_running()
It is misleading and should never be checked.

dc_stop_io() also stops pending ephemeral message deletion tasks, so it
should be called in any case before releasing context.
2021-01-15 07:07:45 +03:00
Alexander Krotov 3c387a3cb3 refactor: get rid of ctx1 variables using rebinding 2021-01-13 14:22:01 +03:00
Alexander Krotov 5e8e77dfb6 clippy: forbid wildcard_imports 2021-01-12 12:06:13 +03:00
Alexander Krotov eeba70eb49 Fix a clippy warning 2021-01-12 12:06:13 +03:00
Alexander Krotov bb9e6038c4 python: add error property to messages 2021-01-10 23:31:50 +03:00
Alexander Krotov f4c8ffca4c Query MX records during provider autoconfiguration
Previously MX records were queried only for OAuth 2 configuration and
did not affect the list of servers tried. User was required to manually
configure the servers for Google Workspace (former GSuite) domains.

Now MX records are queried during configuration. If provider is found in
offline database, its ID, corresponding to the filename, is saved as
`configured_provider`.

`configured_provider` is also set during database migration if email
address uses the domain from the provider database, but no MX querying
is done.
2021-01-10 00:19:43 +03:00
Alexander Krotov 31ae099e19 configure: simplify get_autoconfig() 2021-01-06 16:55:15 +03:00
Alexander Krotov 0f90d50385 repl: update list of commands
send-garbage has been removed, and setqr was not listed in help
2021-01-03 20:38:47 +03:00
Alexander Krotov 5bbbe4b79c Missing paren in the comment 2020-12-29 01:30:27 +03:00
Alexander Krotov 4690ba017f Update provider database with server fixes 2020-12-27 02:37:14 +03:00
Alexander Krotov 38ead5b72c Enable strict TLS by default
Now strict TLS should be explicitly turned off.

By default it is only turned off for nauta provider.
2020-12-27 02:36:11 +03:00
Alexander Krotov 30c334d887 Resolve MX domain only once per OAuth2 provider
Currently we have only one provider in the list, so there is no
difference, but more providers (e.g. Yandex.Connect) may be added later.
2020-12-26 21:33:59 +03:00
Alexander Krotov 86a8767d94 Update vendored OpenSSL version
This fixes linking of OpenSSL on Ubuntu 20.04.1 LTS.

Related issue: https://github.com/openssl/openssl/issues/10842
2020-12-25 18:48:45 +03:00
Alexander Krotov 4bc4aa0705 Fix compilation of python bindings in release mode 2020-12-25 07:54:40 +03:00
Alexander Krotov f98aa0d906 Make maybe_remove_bad_parts() non-async 2020-12-22 20:51:57 +03:00
Alexander Krotov 179dd0f3a1 Fix "dehtlm_failed" typo 2020-12-22 20:51:42 +03:00
Alexander Krotov ff3dd878c5 Use Python 3 for all Python scripts 2020-12-19 14:55:22 +03:00
Alexander Krotov bc67fa3204 python: use configured_mail_{port,security} when creating IMAPClient
Previously only TLS on port 993 was allowed.
2020-12-18 18:39:30 +03:00
Alexander Krotov 518e87b0cf Compare Chat-Disposition-Notification-To: address case-insensitively
Otherwise users with uppercase letters in their addresses never receive
read receipts.
2020-12-06 23:29:11 +03:00
Alexander Krotov eb693a4a21 Add Rust test for ephemeral timer messaging 2020-12-06 21:09:13 +03:00
Alexander Krotov 00a223b574 test_utils: set message state to OutDelivered on .pop_sent_msg()
Also remove SentMessage.id. It was set to foreign_id of the job, which
is a MsgId, not ChatId, so tests using it were not correct anyway.
2020-12-06 21:09:13 +03:00
Alexander Krotov 93e038e056 Ignore ephemeral timer changes if replying to old message
This should prevent timer changes back when someone is replying before
receiving timer change.
2020-12-06 21:09:13 +03:00
Alexander Krotov dea9630380 Better typed Message.ephemeral_timer 2020-12-06 21:09:13 +03:00
Alexander Krotov 30e7f84770 Add get_parent_message() 2020-12-06 21:09:13 +03:00
Alexander Krotov fc1f44c6d6 Spellcheck 2020-12-06 04:26:20 +03:00
Alexander Krotov e79533ae54 Add diff .gitattributes for .{py,rs,md} 2020-12-03 03:46:51 +03:00
link2xt 07768133d5 Merge pull request #2083 from deltachat/smtp-plain
smtp: do not use STARTTLS when PLAIN connection is requested
2020-11-15 23:37:41 +03:00
Alexander Krotov 9df88745dc smtp: do not use STARTTLS when PLAIN connection is requested
Also do not allow downgrade if STARTTLS is not available
2020-11-15 22:40:41 +03:00
Alexander Krotov deb506cb52 Add timestamps to images and videos
It is already done for voice messages and makes saving attachments to
one folder easier.
2020-11-08 22:16:42 +03:00
Alexander Krotov 66907c17d3 mimeparser: preserve quotes in messages with attachments 2020-11-08 12:01:35 +03:00
Alexander Krotov bf82dd9c60 Document account_id parameter for dc_accounts_remove_account 2020-11-08 01:12:57 +03:00
Alexander Krotov 46c544a5ca deltachat-ffi: forbid quoting messages from another context 2020-11-05 05:57:19 +03:00
Alexander Krotov c53c6cdf90 deltachat.h documentation fixes 2020-11-01 01:33:15 +03:00
Alexander Krotov 5c1bbc5d6a Cancel ephemeral task in Context.stop_io()
ephemeral_task holds a reference to Context, preventing event emitter
from returning NULL and terminating event loop. Prior to this change,
there was no way to quickly terminate pending ephemeral_task.
2020-10-28 01:10:23 +03:00
Alexander Krotov f30c319fbf Remove trailing space in Python code 2020-10-27 23:27:00 +03:00
Alexander Krotov 11d9fcad35 Display a quote if top posting is detected
Previously quote at the end was always displayed as [...].
2020-10-26 18:03:30 +03:00
Alexander Krotov 8156692e5a configure: always try at least one IMAP and SMTP server
Previously empty autoconfig resulted in no servers being tried and no
error displayed.
2020-10-21 02:30:16 +03:00
link2xt 0ae9443e22 Update sanitize-filename (#2013) 2020-10-19 12:14:05 +02:00
Alexander Krotov 67cddedf7e Switch from lazy_static to once_cell 2020-10-18 15:47:21 +03:00
Alexander Krotov 64cd48a4e1 Fix nightly clippy warnings 2020-10-17 15:24:09 +03:00
Alexander Krotov 19697e255e Parse normal MUA messages consisting of only a quote 2020-10-16 14:57:02 +02:00
Alexander Krotov 1672905c71 Remove outdated tests/stress.rs
All useful code has already been moved to relevant modules.
2020-10-14 05:58:47 +02:00
Alexander Krotov 1f24c5f8a4 Merge "protected groups" branch into master 2020-10-13 18:44:31 +03:00
Alexander Krotov 8b3494b5c1 Do not display [...] after non-chat quotes
Top quotes are displayed as quotes for non-chat mails, so [...] used to
indicate there was a quote is not needed.
2020-10-12 21:55:22 +03:00
Alexander Krotov cb5bcebf75 Separate quote from reply with an empty line
This makes quotes easier to read in previous DC versions and plaintext
MUAs.
2020-10-11 02:28:41 +03:00
Alexander Krotov 69f159792e Only use summary for quote if text is empty
For text messages, summary joins all lines into one, so multi-line quotes
look bad in Thunderbird.
2020-10-11 01:37:24 +03:00
Alexander KrotovandHocuri eaec03142b Use get_summarytext() for quotes
Co-Authored-By: Hocuri <hocuri@gmx.de>
2020-10-10 12:41:43 +03:00
Alexander KrotovandB. Petersen 20182b027e Add quote API
Sticky encryption rule, requiring that all replies to encrypted messages
are encrypted, applies only to messages with a quote now.

Co-Authored-By: B. Petersen <r10s@b44t.com>
2020-10-10 12:41:43 +03:00
Alexander Krotov 8c82a5cbfa prepare_msg_raw: do not set GuaranteeE2ee
This code is inconsistent with EncryptHelper::should_encrypt, which uses
quorum rule.

UI does not display or use encryption state in-between preparing and
sending message anyway.

In addition, "sticky encryption" rule, which required all replies to
encrypted messages to be encrypted, is dropped. It is going to be
restored with the introduction of quoting.
2020-10-10 12:41:43 +03:00
Alexander Krotov 25274f13c3 cargo fmt
Also formatted SQL query, because rustfmt can't format statements with
too long strings.
2020-10-10 12:41:43 +03:00
Alexander Krotov 093839c2b0 prepare_msg_raw: replace large if with early exit 2020-10-10 12:41:43 +03:00
Alexander Krotov a0c92753a9 prepare_msg: return Err if no address is configured
Address is used to generate Message-Id.

Previously error toast was shown, but MsgId was returned from
chat::prepare_msg anyway. Now chat::prepare_msg returns an error.

error!() is removed, because FFI library shows errors via
.unwrap_or_log_default().
2020-10-05 10:37:21 +03:00
Alexander Krotov de97e0263f ffi: add missing "ignoring careless call" warnings 2020-10-05 08:57:52 +02:00
Alexander Krotov be40417a7f sql: do not set dbversion after each migration
This variable is not used afterwards, and it is already not set in
migrations added after version 54.
2020-10-02 16:20:39 +03:00
Alexander Krotov 8301e27f86 dc_get_info: accept immutable context 2020-10-02 16:20:32 +03:00
Alexander Krotov 21b18836ca test_configure_error_msgs: do not check for "password" repetition
When run against host that is not in the provider database or has multiple
IMAP servers listed, this test fails because one error is returned for
each server.
2020-10-02 14:28:10 +03:00
Alexander Krotov 9667859410 deltachat.h: fix a typo 2020-10-02 03:33:04 +03:00
Alexander Krotov b437ab86d1 Fix a typo: "probram" 2020-10-02 03:24:24 +03:00
Alexander Krotov 60a8b47ad0 e2ee: require quorum to enable encryption
Previously, standard Autocrypt rule was used to determine whether
encryption is enabled: if at least one recipient does not prefer
encryption, encryption is disabled.

This rule has been problematic in large groups, because the larger
is the group, the higher is the chance that one of the users does not
prefer encryption.

New rule requires a majority of users to prefer encryption. Note that it
does not affect 1:1 chats, because it is required that *strictly* more
than a half users in a chat prefer encryption.
2020-09-27 23:38:06 +03:00
Alexander Krotov 0344bc387c Add encryption preference test 2020-09-27 23:38:06 +03:00
Alexander Krotov 9121e30600 param: escape newlines in values
Newlines are escaped by repeating them.

This encoding is compatible to existing values, because they do not
contain newlines.
2020-09-26 07:01:39 +03:00
Alexander Krotov fc0e88539a get_summarytext_by_raw: drop leading and trailing whitespace
Also remove unnecessary use of regexp.
2020-09-20 23:51:52 +03:00
Alexander Krotov c124eadf9d Emit chat modification event on contact rename 2020-09-20 00:45:36 +03:00
Alexander Krotov 97b1a1c392 Set contact ID in event related to contact blocking 2020-09-19 22:01:45 +03:00
Alexander Krotov fe1c99c5e8 Set contact ID in ContactsChanged on modification 2020-09-19 22:01:45 +03:00
Alexander Krotov 332a387c98 Fix nightly clippy warnings 2020-09-19 17:49:32 +03:00
Alexander Krotov 92b304dee4 Fix nightly warnings about unused attributes 2020-09-19 16:08:45 +03:00
Alexander Krotov 498880d874 ci: disable macOS 2020-09-19 03:19:48 +03:00
Alexander Krotov 4573e6d18b ci: set huponexit for inner bash processes
Followup for aae8163696
2020-09-18 23:42:32 +02:00
Alexander Krotov 238c4bb792 sql: set PRAGMA temp_store=memory
On Android, there is to /tmp directory, so SQLite may throw
SQLITE_IOERR_GETTEMPPATH when trying to find a place for temporary
files. Storing temporary files in memory is a workaround that always
works (until out of memory).

See https://github.com/mozilla/mentat/issues/505 for discussion of a
similar issue.
2020-09-19 00:10:12 +03:00
Alexander Krotov efcdb45301 ci: use different target dirs for Python and Rust tests
This prevents CI jobs from locking each other.
2020-09-18 20:42:27 +03:00
Alexander Krotov 0485c55718 sql: create new accounts in one transaction
This prevents SQLite from synchronizing to disk after each statement,
saving time on high latency HDDs.
2020-09-18 19:41:41 +03:00
Alexander Krotov 0a5d1e5551 sql: create new accounts without migration
This speeds up account creation by ~50% on HDD.
2020-09-15 02:03:58 +03:00
Alexander Krotov 49c8964aec Add benchmark for account creation 2020-09-15 02:03:58 +03:00
Alexander Krotov b42b1ad99b Make dc_accounts_get_all return accounts sorted
HashMap may rearrange all accounts after each insertion and deletion,
making it unpredictable where the new account appears.
2020-09-13 14:36:59 +03:00
Alexander Krotov b28f5c8716 Update to non-release version of async-smtp
It is one commit ahead 0.3.4, replacing EHLO localhost with EHLO [127.0.0.1].
2020-09-13 13:04:23 +03:00
Alexander Krotov 53c47bd862 configure: add progress! calls during IMAP configuration 2020-09-12 20:14:58 +03:00
Alexander Krotov d6a0763b1d Teach Python bindings to process (char *)0 2020-09-12 19:42:41 +03:00
Alexander Krotov ecbc83390e Add "Configuration failed" stock string 2020-09-12 19:42:41 +03:00
Alexander Krotov f5b16cf086 Set data2 in ConfigureProgress event
For now it is only set on error, but could contain user-readable log
messages in the future.
2020-09-12 19:42:41 +03:00
Alexander Krotov cdba74a027 configure: add expand_param_vector function 2020-09-12 15:19:45 +03:00
Alexander Krotov a065f654e8 Fix a typo in deltachat.h 2020-09-12 14:14:57 +03:00
Alexander Krotov b0bb0214c0 Transpose if branches
This removes three ifs and adds two ifs, making it more clear that
nothing is done if there is no Autocrypt header.
2020-09-09 21:46:45 +03:00
Alexander Krotov f7897d5f1a e2ee: add test for encrypted message without Autocrypt header 2020-09-09 21:46:45 +03:00
Alexander Krotov 42c5bbcda3 Do not reset peerstate on encrypted messages
If message does not contain Autocrypt header, but is encrypted, do not
change the peerstate.
2020-09-09 21:46:45 +03:00
Alexander Krotov f657b2950c Split ForcePlaintext param into two booleans
This allows to send encrypted messages without Autocrypt header.
2020-09-09 21:46:45 +03:00
Alexander Krotov 6fcc589655 Use ForcePlaintext as enum, not i32 2020-09-09 21:46:45 +03:00
Alexander Krotov cdd1ccb458 Ignore reordered autocrypt headers
This commit fixes condition which ignores reordered autocrypt messages.
If a plaintext message resetting peerstate has been received, autocrypt
header should only be applied if it has higher timestamp.

Previously, timestamp of the last received autocrypt header was used,
which may be lower than last_seen timestamp.

# Conflicts:
#	src/peerstate.rs
2020-09-05 21:29:54 +03:00
Alexander Krotov e388e4cc1e Do not emit network errors during configuration
Previously DC_EVENT_ERROR_NETWORK events were emitted for each failed
attempt during autoconfiguration, even if eventually configuration
succeeded. Such error reports are not useful and often confusing,
especially if they report failures to connect to domains that don't
exist, such as imap.example.org when mail.example.org should be used.

Now DC_EVENT_ERROR_NETWORK is only emitted when attempting to connect
with existing IMAP and SMTP configuration already stored in the
database.

Configuration failure is still indicated by DC_EVENT_CONFIGURE_PROGRESS
with data1 set to 0. Python tests from TestOnlineConfigurationFails
group are changed to only wait for this event.
2020-09-05 21:17:26 +03:00
Alexander Krotov 9b741825ef Attempt IMAP and SMTP configuration in parallel
SMTP configurations are tested in a separate async task.
2020-09-05 21:09:47 +03:00
Alexander Krotov f4e0c6b5f1 Remove Peerstate::new()
Create and return immutable Peerstate instead.
2020-09-05 21:07:58 +03:00
Alexander Krotov a68528479f Remove dead code markers 2020-09-05 21:07:28 +03:00
Alexander Krotov 383c5ba7fd Smtp.send: join recipients list without .collect 2020-09-05 21:06:32 +03:00
Alexander Krotov dd682e87db imap: resultify Imap.connect 2020-08-30 15:04:07 +03:00
Alexander Krotov 0b743c6bc3 imap: use anyhow for error handling
There is already free-form Error::Other error type, and SqlError had
incorrect error description (a copy from InTeardown).
2020-08-30 15:04:07 +03:00
Alexander Krotov 8f290530fd Use enum type for Bob status 2020-08-30 15:03:43 +03:00
Alexander Krotov 0f164861c7 Fix clippy::iter_next_slice errors 2020-08-28 02:13:23 +03:00
Alexander Krotov 4481ab18f5 configure: try multiple servers for each protocol
LoginParamNew structure, which contained possible IMAP and SMTP
configurations to try is replaced with uniform vectors of ServerParams
structures. These vectors are initialized from provider database, online
Mozilla or Outlook XML configuration or user entered parameters.

During configuration, vectors of ServerParams are expanded to replace
unknown values with all possible variants, which are tried one by one
until configuration succeeds or all variants for a particular protocol
(IMAP or SMTP) are exhausted.

ServerParams structure is moved into configure submodule, and all
dependencies on it outside of this submodule are removed.
2020-08-27 23:11:25 +03:00
Alexander Krotov 6eef4066db Do not restrict message.kml coordinates precision
Using only two digits results in visible difference between original
location and location received by other users.
2020-08-27 11:19:08 +03:00