Commit Graph
100 Commits
Author SHA1 Message Date
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
Alexander Krotov 1cb4e41883 auto_mozilla: use match to parse socket types 2020-08-23 22:15:06 +03:00
Alexander Krotov cbfada3e4a Implement Default and FromStr for MozConfigTag 2020-08-23 22:15:06 +03:00
Alexander KrotovandSimon Laux c19e35b68d Parse multiple servers in Mozilla autoconfig
Co-Authored-By: Simon Laux <mobile.info@simonlaux.de>
2020-08-23 22:15:06 +03:00
Alexander Krotov f6854fd22f Add python test for contact renaming 2020-08-23 16:44:13 +03:00
Alexander Krotov 42bd9f71f0 imap: store ServerLoginParam instead of its fields
This prevents errors when copying it field-by-field.
2020-08-23 16:31:26 +03:00
Alexander Krotov 064d62e758 Imap.connect: copy security setting 2020-08-23 16:31:26 +03:00
Alexander Krotov a01755b65b Guess MIME type for .pdf and many other extensions 2020-08-23 01:20:32 +03:00
Alexander Krotov 6763dd653e Do not override mime type set by the user 2020-08-23 01:20:32 +03:00
Alexander Krotov 4bd2a9084c Fix a typo 2020-08-22 17:29:38 +03:00
Alexander Krotov 0816e6d0f6 Warn if IMAP deletion is scheduled for message without UID 2020-08-22 14:46:06 +03:00
Alexander Krotov c7d72d64cc Schedule resync on UID validity change 2020-08-22 14:46:06 +03:00
Alexander Krotov e33f6c1c85 Schedule resync job when DeleteServerAfter option is set 2020-08-22 14:46:06 +03:00
Alexander Krotov b4c85c534d Add a job to resync folder UIDs 2020-08-22 14:46:06 +03:00
Alexander Krotov 763334d0aa Sort message replies after parent message 2020-08-22 13:57:29 +03:00
Alexander Krotov be922eef0f Format plain text as Format=Flowed DelSp=No
This avoids triggering spam filters which require that lines are wrapped
to 78 characters.
2020-08-22 13:57:10 +03:00
Alexander Krotov a9faaa5cbc Update async-imap to fix Oauth2 2020-08-16 12:00:00 +03:00
Alexander Krotov 061bee382b Automatic certificate checks for providers from DB
When certificate checks setting is Automatic, strict_tls setting
from provider database is applied dynamically in Imap.connect() and
Smtp.connect().
2020-08-16 12:00:00 +03:00
Alexander Krotov 299c70e1cc configure: add "mail." to smtp_server when configuring SMTP 2020-08-16 02:59:48 +03:00
Alexander Krotov 0bf8017e8f try_decrypt: do not use gossip_key if public_key is available
public_key is updated with apply_header in try_decrypt right above this
code, so it makes no sense to allow signing messages with gossip key.
2020-08-14 12:00:54 +02:00
Alexander Krotov 8f7f4f95e8 Do not warn about gossip key changes if it is not used 2020-08-14 12:00:54 +02:00
Alexander Krotov 9810e5562a Rename handle_degrade_event into handle_fingerprint_change 2020-08-14 12:00:54 +02:00
Alexander Krotov 2feecbc9ff Replace Peerstate.degrade_event with bool
DegradeEvent::EncryptionPaused was always ignored, so it can be removed.
2020-08-14 12:00:54 +02:00
Alexander Krotov 55389c4190 Refactor handle_degrade_event 2020-08-14 12:00:54 +02:00
Alexander Krotov 920753ad50 configure: do not try the same username twice
If username does not contain "@", don't try again after removing domain
part.
2020-08-11 22:09:06 +03:00
Alexander Krotov 00c1383419 configure: refactor to try various server domains
For IMAP, example.org, imap.example.org and mail.example.org are tried.
For SMTP, example.org, smtp.example.org and mail.example.org are tried.
2020-08-11 22:09:06 +03:00
Alexander Krotov baec61cc4d Recognize .tgs files as stickers
.tgs files are Telegram stickers. Internally they are gzipped JSON files,
containing a single Lottie animation.

MIME type application/x-tgsticker is commonly used for telegram documents
containing such stickers.
2020-08-11 04:21:47 +03:00
Alexander Krotov 6285d18186 Document IMAP and SMTP tracing in README.md 2020-08-10 17:45:55 +02:00
Alexander Krotov 2550ed3f43 Add more extensions to guess_msgtype_from_suffix() 2020-08-09 17:46:07 +03:00
Alexander Krotov 8b22f74fa6 Expand changelog 2020-08-08 22:44:22 +02:00
Alexander Krotov 4f8e7e0166 python: fix more flaky tests
This change fixes test_immediate_autodelete and maybe other tests using
DirectImap.get_all_messages().
2020-08-08 23:04:05 +03:00
Alexander Krotov 9a21d5e9d9 Second attempt to fix flaky test
The server sometimes reorders the messages even if they were accepted
strictly in sequence.
2020-08-08 17:35:25 +03:00
Alexander Krotov 24d0382ec3 Add regression test for dc_set_chat_mute_duration panic
Panic was fixed in 3c8e60a2a3
2020-08-08 10:47:48 +03:00
Alexander Krotov 6d68fd4500 python: test get_mute_duration() 2020-08-08 10:47:48 +03:00
Alexander Krotov da5796e8a6 Fix python bindings call to dc_chat_get_remaining_mute_duration 2020-08-08 10:47:48 +03:00
Alexander Krotov 801b9f3ffa Fix dc_chat_get_remaining_mute_duration
Return time since current time, not UNIX epoch.
2020-08-08 10:47:48 +03:00
Alexander Krotov 2c41b3f3e0 Always translate EphemeralTimerChanged message
An EphemeralTimerChanged message with the same timer as already set can
be received when there are large delays or lost messages.  Even though
inner_set_ephemeral_timer should not be called in this case, because it
emits an event indicating timer change, system message will be added to
the chat, so it should be translated with set_better_msg in any case.
2020-08-08 04:57:48 +03:00
Alexander Krotov ac72280e69 Hide SIJÚ messenger footer 2020-08-08 00:24:08 +03:00
Alexander Krotov 528b5e9469 Attempt to eliminate test flakiness 2020-08-07 23:36:12 +03:00
Alexander Krotov ec4d68af2b Remove xfail mark on regression test 2020-08-07 23:36:12 +03:00
Alexander Krotov ea0aa4a93f Imap.select_with_uidvalidity(): read all the IMAP responses 2020-08-07 23:36:12 +03:00
Alexander Krotov b83f3e5ea0 imap: read all UID STORE responses
Otherwise these FETCH responses will remain unread and may be confused
with the actual FETCH response later.
2020-08-07 23:36:12 +03:00
Alexander Krotov 6c7d7f0c16 Imap.delete_msg(): read the whole UID FETCH response 2020-08-07 23:36:12 +03:00
Alexander Krotov 1bfc8d0300 Imap.delete_msg(): warn about unexpected FETCH responses
Such responses indicate IMAP client or server bug.
2020-08-07 23:36:12 +03:00
Alexander Krotov 8faf397af2 Add regression test for IMAP message deletion
Test times out while trying to delete messages. Message deletion jobs
don't complete in time because IMAP response parsing is broken in the
Rust core.
2020-08-07 23:36:12 +03:00
Alexander Krotov 18d8ef9ffc dehtml: handle empty tags 2020-08-07 23:18:34 +03:00