Compare commits

...

1147 Commits

Author SHA1 Message Date
B. Petersen
3a971315dc bump version to 1.86.0 2022-06-06 12:08:49 +02:00
B. Petersen
a37a38c79a update changelog for 1.86.0 2022-06-06 12:08:49 +02:00
snan
b8cadaf8e6 Fix small typo
s/Changlog/Changelog/
2022-06-06 12:01:35 +02: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
Asiel Díaz Benítez
4f02c811a3 update python API (#3394) 2022-06-04 18:12:38 +02:00
Simon Laux
0d1d1a25da node: remove npx from build script, (#3396)
* node: remove `npx` from build script,
this broke flathub build

* add pr number to changelog
2022-06-04 17:03:03 +02:00
bjoern
cd27c143c3 update provider database (#3399)
ran `./src/provider/update.py ../provider-db/_providers/ > src/provider/data.rs`
2022-06-04 16:43:56 +02:00
bjoern
fcded63653 cleanup series of webxdc info messages (#3395)
* clarify webxdc reference wrt info-messages

* add from_id parameter to add_info_msg_with_cmd()

* flag webxdc-info-messages as such

* set from_id to sender for webxdc-info-messages

* test additional webxdc info properties

* do not add series of similar info messages

instead, if on adding the last info message
is already from the same webxdc and sender,
just update the text

* test cleanup of webxdc info messages series

* update changelog

* make clippy happy

there is no real complexity in the args,
so allowing one more arg is probably fine.

if really wanted, we can refactor the function in another pr;
this pr is already complex enough :)

* use cleaner function names and comments

* clarify CHANGELOG
2022-06-04 11:12:09 +02: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
Asiel Díaz Benítez
1d568076df Merge pull request #3381 from deltachat/adb/apply-black-and-isort
apply isort and black formatters, add format checking to CI
2022-06-02 08:01:17 -04:00
Hocuri
e2b3339475 Remove direct dependency on async_trait (#3382)
Not completely sure it's worth it since some other dependencies still
depend on it. Anyway, proc macros are said to be bad for compile times, I just typed out what the proc macro generates and it's only 8 more lines, and we're already doing it this way in e.g. action_by_contact() and collect_texts_recursive() (the latter needs the boxed future both for the trait and for recursion).
2022-06-02 08:57:19 +00:00
dependabot[bot]
80efaa0dfa Merge pull request #3391 from deltachat/dependabot/cargo/quick-xml-0.23.0 2022-06-01 22:27:18 +00:00
link2xt
24d967d6f4 dehtml: update for quick-xml 0.23 2022-06-01 22:03:43 +00:00
dependabot[bot]
ed5bbf6882 cargo: bump quick-xml from 0.22.0 to 0.23.0
Bumps [quick-xml](https://github.com/tafia/quick-xml) from 0.22.0 to 0.23.0.
- [Release notes](https://github.com/tafia/quick-xml/releases)
- [Changelog](https://github.com/tafia/quick-xml/blob/master/Changelog.md)
- [Commits](https://github.com/tafia/quick-xml/compare/v0.22.0...v0.23.0)

---
updated-dependencies:
- dependency-name: quick-xml
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-01 21:50:23 +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
dependabot[bot]
c90a358674 Merge pull request #3364 from deltachat/dependabot/cargo/num-traits-0.2.15 2022-06-01 20:13:37 +00:00
dependabot[bot]
b6cd49c825 Merge pull request #3362 from deltachat/dependabot/cargo/sanitize-filename-0.4.0 2022-06-01 20:13:04 +00:00
dependabot[bot]
a89b405e16 Merge pull request #3366 from deltachat/dependabot/cargo/regex-1.5.6 2022-06-01 20:12:34 +00:00
bjoern
e1e5803067 do not add legacy info-messages on resending (#3389)
* do not wipe info for drafts

* drafts and received webxdc-instances, resent or not, do not trigger info-messages

* test that resending a webxdc does not not add legacy info-messages

* make clippy happy

* update CHANGELOG
2022-06-01 21:38:15 +02:00
B. Petersen
9e0decb6cb test that bcc_self-updates are not triggered twice
bcc_self-updates are not received
due to the normal prevention of not even downloading these messages.

there is no extra defense of that on webxdc-level;
status-updates do not even have a "global-unique" id
(they have a local id and the message where they're wrappted into have the
"global-unique" Message-Id)
2022-06-01 21:37:41 +02:00
dependabot[bot]
8ae3449a43 cargo: bump num-traits from 0.2.14 to 0.2.15
Bumps [num-traits](https://github.com/rust-num/num-traits) from 0.2.14 to 0.2.15.
- [Release notes](https://github.com/rust-num/num-traits/releases)
- [Changelog](https://github.com/rust-num/num-traits/blob/master/RELEASES.md)
- [Commits](https://github.com/rust-num/num-traits/compare/num-traits-0.2.14...num-traits-0.2.15)

---
updated-dependencies:
- dependency-name: num-traits
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-01 18:43:35 +00:00
dependabot[bot]
dac5460da0 Merge pull request #3356 from deltachat/dependabot/cargo/once_cell-1.12.0 2022-06-01 18:41:27 +00:00
Robert Schütz
df0513f4f4 node: move split2 to devDependencies (#3341)
Co-authored-by: Simon Laux <Simon-Laux@users.noreply.github.com>
2022-06-01 21:08:26 +03:00
dependabot[bot]
d9535213dc cargo: bump once_cell from 1.10.0 to 1.12.0
Bumps [once_cell](https://github.com/matklad/once_cell) from 1.10.0 to 1.12.0.
- [Release notes](https://github.com/matklad/once_cell/releases)
- [Changelog](https://github.com/matklad/once_cell/blob/master/CHANGELOG.md)
- [Commits](https://github.com/matklad/once_cell/compare/v1.10.0...v1.12.0)

---
updated-dependencies:
- dependency-name: once_cell
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-01 18:08:09 +00:00
Hocuri
a320817ee5 test_utils.rs / TestContext: Remove poison channel, don't fail test if events loop panics (because it can't panic anymore) (#3380)
I added this poison_sender and poison_receiver stuff back when we had event listeners (which were called "sinks", too, but anyway), i.e. user-definable closures that were run in the events loop. This was to make sure that the test fails if the closure panics. But since we don't have them anymore and this code isn't supposed to panic anyway:
```rust
            while let Some(event) = events.recv().await {
                for sender in senders.read().await.iter() {
                    sender.try_send(event.clone()).ok();
                }
            }
```
2022-06-01 12:50:14 +00:00
adbenitez
17aab01eaa apply black with new line-length == 120 2022-05-31 23:05:20 -04:00
adbenitez
d3e6cc5acb set black.line-length to 120 2022-05-31 23:02:51 -04:00
adbenitez
723d1828ec configure flake8 to be compatible with black 2022-05-31 05:29:35 -04:00
missytake
ef85b4c919 delete preview in the proper folder 2022-05-31 10:55:16 +02:00
missytake
3bb12e4c3c rename workflows 2022-05-31 10:55:16 +02:00
missytake
eb29fdce63 ci: fix variable 2022-05-31 10:55:16 +02:00
missytake
3246dedbd8 fix GH action workflow syntax 2022-05-31 10:55:16 +02:00
missytake
1d22ca7d4d simplify control flow 2022-05-31 10:55:16 +02:00
missytake
cd23abf19b try to fix control flow 2022-05-31 10:55:16 +02:00
bjoern
3b420c7b43 make chat names always searchable (#3377)
* test contact name changes applied everywhere

this test is failing on current master,
a changed authname is set to `contact.authname` but not cached at `chat.name`;
resulting in `dc_chat_get_name()` returning a name
undiscoverable by `dc_get_chatlist(name)`.

* fix: update chat.name on contact.authname changes

* do read contact.display_name from database only of chat.name is empty

* update CHANGELOG
2022-05-30 18:35:11 +02:00
adbenitez
16e0f0e986 apply isort and black formatters, add format checking to CI 2022-05-29 21:11:49 -04: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
jikstra
0f34ca8962 bump version to 1.84.0 2022-05-29 16:11:33 +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
jikstra
82c190a0c5 Node tests should not only run for pull requests 2022-05-27 08:18:50 +02:00
dependabot[bot]
7e5c22b6c7 cargo: bump regex from 1.5.5 to 1.5.6
Bumps [regex](https://github.com/rust-lang/regex) from 1.5.5 to 1.5.6.
- [Release notes](https://github.com/rust-lang/regex/releases)
- [Changelog](https://github.com/rust-lang/regex/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/regex/compare/1.5.5...1.5.6)

---
updated-dependencies:
- dependency-name: regex
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-25 10:29:09 +00:00
dependabot[bot]
c20c3db0ef cargo: bump sanitize-filename from 0.3.0 to 0.4.0
Bumps [sanitize-filename](https://github.com/kardeiz/sanitize-filename) from 0.3.0 to 0.4.0.
- [Release notes](https://github.com/kardeiz/sanitize-filename/releases)
- [Commits](https://github.com/kardeiz/sanitize-filename/commits)

---
updated-dependencies:
- dependency-name: sanitize-filename
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-25 10:28:42 +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
missytake
eebd219414 Improve node publish ci (#3344)
* don't start workflow on py-*tag

* move node.js tests to separate action

* node.js CI: move PR ID and tags to environment variables

* node.js CI: small bracket mistake

* delete prebuilds.tar.gz before packaging

* use node/README.md as npm README
2022-05-24 00:41:18 +02:00
Hocuri
27fd0dbaec Update drafts/aeap-mvp.md (#3355)
* Rename aeap-mvp.rst to aeap-mvp.md

* Update aeap-mvp.md

* Apply suggestions from hpk's review

Co-authored-by: holger krekel  <holger@merlinux.eu>

* Additions to holger's review

* Decide on TODOs

* Drop the "If we are going to assign a message to a chat, but the sender is not a member of this chat" condition again

Co-authored-by: holger krekel  <holger@merlinux.eu>
2022-05-23 21:01:55 +02:00
Hocuri
b7af53c7d9 When changing self addr, transfer private key to new addr (#3351)
fix #3267
2022-05-23 19:25:53 +02:00
Hocuri
c762834e05 Make recv_msg() return the received Message (#3353) 2022-05-23 18:08:39 +02: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
Hocuri
9549aca48b Remove some AsRef<str> (#3354)
Using &str instead of AsRef is better for compile times, binary size and code complexity.
2022-05-23 12:57:50 +02: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
Jikstra
307063ade0 bump version to 1.83.0 (#3338) 2022-05-19 21:02:53 +02:00
Jikstra
ed00adbecc Fix node prebuilds path (#3337) 2022-05-19 20:56:34 +02:00
bjoern
2aaa850e25 prepare 1.82 (#3336)
* update changelog for 1.82.0

pr #3322 as added to 1.81.0 by accident;
it was never part of 1.81.0 but is now part of 1.82.0.

* bump version to 1.82.0
2022-05-19 19:45:13 +02:00
missytake
8859da42c6 Fix github action to publish node bindings (#3335)
* make upload to previews fail if it's executed on a tag not a PR

* node-package.yml: use tag in uploaded file name

* rename file to node-§tag.tar.gz before upload

* get rid of bash error?
2022-05-19 19:45:01 +02:00
Hocuri
2968c2919c Use params_iter() instead of manually constructing Vec 2022-05-18 19:13:28 +02:00
bjoern
33b10fa719 re-add removed DC_MSG_ID_MARKER1 as in use on iOS (#3330)
in fact, `get_chat_msgs()` with `marker1before` is not used on iOS,
however, iOS still needs the special chat-id.

in #3274 we did not check this possibility.

it may be changed, of course, however, that would requore some refactorings
in an anyway complicated area and is probably not worth the effort.
2022-05-17 19:31:11 +02: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
bjoern
380d7e66b5 prepare 1.81 (#3329)
* update changelog for 1.81.0

* bump version to 1.81.0
2022-05-17 17:07:47 +02:00
bjoern
eb80fa4eb0 create same contact-colors when addresses differ in upper-/lowercase (#3327)
* create same contact-colors when addresses differ in upper-/lowercase

this leaves group-colors based on group names as is,
so, "MY GROUP" creates a different color than "my group",
as these names are better synced and also not an ID in this sense,
this is probably fine here.
(also when looking at the examples from
https://xmpp.org/extensions/xep-0392.html#testvectors-fullrange-no-cvd ,
case-sensistifity for group names seems to be fine)

* add a test for upper-/lowercase in group names

* update CHANGELOG
2022-05-17 14:48:33 +02:00
Hocuri
88b470e8e5 Better error reporting when creating a folder fails (#3325)
Fixes #3310
2022-05-17 10:40:44 +02:00
bjoern
99f8785475 unify language and method names (#3321) 2022-05-16 22:41:42 +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
Simon Laux
1f8b04bd42 add webxdc document property to deltachat node typings 2022-05-16 14:41:55 +02:00
link2xt
d790a5fba9 Update link to K-9 Mail blog post 2022-05-15 23:38:27 +00:00
bjoern
2fc0a0964b allow webxdc document names (#3317)
* allow webxdc document names

* test document webxdc property

* update CHANGELOG
2022-05-15 12:10:09 +02: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
B. Petersen
a9f707c398 document source_code_url in webxdc-reference 2022-05-14 14:02:17 +02: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
missytake
c9beaa2aa1 finish integrating node bindings into core repository
don't ignore core sourcefiles,
prevented npm installation on architectures with no prebuild
don't run lint checks on windows
github actions don't like double quotes apparently
minimize node.js CI
update ubuntu runner to 22.04
README: update link to node bindings source
simplify link in readme
node: fix crash with invalid account id
(throw error when getContext failed)
fix typo in readme
remove node specific changelog
change prebuild machine back to ubuntu 18.04
move package.json to root level to include rust source in npm package
change path in m1 patch
github action to upload to download.delta.chat/node/ on tag
try build with ubuntu 20.04
Update node/README.md
try building it with newer ubuntu because it wants glibc 2.33
fix path for prebuildify script
throw error when instanciating a wrapper class on `null`
(Context, Message, Chat, ChatList and so on)
try fix selecting the right cache
to fix the strange glibc bug
also revert back ubuntu version to 18.04
also bump package.json version with release script
fix paths since we moved around package.json
github action: fix path
document npm release - it's so much easier now!
there are no PR checks to post to if this action is executed on a tag
github action: fix artifact names
fix paths? wtf do I know, it's 3AM and I'm drunk
fix syntax error
don't upload preview if action is run on tag
is the tag ID an empty string or null?
node-package github action is done so far
also include scripts in package
only publish docs on push to master branch
actually bump package.json version in set_core_version script
prettify package.json
fix test - we don't really need to assert that
remove unnecessary ls statement from github action
2022-05-13 21:25:35 +02:00
missytake
b238c7e743 pull latest changes from deltachat-node 2022-05-13 21:25:35 +02:00
missytake
e9511ebfc3 first steps to integrate deltachat-node to core repository, adjust CI:
adjust scripts to new location of deltachat-core-rust
adjust dc-node readme to repo change
mention old repository
migrate github actions, try out if they work
fix path to node docs in SSH github action
passing mailadm token to node tests
hopefully fixing the download paths for the artifacts
fixing download paths, this time for real
post upload link to details
fix scp command
forgot to remove platform_status dict
fixing paths in the github action
add github action to delete node preview builds when PR is closed
move environment variable to yaml
remove git trash
github action to release to npm
use different action which also works with branches for testing
we don't want to publish to NPM through the CI
see what lint issues windows has
2022-05-13 21:25:35 +02:00
missytake
a786a1427d blindly copying deltachat-node to core repository 2022-05-13 21:25:35 +02:00
bjoern
961612370d add source_code_url to manifest and get_webxdc_info, add a test (#3314) 2022-05-13 21:00:36 +02:00
link2xt
bd5b9573f6 Deprecate marker1before argument of dc_get_chat_msgs() 2022-05-13 20:55:43 +02:00
bjoern
e603a10ab4 webxdc: discourage usage of the <title> tag (#3309) 2022-05-11 22:07:43 +02:00
Rosano
984346d682 Link to guidebook 2022-05-11 18:35:54 +02:00
Rosano
f4cecb61bc Link to webxdc organization 2022-05-10 22:52:31 +02:00
holger krekel
cffa101419 remove usage of py in favor of pathlib 2022-05-09 21:22:19 +02:00
holger krekel
1d7d201b5b remove a log line and a return 2022-05-09 21:22:19 +02:00
holger krekel
c0e4e12138 Introduce caching of configured live accounts in each test process 2022-05-09 21:22:19 +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
bjoern
01ef053a11 bubble up signing error instead of panicing (#3304)
.expect() may panic, which is probably not what we want here.
it seems better to bubble up the error (as we are doing in the other cases)

(i was checking some .expect usages after we had a similar issue at #3264)
2022-05-08 20:17:50 +02:00
Hocuri
8988c775fe Abort instead of unwinding on panic (#3259) 2022-05-08 17:52:52 +02:00
holger krekel
c8bfa98b6b actually enable online account caching. previously it was creating (>100) online test accounts 2022-05-05 16:18:59 +02:00
bjoern
34053c7608 prepare 1.80 (#3288)
* update changelog for 1.80.0

* bump version to 1.80.0
2022-05-05 12:21:12 +02:00
bjoern
785667ec07 fix qr-code display (#3295)
* tagger.put_raw() has changes sematics and escapes strings on its own now

an explicit escaping leads to double escaping and to wrong display.

this should also improve lenght calculation,
as a quote and other specials counts as 1 character and not as 4-6.

* test encoding of generated qr-code-svg

* streamline function argument wording

use qrcode_description instead of raw_qrcode_description -
there is nothing "raw" in the argument,
it is a string as used throughout the app.
2022-05-05 11:55:05 +02:00
bjoern
9a0a3c4b00 fix "scheduler already started" log entry (#3294)
i was wondering mainly about the whole line
"Failed to start IO: scheduler is already stopped".
i think it has to be "already started" and not "already stopped".
2022-05-04 18:09:55 +02:00
missytake
e56c261c73 Merge pull request #3292 from deltachat/fix_more_py
fix flaky test to not rely on timing
2022-05-04 13:34:48 +02:00
holger krekel
32a9db6922 fix flaky test to not rely on timing 2022-05-04 13:29:08 +02:00
holger krekel
77498c17a5 reorder tests to provide a complex/offline/online distinction, also speeding up distributed test runs. 2022-05-04 13:17:08 +02:00
holger krekel
54c07f89f2 also guard the ac_process_ffi_event calling 2022-05-04 12:08:47 +02:00
holger krekel
cd4d265055 safer handling of calling account hooks, refined shutdown comment 2022-05-04 12:08:47 +02:00
holger krekel
81ee69010d add a comment, fix a typo in debug message 2022-05-04 12:08:47 +02:00
holger krekel
138d5b7a02 fix segfaults with python runs -- i don't get them anymore, and can also control-c at will 2022-05-04 12:08:47 +02:00
bjoern
95a54a43ff update provider database (#3284)
ran `./src/provider/update.py ../provider-db/_providers/ > src/provider/data.rs`
2022-05-03 23:57:53 +02:00
holger krekel
ca59cbc898 make direct_imap idle usage safe from tests, so we never miss finishing direct_imap idle 2022-05-03 22:56:23 +02:00
holger krekel
21f72ad845 new --debug-setup option to show events during account setup. 2022-05-03 22:50:16 +02:00
holger krekel
40fd98d580 show logs for pseudo configured accounts (for online ones they are instantiated later) 2022-05-03 22:50:16 +02:00
holger krekel
0422d751d8 avoid instatiating a full blown Account object just for showing some core info 2022-05-03 19:35:03 +02:00
holger krekel
e44f68db83 prevent one strange traceback probably caused by ongoing shutdown 2022-05-03 19:35:03 +02:00
holger krekel
88cbf42c39 fix various tests 2022-05-03 19:35:03 +02:00
holger krekel
45157f79a3 fix examples 2022-05-03 19:35:03 +02:00
holger krekel
f5157392b6 some renaming and some docstrings 2022-05-03 19:35:03 +02:00
holger krekel
f631ec3a7c shift startio/init machinery into PendingConfigure class 2022-05-03 19:35:03 +02:00
holger krekel
a9b2750ec9 slight renamings 2022-05-03 19:35:03 +02:00
holger krekel
7fbdb42695 remove _configtracker and write a tested "PendingConfigure" helper class for managing configure/started states for test accounts 2022-05-03 19:35:03 +02:00
holger krekel
026dd4480e add --extra-info CLI option (defaults to False for interactive runs) 2022-05-03 19:35:03 +02:00
holger krekel
b373e7acba more renames 2022-05-03 19:35:03 +02:00
holger krekel
d2ca54c167 provide for meaningful names for bringing accounts online for test functions 2022-05-03 19:35:03 +02:00
holger krekel
e070284a09 strike setting "displayname" in test plugin and refine two tests which implicitely relied on this 2022-05-03 19:35:03 +02:00
holger krekel
e4e02ea3c0 improve error messages during live creation of accounts 2022-05-03 19:35:03 +02:00
holger krekel
a947980eb6 slight reorg for creating accounts from liveconfig 2022-05-03 19:35:03 +02:00
holger krekel
f11c3dd3e3 fix bench test 2022-05-03 19:35:03 +02:00
holger krekel
394067be63 refactor session_liveconfig_producer to become a more geneal testprocess management object 2022-05-03 19:35:03 +02:00
holger krekel
2494613583 - perform direct_imap init in testplugin instead of global deltachat
plugin, probably also helping to avoid some segfeaults during teardown

- some API renaming on the side (too hard to split into separate commit, sorry)
2022-05-03 19:35:03 +02:00
holger krekel
77c60e7450 refine test support function name 2022-05-03 19:35:03 +02:00
holger krekel
04dd2d93d0 trim online account creation to a single get_online_accounts() function 2022-05-03 19:35:03 +02:00
holger krekel
5e5710ecce streamline configuration handling for test accounts, removing one layer of flags 2022-05-03 19:35:03 +02:00
holger krekel
c1b33a66c4 refactor "quiet" parameter away and provide more precise logging-control 2022-05-03 19:35:03 +02:00
holger krekel
0e3165d724 unify get_unconfigured_account and make_account 2022-05-03 19:35:03 +02:00
holger krekel
3e12eab0b5 remove make_account from get_online_config and rename the latter to get_next_liveconfig to avoid one indirection 2022-05-03 19:35:03 +02:00
holger krekel
87365e4a43 - remove superflous early set_configs to separate config / account making better
- avoid low-level dc_* API access from testplugin
2022-05-03 19:35:03 +02:00
holger krekel
3e16a47ff2 remove unnccesary distinction between offline/online accounts in make_account, simplifying api/usage 2022-05-03 19:35:03 +02:00
holger krekel
874054148e streamline session_live_config implementation and usage 2022-05-03 19:35:03 +02:00
holger krekel
5e39a13bf6 refine waiting for initial startup waiting for "INBOX: Idle" ready
this slows down initialization for tests but provides more stability in my runs
2022-05-03 19:35:03 +02:00
holger krekel
720c1b5eca normalize make_account usage 2022-05-03 19:35:03 +02:00
holger krekel
c7c1a04c6a move large inlined AccountMaker (renamed to ACFactory) to proper class instead of being defined in closure 2022-05-03 19:35:03 +02:00
holger krekel
fd5b224ba0 simplify test setup api by removing pre_generated_keys arguments 2022-05-03 19:35:03 +02:00
holger krekel
0b80ade3ae fix "retry" wording, it isn't but a try :) 2022-05-03 09:31:38 +02:00
bjoern
e1c3e95307 prepare 1.79 (#3281)
* update changelog for 1.79.0

* bump version to 1.79.0
2022-05-02 16:18:00 +02: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
Hocuri
4c9cc4f3d4 Hopefully make test_connectivity() less flaky 2022-04-30 18:07:39 +02: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
holger krekel
f41df327a9 add a little bench file -- "pytest tests/bench_empty.py --durations=10" will tell you how much overhead there is 2022-04-30 13:27:02 +02:00
holger krekel
3f9e3038b7 strike last hard-coded ref to configured_addr 2022-04-30 13:26:50 +02:00
bjoern
c75c95afa9 prepare 1.78 (#3261)
* update changelog for 1.78.0

* bump version to 1.78.0
2022-04-29 18:01:55 +02:00
missytake
d4e0009b89 Merge pull request #3260 from deltachat/imap-tools
replaced imapclient python library with imap-tools
2022-04-29 17:58:50 +02:00
missytake
b97b374487 move imap_tools mypy ignore to mypy.ini 2022-04-29 16:01:48 +02:00
missytake
e27345e489 python bindings: ignore mypy errors for imap_tools 2022-04-29 15:19:48 +02:00
missytake
032e644b2b set default timeout to None 2022-04-29 11:30:06 +02:00
holger krekel
b7ac81701a update depss before we have a few stable core releases 2022-04-29 11:20:25 +02:00
missytake
d59aa35b2f fix mypy errors 2022-04-29 11:14:19 +02:00
holger krekel
4c7c4e2a81 better document one sometimes failing test 2022-04-29 10:06:02 +02:00
holger krekel
521fa58b75 remove timeout 2022-04-29 10:00:43 +02:00
holger krekel
a2e5c60683 - remove one unncessary usage of imap idle
- simplify SEEN bytes/unicode flag issue
- fix a lint issue and a docstring
2022-04-29 09:42:05 +02:00
missytake
5ef152fd84 replaced imapclient python library with imap-tools in the tests. works with testrun.org locally 2022-04-28 16:50:36 +02:00
bjoern
e2ba338923 remove network from dc_provider_new_from_email(), add an explicit function for network provider lookup (#3256) 2022-04-27 15:51:40 +02: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
Robert Schütz
43e3f8f08b python: use pkg-config for system install 2022-04-26 21:48:53 +02:00
bjoern
9cc2fd555f resend messages using the same Message-ID (#3238)
* add dc_resend_msgs() to ffi

* add 'resend' to repl

* implement resend_msgs()

* allow only resending if allowed by chat-protection

this means, resending is denied if a chat is protected and we cannot encrypt
(normally, however, we should not arrive in that state)

* allow only resending of normal, non-info-messages

* allow only resending of own messages

* reset sending state to OutPending on resending

the resulting state is always OutDelivered first,
OutMdnRcvd again would be applied when a read receipt is received.

preserving old state is doable, however,
maybe this simple approach is also good enough, at least for now
(or maybe the simple approach is even just fine :)

another thing: when we upgrade to resending foreign messages,
we do not have a simple way to mark them as pending
as incoming message just do not have such a state -
but this is sth. for the future.
2022-04-26 20:59:17 +02:00
Hocuri
c10dc7b25b re-add quotes in SEARCH command, comment 2022-04-26 18:56:35 +02:00
Hocuri
9e1770316a Use plain get_config(Config::ConfiguredAddr) to not ignore db errors 2022-04-26 18:56:35 +02:00
Hocuri
0e595c9801 Keep the self address casing again instead of lowercasing it 2022-04-26 18:56:35 +02:00
Hocuri
6ae9e43183 schedule_resync() instead of deleting imap_sync 2022-04-26 18:56:35 +02:00
Hocuri
18126b42cb Gossip to secondary addrs in group again 2022-04-26 18:56:35 +02:00
Hocuri
2b233fd810 Don't let repeat_vars() return unnecessary Result 2022-04-26 18:56:35 +02:00
Hocuri
a4f5d2b9b2 More functional get_all_self_addrs() 2022-04-26 18:56:35 +02:00
Hocuri
d29c09caf3 Make sure that the server UIDs are reset when changing accounts 2022-04-26 18:56:35 +02:00
Hocuri
bc809986e7 If unconfigured, let get_all_self_addrs() return vec![], not vec![""]; 2022-04-26 18:56:35 +02:00
Hocuri
5ee2f3696d Fix todo: Make get_primary_self_addr() always lowercase the result 2022-04-26 18:56:35 +02:00
Hocuri
df5eb546e7 Bring back the check that the contact's addr is no self addr in get_all()
Create params_iter() and params_iterv![] helper functions
2022-04-26 18:56:35 +02:00
holger krekel
684351c753 properly construct imap search command for multiple self addresses 2022-04-26 18:56:35 +02:00
holger krekel
a8342e37b9 address latest review comments, move test to implementation file 2022-04-26 18:56:35 +02:00
Hocuri
3b6fc9959f Introduce SecondaryAddrs config and make stuff work 2022-04-26 18:56:35 +02:00
holger krekel
3ffc985968 try fix a sometimes failing test: don't test python's imap idle as it's not needed. also add some more logging. 2022-04-26 15:28:24 +02:00
holger krekel
369609b26c streamline emitting MsgsChanged and IncomingMsg event to go through particular functions. 2022-04-26 10:09:21 +02: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
Hocuri
ceaed0f552 Speedup rust tests (#3242)
Speeds up running the rust tests by about a factor of 2.
2022-04-23 13:50:58 +02:00
Hocuri
e9963ecc0d Also run clippy for benchmarks in CI (#3241)
…and fix two lints
2022-04-22 15:06:34 +02:00
link2xt
9ef0b43c36 Remove job::{Action,Thread}::Unknown variants 2022-04-17 00:00:00 +00:00
holger krekel
801d636eb5 enhance waiting for direct imap idle events to prevent randomness 2022-04-20 23:32:45 +02: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
bjoern
7455989729 webxdc documentation: make function declaration correct JavaScript (#3237)
* webxdc docs: make function declaration correct js

* add 'let'
2022-04-20 12:16:40 +02:00
Sebastian Klähn
8b2b9e1093 update dev-reference to reflect new promise feature for setup (#3220)
* update dev-reference

* Update draft/webxdc-dev-reference.md

Co-authored-by: holger krekel  <holger@merlinux.eu>

* Update draft/webxdc-dev-reference.md

Co-authored-by: Simon Laux <Simon-Laux@users.noreply.github.com>
Co-authored-by: holger krekel  <holger@merlinux.eu>
2022-04-19 15:43:05 +02: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
Robert Schütz
969508ae36 dynamic libraries use dylib extension on Darwin 2022-04-19 08:56:29 +02:00
bjoern
f581ecc805 url-safe id generation (#3231)
* test dc_create_id() for invalid characters

* create url-save ids (as documented)
2022-04-18 17:21:33 +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
bjoern
a4d5c8cd2f show 'Not connected' if storage information are not yet available (#3222)
* show 'Not connected' if storage information are not yet available

'One moment' is a bit misleading in case the device is offline
as it will take more than a moment until that will be updated :)

* update CHANGELOG
2022-04-16 18:35:25 +02:00
Simon Laux
330665afbe don't start io on unconfigured context 2022-04-16 17:48:16 +02:00
holger krekel
be1d87c3c3 do imap expiration/deletion after fetching messages, to avoid unneccessary delays. 2022-04-16 17:19:31 +02: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
holger krekel
9c04ed483e Streamline access/working with configured params and configured addr (#3219) 2022-04-16 09:50:26 +02:00
Hocuri
a8a5e184ab Don't unnecessarily interrupt ephemeral loop (#3221)
Follow-up for #3211
2022-04-15 21:30:01 +02:00
Sebastian Klähn
c571595980 Fix #3186 (#3218)
* fix

* code-review fixes

* check if chat is restored correctly

* add changelog-entry

* Update src/dc_receive_imf.rs

Co-authored-by: Asiel Díaz Benítez <adbenitez@nauta.cu>

* Update CHANGELOG.md

Co-authored-by: Asiel Díaz Benítez <adbenitez@nauta.cu>

Co-authored-by: Asiel Díaz Benítez <adbenitez@nauta.cu>
2022-04-14 19:12:31 +02:00
Sebastian Klähn
80f2ccc9ed improve error message (#3217)
use actual path instead of placeholder
2022-04-14 12:32:44 +02:00
bjoern
b2e9e57859 add status_update_serial to webxdc_status_update event (#3215)
this bypasses the replication safety introduced by letting the caller track the last serial,
however, in case of bots that do not track much state and do not playback updates anyway,
it is still useful.
2022-04-14 11:12:17 +02:00
Hocuri
3c75b36148 clippy 2022-04-12 22:26:44 +00:00
Hocuri
bcd8e330cb Add test for ephemeral deletion 2022-04-12 22:26:44 +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
bjoern
69bd5d2ab0 Webxdc scaling/viewport is implementation specific (#3214)
at least on iOS we would need to inject a script to force a behavior,
that is hard to merge with settings set by the Webxdc.

therefore, the easiest approach seems to be to leave that completely up to the Webxdc -
and, in practise, many Webxdc already set viewports, including scaling.
2022-04-12 14:54:05 +02:00
Floris Bruynooghe
6eaf04107d Auto-approve dependabot PRs
There is very little to be gained by having to approve those PRs, and
it is a lot of UI interaction to get them approved.
They still will need to be merged manually regardless, so they might
as well be approved by a bot.
2022-04-12 12:44:04 +02:00
bjoern
d80fdb20c7 make Connectivity-View-HTML not scalable (#3213)
* make Connectivity-View-HTML not scalable

in practise, Android and Desktop already disallow scaling
by some other methods,
however, for iOS this is needed as we otherwise
have to do far more complicated things as drafted at
https://github.com/deltachat/deltachat-ios/pull/1531/files

* update CHANGELOG
2022-04-12 12:26:40 +02:00
Hocuri
f618c87ee5 Follow http redirects for autoconfigure (#3208) 2022-04-10 19:27:05 +02:00
bjoern
0721c22073 prepare 1.77 (#3209)
* update changelog for 1.77.0

* bump version to 1.77.0

* Update CHANGELOG.md

Co-authored-by: Hocuri <hocuri@gmx.de>

* reorder changelog, adapt writing style

Co-authored-by: Hocuri <hocuri@gmx.de>
2022-04-10 17:01:30 +02:00
holger krekel
aba066b4d1 only do monthly dependabot updates (#3199)
* only do monthly dependabot updates

* increase dependabot pr limit from 10 to 50 (due to only monthly interval, 10 seems to be too low)

Co-authored-by: B. Petersen <r10s@b44t.com>
2022-04-10 12:38:27 +02:00
Hocuri
2562c726e6 Do ephemeral deletion in async task background loop (#3194)
* Do ephemeral deletion in background loop

1. in start_io start ephemeral async task, in stop_io cancel ephemeral async task

2. start ephemeral async task which loops like this:

- wait until next time a message deletion is needed or an interrupt occurs (see 3.)
- perform delete_expired_messages including sending MSGS_CHANGED events

3. on new messages (incoming or outgoing) with ephemeral timer:

- interrupt ephemeral async task

* Changelog

* Fix and improve test

* no return value needed

* address @link2xt review comments

* slight normalization: have only one place where we wait for interrupt_receiver

* simplify sql statement -- and don't exit the ephemeral_task if there is an sql problem but rather wait

* Remove now-unused `ephemeral_task` JoinHandle

The JoinHandle is now inside the Scheduler.

* fix clippy

* Revert accidental move of the line

* Add log

Co-authored-by: holger krekel <holger@merlinux.eu>
Co-authored-by: link2xt <link2xt@testrun.org>
2022-04-10 12:22:47 +02:00
bjoern
6e3ec71c10 show an error when a webxdc is written for a newer (future) api (#3206)
* add min_api to manifest.toml, define WEBXDC_API_VERSION

* return an error instead of index.html if the webxdc requires a newer api

* add a test with an webxdc requiring a newer api

* update CHANGELOG
2022-04-10 12:16:28 +02:00
Hocuri
2932c1ed35 Configure: Try "imap.*"/"smtp.*"/"mail.*" first (#3207)
* Configure: Try "imap.*"/"smtp.*"/"mail.*" first

Fix half of #3158.

Try "imap.ex.org"/"smtp.ex.org" and "mail.ex.org" first because if a server exists
under this address, it's likely the correct one.

Try "ex.org" last because if it's wrong and the server is configured to
not answer at all, configuration may be stuck for several minutes.

* Changelog

* Add test
2022-04-10 12:16:00 +02:00
Asiel Díaz Benítez
149b31a960 Merge pull request #3187 from deltachat/adb/issue-2557
Send setup-changed messages only in the chats we share with the peer
2022-04-09 19:43:51 -04:00
adbenitez
f1d09e4127 apply rustfmt 2022-04-09 19:15:48 -04:00
Asiel Díaz Benítez
10bdbc95cd Update src/peerstate.rs
Co-authored-by: bjoern <r10s@b44t.com>
2022-04-09 18:23:14 -04: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
holger krekel
bba721654b update deps for 1.30 release series 2022-04-08 13:08:19 +02:00
Hocuri
36a17b0592 oops 2022-04-08 10:54:45 +02:00
Hocuri
b7294d46cf Changelog 2022-04-08 10:54:45 +02:00
Hocuri
d8977b5046 Drop unused table backup_blobs in migration
Today, we solved an issue with holger's phone that he couldn't export
his account anymore because during the `VACUUM` the Android system
killed the app because of OOM. The solution was to drop the table
`backup_blobs`, so let's automatically do this in migration

This table was used back in the olden days when we backuped by exporting
the dbfile and then putting all blobs into it. During import, the
`backup_blobs` table should have been dropped, seems like this didn't
work here.
2022-04-08 10:54:45 +02:00
dependabot[bot]
963bb7f7cf cargo: bump syn from 1.0.90 to 1.0.91
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.90 to 1.0.91.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/1.0.90...1.0.91)

---
updated-dependencies:
- dependency-name: syn
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-07 11:41:57 +02:00
Hocuri
7d3a08599e Changelog 2022-04-06 17:51:01 +02:00
Hocuri
345a4bc504 Give setup-changed messages the same timestamp as the previous message (#3188) 2022-04-06 17:05:44 +02:00
dependabot[bot]
7bfdf2e2f5 Merge pull request #3189 from deltachat/dependabot/cargo/zip-0.6.2 2022-04-05 08:27:49 +00:00
dependabot[bot]
d9ac5d88e9 cargo: bump zip from 0.6.1 to 0.6.2
Bumps [zip](https://github.com/zip-rs/zip) from 0.6.1 to 0.6.2.
- [Release notes](https://github.com/zip-rs/zip/releases)
- [Commits](https://github.com/zip-rs/zip/commits)

---
updated-dependencies:
- dependency-name: zip
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-04 21:13:27 +00:00
bjoern
2cf11bb2ea muted chats stay archived (#3184)
* do not unarchive muted chats on sending/receving messages

* add a test for unarchive muted chats

* update CHANGELOG

* improve test_unarchive_if_muted
2022-04-04 11:02:36 +02:00
adbenitez
e29d008914 send setup-changed messages only in the chats we share with the peer, do not create contact request 2022-04-04 01:05:49 -04: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
Floris Bruynooghe
3c20d0902e Add explicit tests for special ContactId values
Turns out some FFI users don't use the constants.  Scary.
2022-04-03 20:35:09 +02:00
Floris Bruynooghe
f2c1e5c6e5 Replace some ContactId::new() calls with constants 2022-04-03 20:35:09 +02:00
Floris Bruynooghe
feb354725a Make ContactId::LAST_SPECIAL private
Also remove the Ord implementations, this makes ContactId more opaque
by no longer letting people deal with the fact this is ordered.
2022-04-03 20:35:09 +02:00
Floris Bruynooghe
35c0434dc7 Move ContactId constants to struct.
This makes the APIs much more Rust-like and keep contact IDs clearer
and in one place.
2022-04-03 20:35:09 +02:00
Hocuri
918ee47c79 Consider outgoing messages to just one receiver as "private message" (#3177) 2022-04-03 19:19:10 +02: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
Floris Bruynooghe
16d201faca Re-enable custom Display for ContactId
Caught another case of using Display instead of ToSql, now all tests
pass again.
2022-04-02 17:19:00 +02:00
dependabot[bot]
ea0cf67f98 cargo: bump zip from 0.6.0 to 0.6.1
Bumps [zip](https://github.com/zip-rs/zip) from 0.6.0 to 0.6.1.
- [Release notes](https://github.com/zip-rs/zip/releases)
- [Commits](https://github.com/zip-rs/zip/commits)

---
updated-dependencies:
- dependency-name: zip
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-02 16:09:44 +02:00
holger krekel
612132b7c8 move invariant out of loop, less LOC and 1.5% faster 2022-04-01 14:33:57 +02:00
holger krekel
26470c6047 apply hocuri's niceifcation 2022-04-01 14:33:57 +02:00
holger krekel
93d3522f67 stylistic changes 2022-04-01 14:33:57 +02:00
holger krekel
c6d901d799 first iteration of faster sorting 2022-04-01 14:33:57 +02:00
B. Petersen
4880f9ff32 improve repl message search
- allow spaces in queries
- show query and scope below result
2022-04-01 11:46:26 +02:00
holger krekel
aaa42a3412 feedback if missing env var 2022-03-31 17:05:33 +02:00
holger krekel
3e5e852e20 1.30 is imminent so i think it makes sense to do a cargo-update now for all deps, to detect issues as early as possible before releases go to stores. 2022-03-31 16:53:38 +02:00
holger krekel
0a3f44bd73 housekeeping cleanup: factor out remove-unused-files logic 2022-03-31 16:45:58 +02:00
holger krekel
d4fed5f5f7 add chatlist loading benchmark 2022-03-31 16:45:45 +02:00
dependabot[bot]
dce7b90fc2 cargo: bump native-tls from 0.2.8 to 0.2.10
Bumps [native-tls](https://github.com/sfackler/rust-native-tls) from 0.2.8 to 0.2.10.
- [Release notes](https://github.com/sfackler/rust-native-tls/releases)
- [Changelog](https://github.com/sfackler/rust-native-tls/blob/master/CHANGELOG.md)
- [Commits](https://github.com/sfackler/rust-native-tls/compare/v0.2.8...v0.2.10)

---
updated-dependencies:
- dependency-name: native-tls
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-30 20:15:21 +02:00
dependabot[bot]
4f94bdff3f Merge pull request #3160 from deltachat/dependabot/cargo/async-trait-0.1.53 2022-03-29 13:44:16 +00:00
dependabot[bot]
ce1f2a6fd4 Merge pull request #3162 from deltachat/dependabot/cargo/quote-1.0.17 2022-03-29 13:43:22 +00:00
dependabot[bot]
da292bb9b2 cargo: bump quote from 1.0.16 to 1.0.17
Bumps [quote](https://github.com/dtolnay/quote) from 1.0.16 to 1.0.17.
- [Release notes](https://github.com/dtolnay/quote/releases)
- [Commits](https://github.com/dtolnay/quote/compare/1.0.16...1.0.17)

---
updated-dependencies:
- dependency-name: quote
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-29 08:07:43 +00:00
dependabot[bot]
326a75d0e8 Merge pull request #3161 from deltachat/dependabot/cargo/syn-1.0.90 2022-03-29 08:05:58 +00:00
dependabot[bot]
e47860bc2e cargo: bump syn from 1.0.89 to 1.0.90
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.89 to 1.0.90.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/1.0.89...1.0.90)

---
updated-dependencies:
- dependency-name: syn
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-28 21:14:00 +00:00
dependabot[bot]
6212151562 cargo: bump async-trait from 0.1.52 to 0.1.53
Bumps [async-trait](https://github.com/dtolnay/async-trait) from 0.1.52 to 0.1.53.
- [Release notes](https://github.com/dtolnay/async-trait/releases)
- [Commits](https://github.com/dtolnay/async-trait/compare/0.1.52...0.1.53)

---
updated-dependencies:
- dependency-name: async-trait
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-28 21:13:49 +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
Floris Bruynooghe
b2fe723570 Do not read whole webxdc file into memory
This seems not only wasteful but genuinly has the risk someone makes
their device useless by accidentally adding a huge file.

This also re-structures the checks a little: The if-conditions are
flattened out and cheap checks are done before more expensive ones.
2022-03-28 14:48:55 +02: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
Hocuri
e93c9f74c9 Add get_chat_msgs benchmark (#3151) 2022-03-26 15:18:27 +01:00
bjoern
1ab81256e9 remove usued repl command 'event' (#3153)
no need to re-implement that unless there is actually some need.
2022-03-25 15:53:51 +01:00
dependabot[bot]
cb19de57bb Merge pull request #3144 from deltachat/dependabot/cargo/zip-0.6.0 2022-03-23 10:26:36 +00:00
dependabot[bot]
e678e7df8f Merge pull request #3146 from deltachat/dependabot/cargo/log-0.4.16 2022-03-23 10:22:21 +00:00
bjoern
8487eefe46 config_cache fixes (#3145)
* add simple backup export/import test

this test fails on current master
until the context is recrated.

* avoid config_cache races

adds needed SQL-statements to config_cache locking.

otherwise, another thread may alter the database
eg. between SELECT and the config_cache update -
resulting in the wrong value being written to config_cache.

* also update config_cache on initializing tables

VERSION_CFG is also set later, however,
not doing it here will result in bugs when we change DBVERSION at some point.

as this alters only VERSION_CFG and that is executed sequentially anyway,
race conditions between SQL and config_cache
seems not to be an issue in this case.

* clear config_cache after backup import

import replaces the whole database,
so config_cache needs to be invalidated as well.

we do that before import,
so in case a backup is imported only partly,
the cache does not add additional problems.

* update CHANGELOG
2022-03-22 22:46:29 +01:00
dependabot[bot]
86da1aa429 Merge pull request #3147 from deltachat/dependabot/cargo/async-std-1.11.0 2022-03-22 21:37:45 +00:00
dependabot[bot]
48b580b59e cargo: bump async-std from 1.10.0 to 1.11.0
Bumps [async-std](https://github.com/async-rs/async-std) from 1.10.0 to 1.11.0.
- [Release notes](https://github.com/async-rs/async-std/releases)
- [Changelog](https://github.com/async-rs/async-std/blob/master/CHANGELOG.md)
- [Commits](https://github.com/async-rs/async-std/compare/v1.10.0...v1.11.0)

---
updated-dependencies:
- dependency-name: async-std
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-22 21:15:44 +00:00
dependabot[bot]
8b568d796e cargo: bump log from 0.4.14 to 0.4.16
Bumps [log](https://github.com/rust-lang/log) from 0.4.14 to 0.4.16.
- [Release notes](https://github.com/rust-lang/log/releases)
- [Changelog](https://github.com/rust-lang/log/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/log/commits)

---
updated-dependencies:
- dependency-name: log
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-22 21:15:36 +00:00
dependabot[bot]
4b5af85094 cargo: bump zip from 0.5.13 to 0.6.0
Bumps [zip](https://github.com/zip-rs/zip) from 0.5.13 to 0.6.0.
- [Release notes](https://github.com/zip-rs/zip/releases)
- [Commits](https://github.com/zip-rs/zip/commits/v0.6)

---
updated-dependencies:
- dependency-name: zip
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-21 21:16:26 +00:00
B. Petersen
8d0be06f45 log file size on backup import
due to an bug from Apple copying files from/to iPhones
(cmp. https://support.delta.chat/t/import-backup-to-ios/1628/7 )
it may easily happen that one gets corrupted/partly backups.

such imports usually fail with some error,
however, for debugging it is nice to have the concrete file size in the log.
2022-03-21 22:09:22 +01:00
link2xt
26ae8accd4 Automatically unblock chats with outgoing messages 2022-03-20 18:03:10 +00:00
Hocuri
321e3e27de Introduce config caching (#3131)
* Introduce config caching

* Changelog

* Update CHANGELOG.md

Co-authored-by: bjoern <r10s@b44t.com>

* Cache a value after reading it

Co-authored-by: bjoern <r10s@b44t.com>
2022-03-21 10:13:43 +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
Hocuri
1e94ad25e1 Use repeat_vars() more (#3133) 2022-03-20 15:23:11 +01: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
dependabot[bot]
c162c23d9e Merge pull request #3135 from deltachat/dependabot/cargo/tagger-4.3.3 2022-03-18 23:22:23 +00:00
dependabot[bot]
90fd1c300f Merge pull request #3136 from deltachat/dependabot/cargo/quote-1.0.16 2022-03-18 23:21:09 +00:00
dependabot[bot]
902a9cc812 Merge pull request #3137 from deltachat/dependabot/cargo/libc-0.2.121 2022-03-18 23:20:24 +00:00
dependabot[bot]
c51e1805fa cargo: bump libc from 0.2.120 to 0.2.121
Bumps [libc](https://github.com/rust-lang/libc) from 0.2.120 to 0.2.121.
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Commits](https://github.com/rust-lang/libc/compare/0.2.120...0.2.121)

---
updated-dependencies:
- dependency-name: libc
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-18 21:10:46 +00:00
dependabot[bot]
7a2b9e85e7 cargo: bump quote from 1.0.15 to 1.0.16
Bumps [quote](https://github.com/dtolnay/quote) from 1.0.15 to 1.0.16.
- [Release notes](https://github.com/dtolnay/quote/releases)
- [Commits](https://github.com/dtolnay/quote/compare/1.0.15...1.0.16)

---
updated-dependencies:
- dependency-name: quote
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-18 21:10:40 +00:00
dependabot[bot]
547c40cd52 cargo: bump tagger from 4.3.1 to 4.3.3
Bumps [tagger](https://github.com/tiby312/tagger) from 4.3.1 to 4.3.3.
- [Release notes](https://github.com/tiby312/tagger/releases)
- [Commits](https://github.com/tiby312/tagger/commits)

---
updated-dependencies:
- dependency-name: tagger
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-18 21:10:30 +00:00
Floris Bruynooghe
e2d631097d Fix master by reverting ContactId Display impl (#3134)
Actual fix needs more investigation, it's not obvious.
2022-03-17 19:29:18 +01:00
Floris Bruynooghe
cc55be0b0a Customise Display impl of ContactId
This brings the Display of ContactId in line with those of ChatId etc,
which is a bit clearer is logs and such places.

It also updates an SQL query to rely on the ToSql impl of ContactId
rather than it's Display when building the query.
2022-03-16 22:41:14 +01:00
dependabot[bot]
64927190bd Merge pull request #3132 from deltachat/dependabot/cargo/syn-1.0.89 2022-03-16 21:39:21 +00:00
dependabot[bot]
24515126fe cargo: bump syn from 1.0.88 to 1.0.89
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.88 to 1.0.89.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/1.0.88...1.0.89)

---
updated-dependencies:
- dependency-name: syn
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-16 21:14:45 +00:00
Hocuri
7a56a93028 Fix long filenames containing dots (#3098) 2022-03-16 20:41:24 +01:00
Hocuri
ea7fc3a171 Benchmark dc_receive_imf() (#3128)
Don't count the account creation in the receive emails benchmark

Use Criterion's async support

See https://bheisler.github.io/criterion.rs/book/user_guide/benchmarking_async.html
2022-03-16 20:30:33 +01:00
dependabot[bot]
ae36a26045 cargo: bump image from 0.23.14 to 0.24.1
Bumps [image](https://github.com/image-rs/image) from 0.23.14 to 0.24.1.
- [Release notes](https://github.com/image-rs/image/releases)
- [Changelog](https://github.com/image-rs/image/blob/master/CHANGES.md)
- [Commits](https://github.com/image-rs/image/commits)

---
updated-dependencies:
- dependency-name: image
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-16 13:10:24 +01:00
dependabot[bot]
d6c9f5c64b cargo: bump textwrap from 0.14.2 to 0.15.0
Bumps [textwrap](https://github.com/mgeisler/textwrap) from 0.14.2 to 0.15.0.
- [Release notes](https://github.com/mgeisler/textwrap/releases)
- [Changelog](https://github.com/mgeisler/textwrap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mgeisler/textwrap/compare/0.14.2...0.15.0)

---
updated-dependencies:
- dependency-name: textwrap
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-16 11:23:12 +01:00
dependabot[bot]
c4f4f4295b cargo: bump async-std-resolver from 0.20.4 to 0.21.1
Bumps [async-std-resolver](https://github.com/bluejekyll/trust-dns) from 0.20.4 to 0.21.1.
- [Release notes](https://github.com/bluejekyll/trust-dns/releases)
- [Changelog](https://github.com/bluejekyll/trust-dns/blob/main/CHANGELOG.md)
- [Commits](https://github.com/bluejekyll/trust-dns/compare/v0.20.4...v0.21.1)

---
updated-dependencies:
- dependency-name: async-std-resolver
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-16 10:59:56 +01: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
dependabot[bot]
799688af76 cargo: bump libc from 0.2.119 to 0.2.120
Bumps [libc](https://github.com/rust-lang/libc) from 0.2.119 to 0.2.120.
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Commits](https://github.com/rust-lang/libc/compare/0.2.119...0.2.120)

---
updated-dependencies:
- dependency-name: libc
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-16 10:55:58 +01:00
dependabot[bot]
260e95d027 cargo: bump syn from 1.0.86 to 1.0.88
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.86 to 1.0.88.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/1.0.86...1.0.88)

---
updated-dependencies:
- dependency-name: syn
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-16 10:55:20 +01:00
Floris Bruynooghe
f9ee70aa2e Minor cleanup of Viewtype
Provide checking for attachment as a method and move it to the message
module.  The method is a lot easier to read and have correct
expectations about.
2022-03-16 10:46:58 +01:00
Hocuri
50f13cb84b Set X-Microsoft-Original-Message-ID on outgoing emails for amazonaws (#3077) 2022-03-13 14:39:49 +01:00
dependabot[bot]
fc7e08bb49 Merge pull request #3087 from deltachat/dependabot/cargo/strum-0.24.0 2022-03-13 11:44:29 +00:00
dependabot[bot]
06ed3e5dfd cargo: bump strum from 0.23.0 to 0.24.0
Bumps [strum](https://github.com/Peternator7/strum) from 0.23.0 to 0.24.0.
- [Release notes](https://github.com/Peternator7/strum/releases)
- [Changelog](https://github.com/Peternator7/strum/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Peternator7/strum/commits)

---
updated-dependencies:
- dependency-name: strum
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-13 10:50:20 +00:00
dependabot[bot]
4d792ad57b Merge pull request #3089 from deltachat/dependabot/cargo/strum_macros-0.24.0 2022-03-13 10:48:56 +00:00
dependabot[bot]
4fa78bfca0 Merge pull request #3114 from deltachat/dependabot/cargo/once_cell-1.10.0 2022-03-13 10:29:47 +00:00
link2xt
2012833cb3 Fix lint 2022-03-12 20:07:00 +00:00
link2xt
e48eef7e32 Start ephemeral timer when seen status is synchronized via imap 2022-03-12 19:28:31 +00:00
bjoern
74ac9c3a92 fix docs: dc_markseen_msgs() is typically called when scrolling through message list, not chat list. (#3120) 2022-03-12 13:45:22 +01:00
Hocuri
a907d789d6 Assign replies from different address to two-member-groups (#3119)
Holger had a case where he wrote with someone using a classing MUA.

He opened a two-member-group with this person (which also allowed him to
set the subject).

At some point the other person replied from a different email address.

What he expected: This reply should be sorted into the two-member-group.
What happened: This reply was sorted into the 1:1 chat.

---

I had added the line && chat_contacts.contains(&from_id) months ago when I wrote
this code because it seemed vaguely sensible but without any real
reason. So, let's remove it and see if it creates other problems -
my gut feeling is no.
2022-03-12 10:47:58 +00:00
dependabot[bot]
fc46c0b49c Merge pull request #3121 from deltachat/dependabot/cargo/tagger-4.3.1 2022-03-12 10:36:51 +00:00
dependabot[bot]
fef7862045 cargo: bump tagger from 4.2.1 to 4.3.1
Bumps [tagger](https://github.com/tiby312/tagger) from 4.2.1 to 4.3.1.
- [Release notes](https://github.com/tiby312/tagger/releases)
- [Commits](https://github.com/tiby312/tagger/commits)

---
updated-dependencies:
- dependency-name: tagger
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-11 21:23:15 +00:00
Hocuri
d9441a6bdd Also resync UIDs in folders that are not configured (#2289) 2022-03-10 16:12:24 +01:00
Simon Laux
332cb0896b add note about perl requirement to readme
closes #3106
2022-03-10 12:53:34 +01:00
dependabot[bot]
d1b0c28924 Merge pull request #3084 from deltachat/dependabot/cargo/libc-0.2.119 2022-03-09 11:28:43 +00:00
dependabot[bot]
dce958aac4 Merge pull request #3115 from deltachat/dependabot/cargo/regex-1.5.5 2022-03-09 11:26:52 +00:00
Floris Bruynooghe
438940219e Introduce a ContactId newtype
This makes the contact ID its own newtype instead of being a plain
u32.  The change purposefully does not yet try and reap any benefits
from this yet, instead aiming for a boring change that's easy to
review.  Only exception is the ToSql/FromSql as not doing that yet
would also have created churn in the database code and it is easier to
go straight for the right solution here.
2022-03-08 22:57:51 +01:00
link2xt
f28fcec81d imap: do not treat messages without Message-ID as duplicates
Message-IDs are now retrieved only during fetching and saved into imap
table. dc_receive_imf_inner does not attempt to extract the Message-ID
anymore.

For messages without Message-ID the ID is now generated in
imap::fetch_new_messages rather than dc_receive_imf_inner,
so the same ID is used in the imap table (maintained by the imap
module) and msgs table (maintained by dc_receive_imf module).

Message-ID generation based on the Date, From and To field hashing has
been replaced with a simple dc_create_id() to avoid retrieving Date,
From, and To fields in the imap module, as it's hard to test that it
stays compatible between Delta Chat versions in this module. This
breaks jump-to-quote for quoted messages without Message-ID, which is
not critical.

Also prefetch X-Microsoft-Original-Message-ID, so retrieval of
duplicate messages with X-Microsoft-Original-Message-ID can be skipped
like it is done for messages with Message-ID header.
2022-03-08 15:23:22 +00:00
missytake
586d027f86 Merge pull request #3103 from deltachat/docs-gh-action
GitHub Action to build & upload the rust documentation to rs.delta.chat
2022-03-08 16:02:57 +01:00
gerryfrancis
bd4fb7486d Various corrections #1 (#2983)
* Various corrections

Monk business... ;)

* Update deltachat.h

* Update deltachat.h

* Update deltachat.h

* Update deltachat.h

* Update deltachat.h

* Update deltachat.h

* Update deltachat.h

* Update deltachat.h

* use correct spelling for parameter name

Co-authored-by: B. Petersen <r10s@b44t.com>
2022-03-08 14:23:40 +00:00
dependabot[bot]
f9cd2b8f36 cargo: bump regex from 1.5.4 to 1.5.5
Bumps [regex](https://github.com/rust-lang/regex) from 1.5.4 to 1.5.5.
- [Release notes](https://github.com/rust-lang/regex/releases)
- [Changelog](https://github.com/rust-lang/regex/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/regex/compare/1.5.4...1.5.5)

---
updated-dependencies:
- dependency-name: regex
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-08 14:08:48 +00:00
dependabot[bot]
62e22236b7 Merge pull request #3076 from deltachat/dependabot/cargo/sha2-0.10.2 2022-03-08 14:07:31 +00:00
dependabot[bot]
8b157f427a cargo: bump once_cell from 1.9.0 to 1.10.0
Bumps [once_cell](https://github.com/matklad/once_cell) from 1.9.0 to 1.10.0.
- [Release notes](https://github.com/matklad/once_cell/releases)
- [Changelog](https://github.com/matklad/once_cell/blob/master/CHANGELOG.md)
- [Commits](https://github.com/matklad/once_cell/compare/v1.9.0...v1.10.0)

---
updated-dependencies:
- dependency-name: once_cell
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-08 14:05:07 +00:00
dependabot[bot]
f165c1d9b0 Merge pull request #3110 from deltachat/dependabot/cargo/anyhow-1.0.56 2022-03-08 14:03:59 +00:00
bjoern
500e2d62a0 remove sentbox_move (#3111)
* remove SentboxMove

* adapt python test to removed sendbox_move option

* update CHANGELOG
2022-03-08 11:29:45 +01:00
bjoern
a06e8677ac Fix link to Mozilla (#3112)
it seems to be a bug on the Mozilla servers,
however, they take months to fix that, cmp.
https://bugzilla.mozilla.org/show_bug.cgi?id=1744432
so we just use archive.org for now.
2022-03-08 01:12:19 +01:00
dependabot[bot]
b4d5783928 cargo: bump anyhow from 1.0.53 to 1.0.56
Bumps [anyhow](https://github.com/dtolnay/anyhow) from 1.0.53 to 1.0.56.
- [Release notes](https://github.com/dtolnay/anyhow/releases)
- [Commits](https://github.com/dtolnay/anyhow/compare/1.0.53...1.0.56)

---
updated-dependencies:
- dependency-name: anyhow
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-07 21:24:16 +00:00
missytake
3ce7f45503 use rust toolchain of deltachat-core-rust 2022-03-06 13:28:06 +01:00
missytake
b436c2761a GitHub Action to build & upload the CFFI documentation 2022-03-06 09:59:32 +01:00
missytake
b586d3bb0e only build docs for deltachat crate 2022-03-06 09:43:39 +01:00
holger krekel
63688a2f95 remove getAllUpdates() and add a typical replicatio API for the update call (#3081)
* (r10s, adb, hpk) remove getAllUpdates() and add a typical replica-API that works with increasing serials.  Streamline docs a bit.

* adapt ffi to new api

* documentation: updates serials may have gaps

* get_webxdc_status_updates() return updates larger than a given serial

* remove status_update_id from status-update-event; it is not needed (ui should update from the last known serial) and easily gets confused with last_serial

* unify wording to 'StatusUpdateSerial'

* remove legacy payload format, all known webxdc should be adapted

* add serial and max_serial to status updates

* avoid races when getting max_serial by avoiding two SQL calls

* update changelog

Co-authored-by: B. Petersen <r10s@b44t.com>
2022-03-04 20:22:48 +01:00
missytake
379cb1b2e0 remove trailing slash, so it doesn't just copy the content of doc/ 2022-03-04 01:58:33 +01:00
missytake
78429492f1 fix: pass arguments to rsync github action 2022-03-04 01:45:05 +01:00
missytake
9875047674 docs github action: scp -> rsync 2022-03-04 01:31:00 +01:00
missytake
5014b0a9cb GitHub Action to build & upload the rust documentation 2022-03-03 18:11:55 +01:00
Floris Bruynooghe
ef841b1aa3 Securejoin: store bobstate in database instead of context
The state bob needs to maintain during a secure-join process when
exchanging messages used to be stored on the context.  This means if
the process was killed this state was lost and the securejoin process
would fail.  Moving this state into the database should help this.

This still only allows a single securejoin process at a time, this may
be relaxed in the future.  For now any previous securejoin process
that was running is killed if a new one is started (this was already
the case).

This can remove some of the complexity around BobState handling: since
the state is in the database we can already make state interactions
transactional and correct.  We no longer need the mutex around the
state handling.  This means the BobStateHandle construct that was
handling the interactions between always having a valid state and
handling the mutex is no longer needed, resulting in some nice
simplifications.

Part of #2777.
2022-03-01 23:02:40 +01:00
link2xt
368f27ffbc Update rusqlite to stable version 2022-02-27 20:00:35 +00:00
link2xt
0e50bc1443 Fix 1.59 clippy warnings 2022-02-27 13:29:02 +00:00
Hocuri
7c4a6ddcdf Add AcManager (#3073)
* Add AcManager

See https://github.com/deltachat/deltachat-core-rust/pull/2901#issuecomment-998285039

This reduces boilerplate code again therefore, improving the
signal-noise-ratio and reducing the mental barrier to start
writing a unit test.

Slightly off-topic:

I didn't add any advanced functions like `manager.get("alice");` because
they're not needed yet; however, once we have the AcManager we can
think about fancy things like:

```rust
acm.send_text(&alice, "Hi Bob, this is Alice!", &bob);
```
which automatically lets bob receive the message.

However, this may be less useful than it seems at first, since most of
the tests I looked at wouldn't benefit from it, so at least I won't do
it until I have a test that would benefit from it.

* Remove unnecessary RefCell

* Rename AcManager to TestContextManager

* Don't store TestContext's in a vec for now as we don't need this; we can re-add it later

* Rename acm -> tcm
2022-02-23 19:34:47 +01:00
link2xt
7ab6d95b6c mimefactory: place common IMF headers at the top of the message
This moves most common headers like From, To, Subject etc. defined in
the Internet Message Format standard at the top of the message
in the same order as used in RFC 5322.
2022-02-23 17:51:15 +00:00
link2xt
6c32b89906 smtp: add more logging 2022-02-23 17:04:30 +00:00
dependabot[bot]
056e659a20 cargo: bump strum_macros from 0.23.1 to 0.24.0
Bumps [strum_macros](https://github.com/Peternator7/strum) from 0.23.1 to 0.24.0.
- [Release notes](https://github.com/Peternator7/strum/releases)
- [Changelog](https://github.com/Peternator7/strum/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Peternator7/strum/commits)

---
updated-dependencies:
- dependency-name: strum_macros
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-22 21:14:05 +00:00
dependabot[bot]
62baff665c cargo: bump libc from 0.2.117 to 0.2.119
Bumps [libc](https://github.com/rust-lang/libc) from 0.2.117 to 0.2.119.
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Commits](https://github.com/rust-lang/libc/compare/0.2.117...0.2.119)

---
updated-dependencies:
- dependency-name: libc
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-21 21:14:06 +00:00
bjoern
7c5eb0ae37 prepare 1.76 (#3082)
* update changelog for 1.76.0

* bump version to 1.76.0
2022-02-20 22:58:46 -05:00
link2xt
36bce6c468 Remove unused async-std feature 2022-02-19 11:30:48 +00:00
dependabot[bot]
65df02163d cargo: bump sha2 from 0.10.1 to 0.10.2
Bumps [sha2](https://github.com/RustCrypto/hashes) from 0.10.1 to 0.10.2.
- [Release notes](https://github.com/RustCrypto/hashes/releases)
- [Commits](https://github.com/RustCrypto/hashes/compare/sha2-v0.10.1...sha2-v0.10.2)

---
updated-dependencies:
- dependency-name: sha2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-17 21:14:06 +00:00
Hocuri
19a32cdfd3 Let MS Exchange MDNs mark the In-Reply-To message as read (#3075)
Fix https://github.com/deltachat/deltachat-core-rust/issues/2891
2022-02-17 09:56:00 +01:00
link2xt
d708f386a1 smtp: set message state to failed when retry limit is exceeded 2022-02-13 08:59:52 +00:00
link2xt
0f837f4bed Fix a comment typo 2022-02-12 16:29:42 +00:00
link2xt
242e8e2bb3 smtp: remove the message in case of permanent failure
When `smtp_send` returns `Status::Finished`,
the message should be removed from the queue even in case of
failure, such as a permanent error.

In addition to this bugfix, move the retry count increase to
the beginning of `send_msg_to_smtp` to ensure no message is
retried infinitely even in case of similar bugs.
2022-02-12 16:20:13 +00:00
link2xt
1d56b24b67 cargo update 2022-02-12 16:19:44 +00:00
Hocuri
bb9138708a Fix disappearing drafts (#3067) 2022-02-10 10:05:30 +01:00
Hocuri
34f5510f1f Don't directly download messages from the Spam folder (#3015)
fix #3007

My approach is:

We don't download any messages from the spam folder anymore, and only download them if they were moved out. This means that is-it-spam logic only resides in spam_target_folder(). This has some implications, see the comments.
2022-02-10 09:06:22 +01:00
link2xt
6c6d47c89c Fix CI
timeout_func_only makes pytest-rerunfailures work with pytest-timeout,
but it only works with default timeout_method.

See pytest-rerunfailures issue for details:
https://github.com/pytest-dev/pytest-rerunfailures/issues/99
2022-02-08 20:50:11 +00:00
link2xt
196075c031 imap: batch message deletion 2022-02-06 11:42:30 +00:00
link2xt
2e5e8f73c6 imap: simplify get_quota_roots() 2022-02-06 15:17:05 +00:00
link2xt
ada5d38272 imap: remove unwrap() 2022-02-06 14:07:04 +00:00
link2xt
c4b0f773db python: remove arbitrary timeouts from tests
pytest-timeout already handles all deadlocks and is configurable with
--timeout option. With this change it is possible to disable timeout
with --timeout 0 to run tests on extremely slow connections.
2022-02-06 12:52:48 +00:00
link2xt
276daf631e imap: move messages in batches
Also change how NO response is treated. NO response means there is an
error moving/copying the messages. When there are no matching
messages, the response is "OK No matching messages, so nothing copied"
according to some RFC 9051 examples.
2022-02-05 22:15:46 +00:00
link2xt
fb19b58147 Reduce number of unsafe as conversions
Enable clippy::cast_lossless lint and get rid of
some conversions pointed out by  clippy::as_conversions.
2022-02-05 12:42:14 +00:00
dependabot[bot]
13a5e3cf6f Merge pull request #3055 from deltachat/dependabot/cargo/async-std-resolver-0.20.4 2022-02-04 21:39:59 +00:00
bjoern
1caf3caf1b do set_visibility() in a transaction (#3053)
this avoids archived chats containing fresh messages:

before, it could happen that between the two SQL calls
a new fresh message arrives,
unarchives the chat that is immediately archived by the second SQL call -
resulting in an archive chat containing fresh messages.

as fresh messages counter are shown on app icon etc.
this is pretty weird for the user as they do not see what is "fresh".

the other way round,
there is no transaction in receive_imf(),
however, receive_imf() only unarchives chats,
so that is visible and no big issue for the user.

the issue is rare at all,
however, annoying if you get that as the badge counter may be stuck at "1"
nearly forever (until you open the archived chat in question).
2022-02-03 20:40:24 +01:00
dependabot[bot]
564370f79a cargo: bump async-std-resolver from 0.20.3 to 0.20.4
Bumps [async-std-resolver](https://github.com/bluejekyll/trust-dns) from 0.20.3 to 0.20.4.
- [Release notes](https://github.com/bluejekyll/trust-dns/releases)
- [Changelog](https://github.com/bluejekyll/trust-dns/blob/main/CHANGELOG.md)
- [Commits](https://github.com/bluejekyll/trust-dns/compare/v0.20.3...v0.20.4)

---
updated-dependencies:
- dependency-name: async-std-resolver
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-02 21:14:26 +00:00
bjoern
24e749a2c9 prepare 1.75 (#3049)
* update changelog for 1.75.0

* bump version to 1.75.0
2022-02-01 14:00:40 +01:00
link2xt
cccdc51ad4 Optimize delete_expired_imap_messages()
For me this reduced query time from 0.3 s to 0.05 s.
2022-01-31 20:34:01 +00:00
bjoern
99ddce6c3e prepare 1.74 (#3046)
* update changelog for 1.74.0

* bump version to 1.74.0
2022-01-31 19:53:50 +01:00
link2xt
f68088cfb5 imap: avoid reconnection loop when message without Message-ID is marked as seen
- do not attempt to mark reserved meessages as seen when
  messages with empty Message-ID are marked as seen on IMAP
- do not reconnect on Seen flag synchronization failures This avoid
  reconnection loops in case of permanent errors in `sync_seen_flags`
2022-01-31 00:00:00 +00:00
Hocuri
c8f56d748a Only fetch mvbox deltachat.h additions (#3045)
* Use the formatting of the rest of the file

* Add changes require restarting IO by calling dc_stop_io() and then dc_start_io(). comment
2022-01-31 17:46:18 +01:00
bjoern
a43fc47bb6 update provider database (#3043)
* update provider database

ran `./src/provider/update.py ../provider-db/_providers/ > src/provider/data.rs`

* update changelog
2022-01-31 16:07:20 +01:00
bjoern
8c1bfac53b prepare 1.73 (#3042)
* update changelog for 1.73.0

* bump version to 1.73.0
2022-01-31 15:12:44 +01:00
Floris Bruynooghe
97853c3660 Flub/watch mvbox only (#3028)
* Make set_config() look a bit nicer

* Add OnlyFetchMvbox option

* Add test for the config

* Add option to only watch mvbox

This is supposed to support having a server-side rule which moves
emails to the mvbox already.  The new option makes sure the mvbox is
wathched and also makes sure no messages are feched from folders other
than the mvbox and the spam folder if enabled.  It does not interact
with the other settings.

* Fixup ignore conditions

* Cleanup some bits

* Watch the mvbox when `WatchMvboxOnly` is set

* Rename back to only_fetch_mvbox (flub said it's OK for him)

* typo

* clippy, more typos

Co-authored-by: Hocuri <hocuri@gmx.de>
2022-01-31 13:39:48 +01:00
link2xt
f304a30193 imap: fetch Inbox before scanning other folders 2022-01-31 12:03:21 +01:00
link2xt
7eadca3959 imap: do not synchronize Seen flags on unwatched folders
Synchronizing seen flags doubles the time required to scan all
folders. Delta Chat only marks messages as Seen on Inbox or DeltaChat,
so there is no need to check for Seen flag on other folders.
2022-01-30 20:00:00 +00:00
link2xt
8aa6decbf9 imap: call delete_expired_imap_messages() less often
This operation takes roughly 0.3 s on a moderate size database.
Calling it once before scanning all folders and scanning
the watched folder instead of each time after downloading
a message from a folder speeds up IMAP loop.
2022-01-30 20:49:32 +00:00
link2xt
7cf4bcaca2 imap: call delete_expired_imap_messages() less often
This operation takes roughly 0.3 s on a moderate size database.
Calling it once before scanning all folders and scanning
the watched folder instead of each time after downloading
a message from a folder speeds up IMAP loop.
2022-01-30 20:47:32 +00:00
dependabot[bot]
9ccd9c3e0e Merge pull request #3011 from deltachat/dependabot/cargo/serde-1.0.136 2022-01-30 20:13:39 +00:00
dependabot[bot]
c6773a6303 Merge pull request #3020 from deltachat/dependabot/cargo/backtrace-0.3.64 2022-01-30 20:13:20 +00:00
link2xt
e858a32aa1 smtp: cancel message sending by removing the message
This restores the logic removed in
afd8c0d879
2022-01-30 10:59:10 +00:00
B. Petersen
99f2680e2c fix splitting off text from webxdc messages
moreover, make the split check exhaustive
to avoid the same error on the next added Viewtype.
2022-01-30 11:49:09 +01:00
B. Petersen
7a9a323bac test sending webxdc+text 2022-01-30 11:49:09 +01:00
dependabot[bot]
62aa234352 cargo: bump backtrace from 0.3.63 to 0.3.64
Bumps [backtrace](https://github.com/rust-lang/backtrace-rs) from 0.3.63 to 0.3.64.
- [Release notes](https://github.com/rust-lang/backtrace-rs/releases)
- [Commits](https://github.com/rust-lang/backtrace-rs/compare/0.3.63...0.3.64)

---
updated-dependencies:
- dependency-name: backtrace
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-30 09:54:28 +00:00
link2xt
0cb9e7922a Remove direct dependency on byteorder crate 2022-01-29 23:24:25 +00:00
link2xt
e73107006e smtp: replace thiserror with anyhow 2022-01-29 16:41:47 +00:00
link2xt
ca389cc6fc Move webxdc change to Unreleased 2022-01-29 16:41:04 +00:00
link2xt
60ec7f0cbf Move last changelog entry to Unreleased 2022-01-29 16:39:28 +00:00
B. Petersen
d342d59e65 use webxdc app name in chatlist/quotes/replies/etc
this uses `get_webxdc_info().name` for chatlist etc.
the previuosly used static strings comes from a time
where we just did not had the correct name.

i was also thinking about adding `get_webxdc_info().summary`,
however, as this information is dynamic,
that may open several issues, eg. quoted text may change
so that the answer is out of context.
2022-01-29 16:48:24 +01:00
link2xt
2690fa2da5 Don't watch Sent folder by default 2022-01-29 11:35:02 +00:00
B. Petersen
e411c394ca add a link to search for #webxdc on github to the webxdc-docs 2022-01-29 00:42:56 +01:00
B. Petersen
d69f3ba225 adapt draft to new api 2022-01-28 21:10:34 +01:00
B. Petersen
739807b1a9 add links to webxdc development tool, simulator and to advanced examples 2022-01-28 17:42:32 +01:00
dependabot[bot]
d029ea7f3f cargo: bump mailparse from 0.13.7 to 0.13.8
Bumps [mailparse](https://github.com/staktrace/mailparse) from 0.13.7 to 0.13.8.
- [Release notes](https://github.com/staktrace/mailparse/releases)
- [Commits](https://github.com/staktrace/mailparse/compare/v0.13.7...v0.13.8)

---
updated-dependencies:
- dependency-name: mailparse
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-27 21:27:05 +01:00
dependabot[bot]
11098cb869 cargo: bump libc from 0.2.113 to 0.2.114
Bumps [libc](https://github.com/rust-lang/libc) from 0.2.113 to 0.2.114.
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Commits](https://github.com/rust-lang/libc/compare/0.2.113...0.2.114)

---
updated-dependencies:
- dependency-name: libc
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-27 21:26:23 +01:00
Hocuri
f6807d6b22 Fix set_config_bool() (#3013) 2022-01-27 12:12:16 +01:00
dependabot[bot]
7fc9bacf54 cargo: bump serde from 1.0.135 to 1.0.136
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.135 to 1.0.136.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.135...v1.0.136)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-26 21:14:08 +00:00
B. Petersen
57ea4c1d92 bump version to 1.72.0 2022-01-25 18:18:18 +01:00
B. Petersen
bcdd15ef3a update changelog for 1.72.0 2022-01-25 18:18:18 +01:00
Hocuri
5f939c3123 Fix: Run migrations after importing backup again (#3006)
As of #2980, the migrations were not run after importing a backup. This lead to errors like "Failed to send message: no such table: smtp" if you imported a backup from a previous DC version.
2022-01-24 18:36:28 +03:00
B. Petersen
2446fc44ad fix typo in mergeable description 2022-01-24 13:19:20 +01:00
dependabot[bot]
9ba8dd91df Merge pull request #2990 from deltachat/dependabot/cargo/stop-token-0.7.0 2022-01-23 21:23:56 +00:00
B. Petersen
10e1cdbc52 bump version to 1.71.0 2022-01-23 20:58:49 +01:00
B. Petersen
46eceb38d5 update changelog for 1.71.0
as we had the changelog-chat only in the last days,
- add missing pr
- update some wrong references
- unify some layout and wordings,
  streamline headlines to "API Changes", "Changes" and "Fixes",
  finer subdivisions only raise noise, duplicates and discussions
  and, if not used consequently, do not add much benefit.
2022-01-23 20:58:49 +01:00
link2xt
81de882e2f Add Protected Headers standard to standards.md 2022-01-23 19:47:10 +00:00
link2xt
593e07cdff cargo update 2022-01-23 19:31:34 +00:00
B. Petersen
8ca54f616e raise webxdc sending limit to 640 kb
as discussed in dev chat,
100 kb is too low if one wants to use any game framework.
also, many game that doesn't have poor graphics
or uses magic CSS-tricks to do fancy draws,
will have more than 100 kb probably just in tiles and sprites.

even for regions with low resources,
100 kb is low for a game -
esp. if we compare that with stickers that are send around as well
are not deduplicated and also have several 100 kb in size -
for much less effect.

we should still encourage ppl to create tiny apps,
however, a too low limit also restricts possibilities wrt adaption.
2022-01-23 12:48:25 +01:00
link2xt
f7f899f0a4 smtp: retry immediately if connection is stale 2022-01-22 21:17:01 +00:00
B. Petersen
05a3c0c89b webxdc: synchronous state for read-only-chats
already before,
we did _not_ sent updates to contact requests or other read-only-chats.
however, we _did_ modify the local database,
so that getAllUpdates() returns an update that was not sent out to other peers.

this is fixed by checking can_send() soon.

that way, all peers have the same state
also for contact requests or other read-only-chats
and webxdc in contact requests can be opened as usual.

further ui improvements may be needed for contact requests
(maybe allow the webxdc to know about that state or
maybe show a warning in the ui somewhere),
however, this is not part of this pr.
2022-01-22 21:28:47 +01:00
link2xt
f21691c122 Add "database_encrypted" field to Context.get_info() 2022-01-22 14:43:37 +00:00
B. Petersen
836e26d8d0 refine mergeable summary 2022-01-22 15:27:25 +01:00
B. Petersen
8a7c1fe4cb mergeable: adding #skip-changelog to pr description skips the corresponding test 2022-01-22 14:35:12 +01:00
bjoern
7f43d3bb37 let sending invalid webxdc fail (#2993)
* let sending invalid webxdc fail

invalid webxdc can still be send as Viewtype::File, however
(maybe one want to discuss errors or so ;)

* clarify the supported zip compression methods
2022-01-22 11:19:21 +01:00
bjoern
11b975ab19 use new webxdc logo (#2994)
* use webxdc logo

* optimize png
2022-01-22 11:01:05 +01:00
bjoern
315e4215d9 make update messages work if a key is missing (#2998)
* add a test for unencrypted replies to encrypted webxdc instances

* make update messages work if a key is missing

even in opportunistic chats,
replies to encrypted messages are forced to be encrypted,
if that is not possbile, message sending fails.

while this is okay to not leak previously send text messages,
the quotes as used by webxdc are more artificial,
currently only the static text "Webxdc".

* changelog ...
2022-01-22 10:56:15 +01:00
dependabot[bot]
e35e6c44cf cargo: bump stop-token from 0.6.1 to 0.7.0
Bumps [stop-token](https://github.com/async-rs/stop-token) from 0.6.1 to 0.7.0.
- [Release notes](https://github.com/async-rs/stop-token/releases)
- [Commits](https://github.com/async-rs/stop-token/commits)

---
updated-dependencies:
- dependency-name: stop-token
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-20 21:11:49 +00:00
Floris Bruynooghe
260cb78e3a Re-write the blob filename creation loop
This was written in a way which attempted to avoid easily creating an
infinite loop.  But really that's a python idiom and doesn't work very
well in Rust.  Worse, as shown by #2972 it is really easy to still get
this wrong.  Instead do this the rust way, this way the compiler can
also reason properly about the branches and what is unreachable
removing some bogus dead code.
2022-01-20 21:55:32 +01:00
link2xt
a1f04d2129 imex: use param2 for passphrase 2022-01-16 13:22:08 +00:00
bjoern
9b562eebcd handle parent for webxdc info-messages (#2984)
* set parent for webxdc info-messages

* test parent() for info-messages

* add dc_msg_get_parent() ffi
2022-01-19 11:46:32 +01:00
Simon Laux
1d175c4557 update changelog for 1.71 (#2968)
* update changelog for 1.71

* Apply suggestions from code review

Co-authored-by: bjoern <r10s@b44t.com>

Co-authored-by: bjoern <r10s@b44t.com>
2022-01-17 18:39:24 +01:00
Simon Laux
f755070080 apply wording suggestion from @r10s 2022-01-17 18:37:53 +01:00
Simon Laux
1c6c72a0fe try fixing the mergeable configuration 2022-01-17 18:37:53 +01:00
Simon Laux
1755f2ea3d update readme in deltachat-ffi to try out the changelog check 2022-01-17 18:37:53 +01:00
Simon Laux
498cc6c80b add mergable changelog test 2022-01-17 18:37:53 +01:00
bjoern
8d3227a92b fix webxdc forwarding and drafts (#2979)
* fix forwarding webxdc instances, add a test for that

* adapt webxdc test to fail on info-messages added when in draft mode

* do not add info-messages when in draft-mode

* half the number of instance-loads per webxdc update send/receive
2022-01-17 14:23:35 +01:00
Hocuri
c6d855084e Save "configured" flag later (#2974)
While experimenting with encrypted storage, once configuring failed between 920 and 940. But as the "configured" config had already been written after progress 910, some part of the code thought we are configured, some didn't.
2022-01-16 20:37:28 +01:00
Hocuri
827b3f8aeb Create parent directory if creating a new file fails (#2978)
With this PR, my encrypted-storage Android PR now works, at least I
couldn't find any further bugs.

Without it, configuring fails with: `Failed to create blob
icon-saved-messages-1803424689.png in
/data/user/0/com.b44t.messenger.beta/files/accounts/0e402b37dcd14a9586aea46294c908f2/dc.db-blobs:
No such file or directory (os error 2)`.

Also see https://github.com/deltachat/deltachat-core-rust/pull/2972.
2022-01-16 20:37:02 +01:00
link2xt
fb95573000 cargo update 2022-01-16 09:56:20 +00:00
dependabot[bot]
f026bd455f Merge pull request #2966 from deltachat/dependabot/cargo/tagger-4.2.1 2022-01-16 09:46:41 +00:00
dependabot[bot]
f0b92a5757 Merge pull request #2976 from deltachat/dependabot/cargo/smallvec-1.8.0 2022-01-16 09:45:28 +00:00
dependabot[bot]
d7c6f1e63b cargo: bump smallvec from 1.7.0 to 1.8.0
Bumps [smallvec](https://github.com/servo/rust-smallvec) from 1.7.0 to 1.8.0.
- [Release notes](https://github.com/servo/rust-smallvec/releases)
- [Commits](https://github.com/servo/rust-smallvec/compare/v1.7.0...v1.8.0)

---
updated-dependencies:
- dependency-name: smallvec
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-14 21:19:37 +00:00
Hocuri
1e9e308df3 Fix clippy errors (#2973) 2022-01-14 17:34:19 +01:00
missytake
c9a70f149d Merge pull request #2967 from deltachat/timeout_config_wait_finish
allow timeout for internal configure tracker API
2022-01-13 15:12:37 +01:00
holger krekel
d4ff47b6ac allow timeout for internal configure tracker API 2022-01-13 14:57:43 +01:00
dependabot[bot]
8b4b241403 cargo: bump tagger from 4.0.1 to 4.2.1
Bumps [tagger](https://github.com/tiby312/tagger) from 4.0.1 to 4.2.1.
- [Release notes](https://github.com/tiby312/tagger/releases)
- [Commits](https://github.com/tiby312/tagger/commits)

---
updated-dependencies:
- dependency-name: tagger
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-13 10:13:45 +00:00
B. Petersen
6dcd6947d7 update changelog 2022-01-13 11:11:50 +01:00
B. Petersen
327328412a let render_webxdc_status_update_object() return an Option; add a test for that 2022-01-13 11:11:50 +01:00
B. Petersen
42f9ef00b9 wrap update-item-array into an update-object on the wire; this allows to add other members in the future. the updates the peers see is not changed 2022-01-13 11:11:50 +01:00
B. Petersen
8c2ea0fa26 swap paramters in sendUpdate(); the 'descr' may be split up in the future, so it makes sense to have that at the end 2022-01-13 11:11:50 +01:00
B. Petersen
14e9afaf42 rename 'User Guide' to 'Developer Reference' 2022-01-13 11:11:50 +01:00
B. Petersen
a3a101641a use well-known icon-filenames instead of manifest 2022-01-13 11:11:50 +01:00
B. Petersen
8bd93fe495 fix typo in deltachat.h doc 2022-01-13 11:11:50 +01:00
bjoern
56df22bca7 Update deltachat-ffi/deltachat.h
Co-authored-by: Asiel Díaz Benítez <adbenitez@nauta.cu>
2022-01-13 11:11:50 +01:00
B. Petersen
5f32a6738a avoid double ZIP-parsing in get_webxdc_info() and do not read blob for just checking existance of a file 2022-01-13 11:11:50 +01:00
B. Petersen
1c081935fb tweak documentation, remove general explanation from api-reference, this is already done in the overview 2022-01-13 11:11:50 +01:00
B. Petersen
8fd4d00776 adapt to new set_quote() api 2022-01-13 11:11:50 +01:00
B. Petersen
7d04ea58c3 tweak ffi-doc a little 2022-01-13 11:11:50 +01:00
B. Petersen
2cc84a0f0d document manifest.toml 2022-01-13 11:11:50 +01:00
B. Petersen
8f715532cb read manifest.toml and add get_webxdc_info() 2022-01-13 11:11:50 +01:00
B. Petersen
5a77df7cc5 document window.webxdc.selfName() 2022-01-13 11:11:50 +01:00
bjoern
59658f2b0b Update draft/webxdc-user-guide.md
Co-authored-by: Asiel Díaz Benítez <adbenitez@nauta.cu>
2022-01-13 11:11:50 +01:00
holger krekel
0b983906da refinements 2022-01-13 11:11:50 +01:00
holger krekel
cd1f164d18 update the webxdc language, fix some typos 2022-01-13 11:11:50 +01:00
B. Petersen
e2a6ac6625 send status updates to self also for drafts 2022-01-13 11:11:50 +01:00
B. Petersen
8e8c10c438 rename w30 to webxdc 2022-01-13 11:11:50 +01:00
holger krekel
7ff25f282e another update 2022-01-13 11:11:50 +01:00
holger krekel
b8dc608032 some updates/refinements 2022-01-13 11:11:50 +01:00
holger krekel
d7e699320b shift to webxdc naming (#2933) 2022-01-13 11:11:50 +01:00
B. Petersen
ef333da770 draft a w30 user guide 2022-01-13 11:11:50 +01:00
B. Petersen
575a389b08 adapt to new test apis 2022-01-13 11:11:50 +01:00
B. Petersen
9bc0824be6 allow accessing zip-archives with absolute paths 2022-01-13 11:11:50 +01:00
B. Petersen
b656a60234 check that the w30 app is actually an zip-archive with an index.html 2022-01-13 11:11:50 +01:00
B. Petersen
bd988d805c better distinguish between update-items and payloads: update-items contain a payload (and maybe more in the future) 2022-01-13 11:11:50 +01:00
B. Petersen
7ad7ccb8fe send status-update-event also for self-sent updates 2022-01-13 11:11:50 +01:00
B. Petersen
e30c535f18 wrap payload to a json-structure that can be extended as needed 2022-01-13 11:11:50 +01:00
B. Petersen
de7706f622 wrap payloads to json-object on the wire 2022-01-13 11:11:50 +01:00
B. Petersen
de20e4c9dd basic w30 sending and receiving 2022-01-13 11:11:50 +01:00
holger krekel
41f9314e2a provide a higher level view of web30 based on the conversations i started about it around November 14th 2021 2022-01-13 11:11:50 +01:00
B. Petersen
2280ce349a add Message.parent() (Message.quoted_messages requires a text) 2022-01-13 11:11:50 +01:00
B. Petersen
7aa05e1c9f create table to track w30 status updates 2022-01-13 11:11:50 +01:00
B. Petersen
69d174c9e8 draft ffi for w30 2022-01-13 11:11:50 +01:00
link2xt
3c38fa6b70 Add API for passphrase-protected accounts
To create encrypted account with account manager, call
dc_accounts_add_closed_account(). Open this account with
dc_context_open() using the passphrase you want to use for encryption.

When application is loaded next time and account manager is created,
it will open all accounts that have no passphrase set. For encrypted
accounts dc_context_is_open() will return 0. To open them, call
dc_context_open() with the correct passphrase. After opening, call
dc_context_start_io() on this account or just dc_accounts_start_io()
to start all accounts that are not started yet.

Support for legacy SQLite-based backup format is removed in this
commit.
2022-01-06 08:54:58 +00:00
B. Petersen
728c8b4663 pull in update for mail.de in provider-db 2022-01-11 15:00:26 +01:00
B. Petersen
fab9563cd5 update provider database
ran `./src/provider/update.py ../provider-db/_providers/ > src/provider/data.rs`
2022-01-11 15:00:26 +01:00
dependabot[bot]
20fe2473e1 Merge pull request #2961 from deltachat/dependabot/cargo/tagger-4.0.1 2022-01-11 04:25:38 +00:00
dependabot[bot]
3815062c11 cargo: bump tagger from 3.3.0 to 4.0.1
Bumps [tagger](https://github.com/tiby312/tagger) from 3.3.0 to 4.0.1.
- [Release notes](https://github.com/tiby312/tagger/releases)
- [Commits](https://github.com/tiby312/tagger/commits)

---
updated-dependencies:
- dependency-name: tagger
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-11 04:01:52 +00:00
B. Petersen
581ea9fda0 remove outdated DC_STR_STATUSLINE link 2022-01-10 21:32:51 +01:00
link2xt
bfa641cea8 Error handling refactoring
- Replace .ok_or_else() and .map_err() with anyhow::Context where possible.
- Use .context() to check Option for None when it's an error
- Resultify Chatlist.get_chat_id()
- Add useful .context() to some errors
- IMAP error handling cleanup
2022-01-07 14:22:37 +00:00
link2xt
29c58efeb3 Remove default signature advertsing Delta Chat 2022-01-07 13:56:58 +00:00
link2xt
27eb82c556 context: hide ongoing process internals from public API
Also hide derive_blobdir and derive_walfile.
2022-01-07 06:25:03 +00:00
link2xt
652d67a20f Revert flaky "sql: enable auto_vacuum on all connections"
It results in "database is locked" errors on CI.

This reverts commit ce0984f02f.
2022-01-07 00:18:21 +03:00
link2xt
ce0984f02f sql: enable auto_vacuum on all connections 2022-01-06 09:03:50 +00:00
bjoern
b3e3b1e245 allow removing quotes on existing drafts (#2950)
allow `dc_msg_set_quote(msg, NULL)` and `msg.set_quote(None)`
to simplify draft handling keeping message-ids (as needed for webxdc updates).

closes #2948
2022-01-05 23:59:04 +01:00
dependabot[bot]
c69ee180af Merge pull request #2944 from deltachat/dependabot/cargo/rustyline-9.1.2 2022-01-05 14:46:28 +00:00
link2xt
bba3a25371 Add CONDSTORE to standards.md 2022-01-03 23:12:29 +00:00
link2xt
095b358aca Test multidevice synchronization of Seen status 2022-01-03 23:12:29 +00:00
link2xt
833e5f46cc Synchronize seen status across devices
Seen status is only synchronized on servers supporting IMAP CONDSTORE
extension. At the end of fetch loop iteration, flags are fetched for
all messages modified since previous synchronization and highest
modification sequence is stored into `imap_sync` table.
2022-01-03 23:12:29 +00:00
link2xt
3e0ce0e07a test_no_old_msg_is_fresh: compare DC_EVENT_MSGS_NOTICED argument to chat id
data1 of DC_EVENT_MSGS_NOTICED contains chat id, not message id
2022-01-03 23:12:29 +00:00
link2xt
1f31dd12fc Replace BTreeMap with BTreeSet in markseen_msgs 2022-01-03 23:12:29 +00:00
link2xt
f63efc29bf Resultify update_msg_state 2022-01-03 23:12:29 +00:00
link2xt
3e394f14e8 sql: disable cipher_memory_security SQLCipher PRAGMA
It slows down dc_get_chat_msgs() from ~50ms to seconds on Android. It
is disabled by default in SQLCipher 4.5.0, but currently SQLCipher 4.4.3
is bundled so this PRAGMA has to be disabled manually.
2022-01-03 23:03:59 +00:00
dependabot[bot]
ff6ffa1656 cargo: bump rustyline from 9.1.1 to 9.1.2
Bumps [rustyline](https://github.com/kkawakam/rustyline) from 9.1.1 to 9.1.2.
- [Release notes](https://github.com/kkawakam/rustyline/releases)
- [Changelog](https://github.com/kkawakam/rustyline/blob/master/History.md)
- [Commits](https://github.com/kkawakam/rustyline/compare/v9.1.1...v9.1.2)

---
updated-dependencies:
- dependency-name: rustyline
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-03 21:12:32 +00:00
link2xt
304c259a57 Update resync_folder_uids to use imap table 2022-01-02 17:04:16 +00:00
link2xt
630754b52e dc_receive_imf: don't fail on invalid address in the To field
This is an irrecoverable error, dc_receive_imf must not fail on it
as it prevents last seen UID from advancing, so the same message
is prefetched on each iteration of IMAP loop.
2022-01-02 00:20:44 +00:00
link2xt
afd8c0d879 Add smtp table
It replaces SendMsgToSmtp job.

Prepared outgoing SMTP payloads are stored in the database now rather
than files in blobdir.
2022-01-01 19:14:53 +00:00
B. Petersen
6316ee7c9b add editable "summary" to dc_msg_get_webxdc_info()
the summary can be modified by the apps using
`sendUpdate({summary: "foo", payload: ...})`

the summary is updated when there is no newer update
and chat will be informed by the change as usual by
`DC_EVENT_MSGS_CHANGED`.
2022-01-16 00:30:53 +01:00
B. Petersen
b6b8d11881 add option to trigger an info-message from an webxdc-update 2022-01-16 00:30:53 +01:00
Hocuri
8753fd5887 Actually return a sensible error from create_new_file() 2022-01-15 18:33:17 +01:00
bjoern
5aaafb5ac1 limit webxdc-sizes for a better ux (#2971)
* limit webxdc-sizes for a better ux

* Update src/webxdc.rs

Co-authored-by: Asiel Díaz Benítez <adbenitez@nauta.cu>

* Update src/webxdc.rs

Co-authored-by: Asiel Díaz Benítez <adbenitez@nauta.cu>

Co-authored-by: Asiel Díaz Benítez <adbenitez@nauta.cu>
2022-01-15 00:12:00 +01:00
B. Petersen
a043557c44 move payload to {payload:PAYLOAD} to allow additional parameters
additional parameters will be `summary` and `msg` (for an info-message)
right now, and maybe more in the future (`aggregated`, `fast`, `to` ...),
so adding just more parameters easily gets wild.

also, this makes adaptions easier as no ffi needs to be adapted
when we add more parameters.

finally, sending is in-sync with receiving, database and wire now,
one receives similar objects as one sends,
which also looks like the right thing :)

for now, `sendUpdate()` also allows to use the old, unwrapped payload
to not immediately break existing `.xdc`, however, that will be removed soon,
probably before the first release.
2022-01-15 00:10:59 +01:00
B. Petersen
4af4914e32 simplify WebxdcStatusUpdate handling 2022-01-15 00:10:59 +01:00
dependabot[bot]
e35b3f1e80 cargo: bump quote from 1.0.10 to 1.0.14
Bumps [quote](https://github.com/dtolnay/quote) from 1.0.10 to 1.0.14.
- [Release notes](https://github.com/dtolnay/quote/releases)
- [Commits](https://github.com/dtolnay/quote/compare/1.0.10...1.0.14)

---
updated-dependencies:
- dependency-name: quote
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-01 12:28:40 +01:00
dependabot[bot]
ff8859b9db cargo: bump syn from 1.0.83 to 1.0.84
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.83 to 1.0.84.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/1.0.83...1.0.84)

---
updated-dependencies:
- dependency-name: syn
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-01 12:27:51 +01:00
Simon Laux
937ff5a378 add more links to the language bindings in readme (#2895)
Co-authored-by: bjoern <r10s@b44t.com>
2022-01-01 12:25:01 +01:00
link2xt
f3a716fac6 sql: enable auto_vacuum=INCREMENTAL
Previously default of `auto_vacuum=NONE` was used.

`PRAGMA auto_vacuum=INCERMENTAL` allows running `PRAGMA
incremental_vacuum`. Unlike `VACUUM`, `PRAGMA incremental_vacuum`
frees unused pages without rebuilding the whole database, like the
`VACUUM` does, so it does not require additional disk space to build a
vacuumed copy of the database. This may even free enough space on the
disk to run `VACUUM` afterwards.

New setting will only be enabled for new databases or if the `VACUUM`
command runs successfully. Currently `VACUUM` is only executed on
backup export, but may fail nevertheless if there is not enough space
on the disk.

Also try to run `PRAGMA incremental_vacuum` during housekeeping. It
may not be the best strategy, but likely does not make any difference
under normal usage when the database only grows and there are no free
pages. Free pages are created only if enough data is deleted to free
at least one database page of 4096 bytes, for example when automatic
deletion of messages is deleted for the first time. In the future if
more data is placed into the database, like avatars and other blobs,
it may be necessary to revise this strategy, for example to keep some
free pages instead of removing all of them each time by querying
`PRAGMA freelist_pages` and running `PRAGMA incremental_vacuum(N)`.
2021-12-31 21:33:38 +00:00
link2xt
72659580de sql: build rusqlite with sqlcipher 2022-01-01 00:00:00 +00:00
link2xt
30cb0cbcfd Reduce number of AsRef generics
They result in compilation of duplicate code.
2021-12-31 13:57:45 +00:00
Hocuri
4136217249 Start making it possible to write to mailing lists (#2736)
See #748, #1964 and 3ba4c6718e/draft/mailing_list_managers.md

Also fix #2735: Assign outgoing messages from other devices to the mailing list
2021-12-31 14:01:30 +01:00
link2xt
246cae5d9e Remove inbox_watch option
Also resultified `get_watched_folders`.

Python test `test_moved_markseen` is modified to test using incoming
message instead of BCC-self message, because BCC-self message is
detected immediately in the Inbox.
2021-12-25 18:07:14 +00:00
link2xt
12313543ca Fix leaving the group 2021-12-30 12:51:10 +00:00
link2xt
87e3dead14 Remove unused InterruptInfo.msg_id 2021-12-30 02:15:30 +00:00
Hocuri
9af36460c2 Improve the log (#2928)
We had an unhelpful log in the Testing group:

- it repeatedly says "src/imap.rs:1010: dc_receive_imf error: add_parts error" but the actual error is not shown
- it says "deltachat-ffi/src/lib.rs:186: dc_get_config(): invalid key" but it doesn't say what key it's trying to set
2021-12-29 12:41:58 +01:00
Floris Bruynooghe
2e2d881e01 Use the LogSink explicitly in securejoin tests 2021-12-28 23:29:37 +01:00
Floris Bruynooghe
db58946312 Switch securejoint tests to EventTracker
Saves a bit of repitions.
2021-12-28 23:29:37 +01:00
Floris Bruynooghe
9a02a58273 Move over EvTracker to a normal event sender
I considered removing it from the context by default, but the
migration test really wants to have the tracker initialised from the
very first event and not after the context is initialised.  It is
easier for now to leave it hardcoded instead of adding an API to
explicitly require enabling it via the builder.
2021-12-28 23:29:37 +01:00
Floris Bruynooghe
147f5c1e0d Remove EventSink from TestContext to simplify it
This replaces the EventSink callbacks with simple channel senders.
This simplifies the TestContext a lot as that is much simpler to
handle.  It then also removes the special-casing of the LogSink since
it now is another even sender, only injected at the very start.
2021-12-28 23:29:37 +01:00
Floris Bruynooghe
f0ca50ba27 Introduce TestContextBuilder
There are too many ways to create a TestContext, this introduces a
TestContextBuilder to try and keep this shorter.  It also cleans up
the existing constructors keeping only the commonly used ones.
2021-12-28 23:29:37 +01:00
Floris Bruynooghe
83137b5968 Add a LogSink to redirect test output correctly
Without this the test output is written somewhere random and ends up
in the wrong test report. This buffers all the log output and prints
it inside the test on dropping the LogSink, or on dropping the
TestContext if no explicit LogSink was created.
2021-12-28 23:29:37 +01:00
link2xt
12823c2213 Add imap table to keep track of message UIDs
`imap` table maps Message-IDs to UIDs on the server. `dc_receive_imf`
no longer gets the UID of the message as an argument and does not
insert the folder and UID of the message into the `msgs`
table. `server_folder` and `server_uid` columns in `msgs` table are
deprecated.

MoveMsg and DeleteMsgOnImap jobs are removed. Now messages are moved
and deleted only in the `fetch_move_delete` procedure that consults
the `target` column of the `imap` table to determine where the message
should go.

Where the message should go is determined after prefetching by the
`imap::target_folder()` procedure.  Messages are only downloaded once
they reach their target folder to avoid race conditions in multidevice
setting, such as:

1. One device trying to FETCH the message while the other tries to
MOVE it.

2. One device marking the message as \Seen in the Inbox while the
other has already copied unseen message to the Movebox and is going to
delete the \Seen message in the Inbox.

3. Device downloads the message from the Inbox while there are newer
messages in the Movebox placed there by the other device, thus
processing the messages out of order.
2021-12-19 00:00:00 +00:00
Floris Bruynooghe
0b810d7d65 Run CI with -Dwarnings
This runs all CI jobs with -Dwarnings, turning warnings into errors
for CI.

This is useful since we run rustfmt and clippy on CI on stable rust,
while the builds and tests run with a specific older rustc.  The
latter is also used for local development usually since it is encoded
in the rust-toolchain file.  This warnings in clippy jobs of stable
rust would often go unnoticed, however stable rust usually finds more
genuine issues than the older compiler we use.
2021-12-28 13:51:21 +01:00
Floris Bruynooghe
7aebdc9b7b Fix flaky test
Time is weird, and really this assert doesn't add that much to the
party.

Fixes #2904
2021-12-28 13:36:20 +01:00
Floris Bruynooghe
6859b651a8 Add some more caching to CI
Use cacing in a few more places, replace the manual caching by the
action to simplify.
2021-12-28 13:35:17 +01:00
Hocuri
d47680733b Fix: Also show the hop_info for encrypted messages (#2923)
Before, the hop_info was shown only for unencrypted messages.

Credits: The bug was noticed by link2xt

Follow-up for #2751
2021-12-28 13:23:41 +01:00
bjoern
273a38d781 migrate log for hop_info added (#2914)
that bit was missing in #2751
2021-12-25 13:38:21 +01:00
dependabot[bot]
93d1162caf cargo: bump futures from 0.3.18 to 0.3.19
Bumps [futures](https://github.com/rust-lang/futures-rs) from 0.3.18 to 0.3.19.
- [Release notes](https://github.com/rust-lang/futures-rs/releases)
- [Changelog](https://github.com/rust-lang/futures-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/futures-rs/compare/0.3.18...0.3.19)

---
updated-dependencies:
- dependency-name: futures
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-12-24 16:58:56 +01:00
dependabot[bot]
8d550a66a3 cargo: bump num_cpus from 1.13.0 to 1.13.1
Bumps [num_cpus](https://github.com/seanmonstar/num_cpus) from 1.13.0 to 1.13.1.
- [Release notes](https://github.com/seanmonstar/num_cpus/releases)
- [Changelog](https://github.com/seanmonstar/num_cpus/blob/master/CHANGELOG.md)
- [Commits](https://github.com/seanmonstar/num_cpus/compare/v1.13.0...v1.13.1)

---
updated-dependencies:
- dependency-name: num_cpus
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-12-24 16:58:01 +01:00
dependabot[bot]
4c58e05be3 cargo: bump anyhow from 1.0.51 to 1.0.52
Bumps [anyhow](https://github.com/dtolnay/anyhow) from 1.0.51 to 1.0.52.
- [Release notes](https://github.com/dtolnay/anyhow/releases)
- [Commits](https://github.com/dtolnay/anyhow/compare/1.0.51...1.0.52)

---
updated-dependencies:
- dependency-name: anyhow
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-12-24 16:57:26 +01:00
dependabot[bot]
500563054e cargo: bump syn from 1.0.82 to 1.0.83
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.82 to 1.0.83.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/1.0.82...1.0.83)

---
updated-dependencies:
- dependency-name: syn
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-12-24 16:56:49 +01:00
Sebastian Klähn
2a11f8f59d add hop_info (#2751) 2021-12-22 16:08:12 +01:00
link2xt
9e7bdc579e Test recovery from lost member removal message
This was fixed in d98d1857a4 but not
tested.

Revert d98d1857a4 to check that the test
is working.
2021-12-19 15:05:48 +00:00
link2xt
61af0c9ac4 python: remove API deprecated in Python 3.10 2021-12-18 17:47:08 +00:00
link2xt
91f02ad553 Rename asymetric test into asymmetric 2021-12-18 17:46:29 +00:00
dependabot[bot]
b20d3dfc10 Merge pull request #2902 from deltachat/dependabot/cargo/serde-1.0.132 2021-12-18 14:32:55 +00:00
dependabot[bot]
3e7666021c cargo: bump serde from 1.0.131 to 1.0.132
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.131 to 1.0.132.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.131...v1.0.132)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-12-18 14:05:06 +00:00
dependabot[bot]
ae58bceeb9 Merge pull request #2894 from deltachat/dependabot/cargo/libc-0.2.112 2021-12-18 14:02:16 +00:00
dependabot[bot]
6665b9e13c Merge pull request #2898 from deltachat/dependabot/cargo/serde_json-1.0.73 2021-12-18 14:01:55 +00:00
dependabot[bot]
367a9705e9 Merge pull request #2899 from deltachat/dependabot/cargo/once_cell-1.9.0 2021-12-18 14:01:30 +00:00
link2xt
8d3a1e84c3 Remove mvbox_watch option and use mvbox_move instead 2021-12-18 13:55:01 +00:00
link2xt
d009835210 Remove unnecessary getattr 2021-12-18 12:48:40 +00:00
link2xt
83a664ca68 Fix mypy error 2021-12-18 12:47:11 +00:00
link2xt
d98d1857a4 Improve group updates
- Check that member modifying the group is in the group themselves.

  It is not allowed to readd yourself to the group or remove someone without being in the group themselves.

- Unify code for group member addition and removal.

  Removing a member now recreates the group member list from the To: field.

  Removed member from the Chat-Group-Member-Removed was in the To: field in previous Delta Chat versions,
  so it is excluded explicity. New versions of Delta Chat put removed member in Bcc: instead.

- Apply avatar changes after updating the group member list.

  This allows to check that the contact modifying the avatar is actually a group member.
2021-12-18 11:58:32 +00:00
dependabot[bot]
33a514aa54 cargo: bump once_cell from 1.8.0 to 1.9.0
Bumps [once_cell](https://github.com/matklad/once_cell) from 1.8.0 to 1.9.0.
- [Release notes](https://github.com/matklad/once_cell/releases)
- [Changelog](https://github.com/matklad/once_cell/blob/master/CHANGELOG.md)
- [Commits](https://github.com/matklad/once_cell/compare/v1.8.0...v1.9.0)

---
updated-dependencies:
- dependency-name: once_cell
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-12-14 21:13:06 +00:00
dependabot[bot]
0aefdc85e6 cargo: bump serde_json from 1.0.72 to 1.0.73
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.72 to 1.0.73.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.72...v1.0.73)

---
updated-dependencies:
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-12-14 21:12:55 +00:00
dependabot[bot]
3ff0964f02 cargo: bump libc from 0.2.109 to 0.2.112
Bumps [libc](https://github.com/rust-lang/libc) from 0.2.109 to 0.2.112.
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Commits](https://github.com/rust-lang/libc/compare/0.2.109...0.2.112)

---
updated-dependencies:
- dependency-name: libc
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-12-13 21:11:17 +00:00
bjoern
cf33db3dcb do not change the draft's message-id on updates and sending (#2887)
* store msg-id in msg-object on set_draft(), add a test for that

* test deleting drafts

* keep draft-ids on updating drafts, set draft-state

* do not allow forwarding of drafts

in general, it should be possbile,
however, it is not needed.

drafts and forwarding have lots of cornercases
even when not used in combination :)

* keep draft-ids on preparing and sending

* add comments about keeping msg_id

* early exit when trying to forward drafts

* tweak tests

* get rid of old C to Rust conversion code

* allow soon checking of increation-state, add a test for that
2021-12-12 18:02:12 +01:00
link2xt
dae80cbe35 Recognize MS Exchange read receipts as read receipts
They contain X-MSExch-Correlation-Key header, but no
Original-Message-ID, so they cannot be used to find the original
message, but we want to recognize them as MDN nevertheless to assign
them to the trash chat.
2021-12-11 21:44:54 +00:00
link2xt
f8b4ef26b3 Update rustyline
The version was locked to 9.0.0 previsouly because Rust 1.56 requirement.
New version 9.1.1 should support 1.56 again.
2021-12-11 18:10:18 +00:00
link2xt
db991453b0 Merge branch 'cargo-update' 2021-12-11 14:48:17 +00:00
link2xt
c11ce4c8d4 Merge detached signature parsing 2021-12-11 14:46:58 +00:00
link2xt
92e300cb9f cargo update 2021-12-11 12:06:53 +00:00
dependabot[bot]
d210e0bffe Merge pull request #2872 from deltachat/dependabot/cargo/tagger-3.3.0 2021-12-11 11:58:39 +00:00
link2xt
4d4968f358 Make the code compile with new tagger 2021-12-11 11:36:18 +00:00
dependabot[bot]
8dfede148a Merge pull request #2871 from deltachat/dependabot/cargo/async-imap-bb73dfc 2021-12-10 23:11:12 +00:00
link2xt
6d125028f5 Validate detached signatures 2021-12-10 22:56:42 +00:00
link2xt
7ff3cf4af0 Accept keyring by reference in pk_decrypt 2021-12-10 22:56:42 +00:00
link2xt
bb3353397d Use return values instead of out arguments for PGP signatures 2021-12-10 22:56:42 +00:00
link2xt
572260ec29 Test RFC 1847 encapsulation
https://datatracker.ietf.org/doc/html/rfc3156#section-6.1
2021-12-10 22:56:42 +00:00
dependabot[bot]
0b1faa0523 Merge pull request #2884 from deltachat/dependabot/cargo/async-trait-0.1.52 2021-12-10 22:52:51 +00:00
bjoern
3b6c3e10d7 update draft docs (#2886)
* we no longer set a draft on group creation

* remove probably outdated comment

the comment was added at
https://github.com/deltachat/deltachat-core/pull/457
where draft revamping was done half only
and was probably forgotten to being removed later.

at least, i cannot make any sense out of the comment.
2021-12-10 16:33:02 +01:00
dependabot[bot]
d3909a5483 cargo: bump async-trait from 0.1.51 to 0.1.52
Bumps [async-trait](https://github.com/dtolnay/async-trait) from 0.1.51 to 0.1.52.
- [Release notes](https://github.com/dtolnay/async-trait/releases)
- [Commits](https://github.com/dtolnay/async-trait/compare/0.1.51...0.1.52)

---
updated-dependencies:
- dependency-name: async-trait
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-12-10 06:45:56 +00:00
dependabot[bot]
645fd10446 Merge pull request #2874 from deltachat/dependabot/cargo/sha2-0.10.0 2021-12-10 06:44:26 +00:00
dependabot[bot]
ee7e29fb3a cargo: bump sha2 from 0.9.8 to 0.10.0
Bumps [sha2](https://github.com/RustCrypto/hashes) from 0.9.8 to 0.10.0.
- [Release notes](https://github.com/RustCrypto/hashes/releases)
- [Commits](https://github.com/RustCrypto/hashes/compare/sha2-v0.9.8...sha2-v0.10.0)

---
updated-dependencies:
- dependency-name: sha2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-12-09 22:17:54 +00:00
dependabot[bot]
bdc3a4d24c Merge pull request #2875 from deltachat/dependabot/cargo/sha-1-0.10.0 2021-12-09 22:08:51 +00:00
dependabot[bot]
88ccda139e Merge pull request #2882 from deltachat/dependabot/cargo/serde-1.0.131 2021-12-09 22:08:23 +00:00
dependabot[bot]
63e78bae37 Merge pull request #2883 from deltachat/dependabot/cargo/rusqlite-0.26.3 2021-12-09 22:07:54 +00:00
Hocuri
b50f211c28 Fix benchmark compile errors (#2881)
* Fix benchmark compile errors

* Also check bench code during CI
2021-12-09 22:52:53 +01:00
dependabot[bot]
5efbd9c7f5 cargo: bump rusqlite from 0.26.1 to 0.26.3
Bumps [rusqlite](https://github.com/rusqlite/rusqlite) from 0.26.1 to 0.26.3.
- [Release notes](https://github.com/rusqlite/rusqlite/releases)
- [Changelog](https://github.com/rusqlite/rusqlite/blob/master/Changelog.md)
- [Commits](https://github.com/rusqlite/rusqlite/compare/rusqlite-0.26.1...v0.26.3)

---
updated-dependencies:
- dependency-name: rusqlite
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-12-09 21:33:03 +00:00
dependabot[bot]
7f1d2ea11f cargo: bump serde from 1.0.130 to 1.0.131
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.130 to 1.0.131.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.130...v1.0.131)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-12-09 21:32:51 +00:00
Hocuri
46eb391a1b Fix: Make add_parts() not early-exit (#2879)
Fix #2867
2021-12-09 19:04:32 +01:00
Hocuri
b166cc5bf4 Remove wrong comment in add_parts 2021-12-09 18:58:05 +01:00
link2xt
1d0f6aad95 Add dc_msg_force_plaintext() API for bots (#2847)
This will allow implementing a special command for download bot to request that it sends back the downloaded file unencrypted.
2021-12-09 11:51:21 +01:00
dependabot[bot]
764aa71770 cargo: bump sha-1 from 0.9.8 to 0.10.0
Bumps [sha-1](https://github.com/RustCrypto/hashes) from 0.9.8 to 0.10.0.
- [Release notes](https://github.com/RustCrypto/hashes/releases)
- [Commits](https://github.com/RustCrypto/hashes/compare/sha-1-v0.9.8...md2-v0.10.0)

---
updated-dependencies:
- dependency-name: sha-1
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-12-08 00:15:03 +00:00
dependabot[bot]
21e9206a77 Merge pull request #2870 from deltachat/dependabot/cargo/mailparse-0.13.7 2021-12-07 06:54:46 +00:00
dependabot[bot]
5f29977c50 cargo: bump tagger from 3.2.1 to 3.3.0
Bumps [tagger](https://github.com/tiby312/tagger) from 3.2.1 to 3.3.0.
- [Release notes](https://github.com/tiby312/tagger/releases)
- [Commits](https://github.com/tiby312/tagger/commits)

---
updated-dependencies:
- dependency-name: tagger
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-12-06 21:15:13 +00:00
dependabot[bot]
ee4c9bc01e cargo: bump async-imap from c2e92df to bb73dfc
Bumps [async-imap](https://github.com/async-email/async-imap) from `c2e92df` to `bb73dfc`.
- [Release notes](https://github.com/async-email/async-imap/releases)
- [Commits](c2e92dfd33...bb73dfc203)

---
updated-dependencies:
- dependency-name: async-imap
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-12-06 21:15:07 +00:00
dependabot[bot]
4a8259cb12 cargo: bump mailparse from 0.13.6 to 0.13.7
Bumps [mailparse](https://github.com/staktrace/mailparse) from 0.13.6 to 0.13.7.
- [Release notes](https://github.com/staktrace/mailparse/releases)
- [Commits](https://github.com/staktrace/mailparse/compare/v0.13.6...v0.13.7)

---
updated-dependencies:
- dependency-name: mailparse
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-12-06 21:14:47 +00:00
Hocuri
a6441d70f0 Mark chat as noticed when receiving an outgoing message (#2861)
When there is an outgoing message in a chat, mark all older messages in this chat as seen.

Android already has a similar behavior, however, this led to the issue https://github.com/deltachat/deltachat-android/issues/2163 and should be changed back.

--

From the issue description at https://github.com/deltachat/deltachat-android/issues/2163, I implemented these fixes:
> Core should take care that if the last message in a chat is not fresh|noticed, no messages in the chat can be fresh. [...] Do this [...] in a function that's called at the end of fetch_new_messages(). Then dc_receive_imf() wouldn't get slower by this and we could re-use the same function for migration.

So, I didn't do this inside `dc_receive_imf()` in order not to make it take even longer. This obviously has the downside of higher complexity.

And I think we should implement this:
> On Androd, show the unread badge when unread!=0 again (see deltachat/deltachat-android@618af02). Then the user can see that there is a chat with an unread message and click it to get rid of it. 

because it shouldn't be the UI's job to decide whether an unread badge is shown, but the core's.
2021-12-06 10:55:50 +00:00
link2xt
01db8d0130 test_utils: fix Alice's address in alice_keypair()
The key stored in test-data has @example.org identity.
2021-12-05 09:14:58 +00:00
link2xt
8ad9db5572 mimefactory: refactor generation of the To: field
Group all the code responsible for the generation of the To: field
2021-12-04 22:04:47 +00:00
link2xt
607cd23014 Test that removed member is not included in the To: field 2021-12-04 22:04:47 +00:00
link2xt
220758d244 Place removed members into Bcc: instead of To:
This way if someone replies to the member deletion messsage from a
classic MUA, they will not reply to the removed member.
2021-12-04 18:51:25 +00:00
link2xt
7ab71bb468 Convert test keys from base64 to ASCII armor
ASCII armored keys can be easily generated with `sq key generate` and
used to encrypt and decrypt test messages with `sq` and `gpg` without
converting them to binary using `base64 -d` first.
2021-12-04 19:56:03 +03:00
link2xt
a74377b620 Fix Rust 1.57 compiler and clippy warnings (#2863)
* Remove unused os_name

* Disable clippy::manual_split_once lint

It's suggestions in stable 1.57 Rust are incorrect: https://github.com/rust-lang/rust-clippy/issues/7889

* Allow unused fields in OAuth2 response

* Fix clippy warning about `select_pk_for_encryption`
2021-12-04 18:56:14 +03:00
dependabot[bot]
c9effa3c06 Merge pull request #2828 from deltachat/dependabot/cargo/strum_macros-0.23.1 2021-12-02 10:10:15 +00:00
dependabot[bot]
8b8102334b cargo: bump syn from 1.0.81 to 1.0.82 (#2840)
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.81 to 1.0.82.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/1.0.81...1.0.82)

---
updated-dependencies:
- dependency-name: syn
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-12-02 11:09:36 +01:00
dependabot[bot]
5dedb86472 Merge pull request #2841 from deltachat/dependabot/cargo/serde_json-1.0.72 2021-12-02 10:05:07 +00:00
dependabot[bot]
d93f77f991 Merge pull request #2851 from deltachat/dependabot/cargo/anyhow-1.0.51 2021-12-02 10:04:10 +00:00
dependabot[bot]
5409bc575e cargo: bump anyhow from 1.0.48 to 1.0.51
Bumps [anyhow](https://github.com/dtolnay/anyhow) from 1.0.48 to 1.0.51.
- [Release notes](https://github.com/dtolnay/anyhow/releases)
- [Commits](https://github.com/dtolnay/anyhow/compare/1.0.48...1.0.51)

---
updated-dependencies:
- dependency-name: anyhow
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-12-01 20:35:25 +00:00
bjoern
576d31206d prepare 1.70 (#2858)
* update changelog for 1.70.0

* bump version to 1.70.0
2021-12-01 21:33:39 +01:00
bjoern
86e3297414 execute Chat-Group-Member-Removed even when arrived out of oder (#2857)
* execute Chat-Group-Member-Removed even when arrived out of oder

* test adding/removing members unordered
2021-12-01 21:06:56 +01:00
bjoern
ab4a947456 do not abort Param parsing on unknown keys (#2856)
unknown keys may come from upgrades (previously used key no longer defined)
or from downgrades (when an upgrade before uses a new key).

the latter was probalby responsible for some avatar loss,
mainly by testers, that usually switch versions forth and back much more often.
2021-12-01 12:04:10 +01:00
bjoern
5ce2581b4c prepare 1.69 (#2855)
* update changelog for 1.69.0

* bump version to 1.69.0
2021-11-30 14:23:27 +01:00
bjoern
c0d6c6b882 use anyhow-result for get_resolver (#2853)
* use anyhow-result for get_resolver

* prefer '?' over map_err()
2021-11-30 13:57:04 +01:00
bjoern
2bc8c967b1 really test MX lookup in test_oauth_from_mx() (#2854) 2021-11-30 13:55:07 +01:00
bjoern
fee08f0eeb fix missing MX resolver eg. on android (#2852)
* fix missing MX resolver eg. on android

switching completely to /etc/resolv.conf (see #2780)
does not work at least on some Androids
(see https://github.com/deltachat/deltachat-android/issues/2151 )

therefore, we use the old approach as a fallback.

* log a warning, when we again have problems with figuring out MX resolvers
2021-11-30 11:23:49 +01:00
bjoern
078c3d05d7 fix group changes in multi device setup (#2848)
* test adding members in a multi-device setup

* fix system messages for multi-device-setup

* enhance test to check multi-device messages for removing-members and group-renames
2021-11-30 00:31:36 +01:00
bjoern
7f97768c56 prepare 1.68 (#2844)
* update changelog for 1.68.0

* bump version to 1.68.0
2021-11-28 12:22:14 +01:00
dependabot[bot]
ecd548a7aa Merge pull request #2829 from deltachat/dependabot/cargo/libc-0.2.108 2021-11-27 19:03:56 +00:00
dependabot[bot]
62efb0795b Merge pull request #2830 from deltachat/dependabot/cargo/anyhow-1.0.48 2021-11-27 19:03:22 +00:00
bjoern
53f042ee08 tweak qr svg (#2842)
* repl: allow groupname arguments with more than one word (came over that when testing qr codes)

* calcualte text-size from the real number of lines

* shift text and watermark apart when text get longer

* make clippy happy
2021-11-27 18:57:46 +01:00
link2xt
6ce97bd0cd Merge fixes for chat assignment when forwarding messages
GitHub PR #2843
2021-11-27 00:00:00 +00:00
link2xt
c29149e74c Add group forwarding test 2021-11-27 00:00:00 +00:00
link2xt
487f7593ce Reset In-Reply-To when forwarding a message 2021-11-27 00:00:00 +00:00
link2xt
6b3b33d2a0 Test forwarded quoted messages 2021-11-27 00:00:00 +00:00
link2xt
2d70ccc2bf Do not return a quoted message for forwarded messages
For forwarded messages, parent message is not a quoted message.
2021-11-27 00:00:00 +00:00
link2xt
e90fc9504a Test get_parent_message 2021-11-27 00:00:00 +00:00
link2xt
5108314c03 Do not return trashed messages from get_rfc724_mid_in_list
This function is used to lookup the chat by `References` and
`In-Reply-To` header, so it does not make sense to return trashed
message when there is another non-trashed message in one of these
headers with a real chat ID.
2021-11-27 00:00:00 +00:00
dependabot[bot]
c1e144d4db cargo: bump serde_json from 1.0.71 to 1.0.72
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.71 to 1.0.72.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.71...v1.0.72)

---
updated-dependencies:
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-11-25 21:11:40 +00:00
Hocuri
f2b86a1c0f Update aeap-mvp.rst 2021-11-25 16:18:30 +01:00
Hocuri
9583d41446 Add a draft how an AEAP MVP could look 2021-11-25 16:18:30 +01:00
dependabot[bot]
e594064f93 cargo: bump anyhow from 1.0.47 to 1.0.48
Bumps [anyhow](https://github.com/dtolnay/anyhow) from 1.0.47 to 1.0.48.
- [Release notes](https://github.com/dtolnay/anyhow/releases)
- [Commits](https://github.com/dtolnay/anyhow/compare/1.0.47...1.0.48)

---
updated-dependencies:
- dependency-name: anyhow
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-11-25 14:30:59 +00:00
bjoern
7c52fd95ec prepare 1.67 (#2838)
* update changelog for 1.67.0

* bump version to 1.67.0
2021-11-25 15:29:10 +01:00
dependabot[bot]
d0d5ac6e87 cargo: bump strum_macros from 0.23.0 to 0.23.1
Bumps [strum_macros](https://github.com/Peternator7/strum) from 0.23.0 to 0.23.1.
- [Release notes](https://github.com/Peternator7/strum/releases)
- [Changelog](https://github.com/Peternator7/strum/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Peternator7/strum/commits)

---
updated-dependencies:
- dependency-name: strum_macros
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-11-24 22:24:41 +00:00
Simon Laux
416bf3a829 generate qr code svg (#2815)
* generate qr code svg prototype

* qr code for groups
fix formatting

* - letter avatar in qrcode
- escape xml in userinput (display/groupname)
- fix "Me" display name
- merge import declarations

* remove dot at the end of VerifyContactQRDescription

* if addr == displayname, show only one of them

Especially useful for yggmail accounts without usernames,
because the text would overflow otherwise.

* use real clipPath for rounded avatar

* - center avatar text better (dominant-baseline)
- add "sans-serif" to font fallback for text if arial is missing

* make corner always blue

* add [logo + "get.delta.chat"] footer to qrcode

* Update deltachat-ffi/deltachat.h

Co-authored-by: bjoern <r10s@b44t.com>

* Apply suggestions from code review

Co-authored-by: bjoern <r10s@b44t.com>

* new card design
- add stockstrings
- update changelog

* make qrcode pixels also #f2f2f2 instead of full white

* rename VERIFY_CONTACT_QR_DESC to SETUP_CONTACT
make footer text a tiny bit darker upon r10s's request

* avoid using  which is a doxygen command

* point out that one will join a group (this is still shorted and was also suggested in recent chats)

* add option to generate qr-code-svg to repl tool

* use same font-family in text and footer

* thinner card border

* remove superfluous <tspan> from footer to make color tweaking easier

* move font-weight to style, ios renderer does not pick it up from attribute; remove default font attributes not used consequently

* make get.delta.chat more visible

* align properly using dominant-baseline=central and alignment-baseline=middle, this makes things nice on all systems but android (before, ios was wrong and all others not 100% aligned as font metrics are ignored) (android needs a subsequent improvement)

Co-authored-by: bjoern <r10s@b44t.com>
2021-11-24 23:23:01 +01:00
dependabot[bot]
cc78347293 Merge pull request #2834 from deltachat/dependabot/cargo/futures-0.3.18 2021-11-23 23:22:46 +00:00
dependabot[bot]
27e4ae992a cargo: bump futures from 0.3.17 to 0.3.18
Bumps [futures](https://github.com/rust-lang/futures-rs) from 0.3.17 to 0.3.18.
- [Release notes](https://github.com/rust-lang/futures-rs/releases)
- [Changelog](https://github.com/rust-lang/futures-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/futures-rs/compare/0.3.17...0.3.18)

---
updated-dependencies:
- dependency-name: futures
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-11-23 21:15:34 +00:00
bjoern
a1767dc153 prepare 1.66 (#2831)
* update changelog for 1.66.0

* bump version to 1.66.0

* also mention Contact.last_seen python api
2021-11-23 11:40:15 +01:00
dependabot[bot]
eb610c27bf cargo: bump libc from 0.2.107 to 0.2.108
Bumps [libc](https://github.com/rust-lang/libc) from 0.2.107 to 0.2.108.
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Commits](https://github.com/rust-lang/libc/compare/0.2.107...0.2.108)

---
updated-dependencies:
- dependency-name: libc
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-11-22 21:11:56 +00:00
link2xt
016fb2ceb2 Remove indexmap dependency
`indexmap` is a large dependency (4K SLoC) containing `unsafe` code.

Contact IDs are now passed around as a Vec<u32> or &[u32].

QUOTA roots are now sorted by name instead of perserving original order.
2021-11-22 16:40:06 +01:00
link2xt
5c571520a0 contact: use last_seen column
It was there since the C core, labeled with "/* last_seen is for
future use */" but never actually used. The comment was lost during
the translation from C to Rust.
2021-11-21 21:14:17 +03:00
link2xt
ddefd2cf09 python: add cutil.from_optional_dc_charpointer()
`cutil.from_dc_charpointer()` is guaranteed to return `str`, while
`cutil.from_optional_dc_charpointer()` may return `None` if C function
returns `NULL`.
2021-11-21 20:00:29 +03:00
dependabot[bot]
30a3eeece8 cargo: bump strum_macros from 0.22.0 to 0.23.0
Bumps [strum_macros](https://github.com/Peternator7/strum) from 0.22.0 to 0.23.0.
- [Release notes](https://github.com/Peternator7/strum/releases)
- [Changelog](https://github.com/Peternator7/strum/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Peternator7/strum/commits)

---
updated-dependencies:
- dependency-name: strum_macros
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-11-20 12:20:36 +01:00
dependabot[bot]
5919388588 cargo: bump libc from 0.2.106 to 0.2.107
Bumps [libc](https://github.com/rust-lang/libc) from 0.2.106 to 0.2.107.
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Commits](https://github.com/rust-lang/libc/compare/0.2.106...0.2.107)

---
updated-dependencies:
- dependency-name: libc
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-11-20 12:16:18 +01:00
dependabot[bot]
2cc738f481 cargo: bump strum from 0.22.0 to 0.23.0
Bumps [strum](https://github.com/Peternator7/strum) from 0.22.0 to 0.23.0.
- [Release notes](https://github.com/Peternator7/strum/releases)
- [Changelog](https://github.com/Peternator7/strum/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Peternator7/strum/commits)

---
updated-dependencies:
- dependency-name: strum
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-11-20 11:44:57 +01:00
dependabot[bot]
babd405928 cargo: bump serde_json from 1.0.69 to 1.0.71
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.69 to 1.0.71.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.69...v1.0.71)

---
updated-dependencies:
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-11-20 11:44:21 +01:00
link2xt
e885857875 Remove pretty_assertions dependency
It was only used in two places. Rather than adding `use
pretty_assertions::*` everywhere, it's easier to remove, and it
removes two additional dependency crates.
2021-11-20 11:42:52 +01:00
link2xt
a1d57a2645 Disable unnecessary proptest features 2021-11-20 11:42:52 +01:00
link2xt
a28aecd4d1 Update sqlite dependencies 2021-11-20 11:42:52 +01:00
link2xt
a3f1ff2827 Disable xattr feature on async-tar
This removes `xattr` dependency

We only care about backed up file contents, not attributes.
2021-11-20 11:42:52 +01:00
link2xt
c4d1a639b0 Remove itertools dependency
Collecting into Vec of &str and joining may even be faster according
to benchmarks:
https://gist.github.com/green-s/fbd0d374b290781ac9b3f8ff03e3245d
2021-11-20 11:42:52 +01:00
dependabot[bot]
8732b7a55c cargo: bump anyhow from 1.0.45 to 1.0.47
Bumps [anyhow](https://github.com/dtolnay/anyhow) from 1.0.45 to 1.0.47.
- [Release notes](https://github.com/dtolnay/anyhow/releases)
- [Commits](https://github.com/dtolnay/anyhow/compare/1.0.45...1.0.47)

---
updated-dependencies:
- dependency-name: anyhow
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-11-20 11:42:34 +01:00
Hocuri
1b9148f28e Add section comments to get_connectivity_html() (#2807) 2021-11-18 10:13:47 +01:00
Hocuri
e0129c3b43 Don't set draft after creating group (#2805)
* Don't set draft after creating group

* Remove DC_STR_NEWGROUPDRAFT, add note to Changelog

* Fix the (Rust) test

* Also fix python test
2021-11-16 10:44:30 +01:00
link2xt
60d41022ea scripts: switch from python 3.6 to python 3.7
PEP 562 (__getattr__ in deltachat.const module) is implemented only since python 3.7
2021-11-14 00:00:00 +00:00
bjoern
dd4f2ac671 prepare 1.65 (#2812)
* update changelog for 1.65.0

* bump version to 1.65.0
2021-11-15 14:51:28 +01:00
bjoern
eebb2a3b68 do not assume 'no ephemeral timer' on partial downloads (#2811)
* do not assume 'no ephemeral timer' on partial downloads

* add a test to check that ephemeral timers are not disabled on partial downloads
2021-11-15 11:45:06 +01:00
link2xt
0d62069b67 python: add mypy support and some type hints
`deltachat.const` module now defines `__getattr__` and `__dir__` as
suggested by https://www.python.org/dev/peps/pep-0562/
mypy detects that `__getattr__` is defined and does not show errors
for `DC_*` constants which cannot be detected statically.
mypy is added to `tox.ini`, so type check can be run with `tox -e mypy`.
2021-11-14 11:06:44 +03:00
link2xt
56cf2e6596 Replace error! on verification failure with warn!
A message is added into 1:1 chat anyway, and user does not know what `StockMessage::ContactNotVerified` means.
2021-11-14 02:02:23 +03:00
Simon Laux
59bd5481b9 fix 1.61.0 changelog (#2806) 2021-11-13 22:06:29 +01:00
Hocuri
6c8da526a0 Fix: Only show the "Cannot login" device message if it's actually authentication that failed (#2804)
Generally we could also just remove the device message as we have the
connectivity view, OTOH if you are not using DC a lot, it may be useful
to be notified without opening DC.

And apart from this one bug it's working fine.
2021-11-13 19:20:01 +01:00
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
bjoern
84f54b10dc prepare 1.64 (#2802)
* update changelog for 1.64

* bump version to 1.64.0
2021-11-11 16:45:30 +01:00
bjoern
cebc9e3e91 add 'waiting for being added to the group' only for group-joins (#2797)
* add 'waiting for being added to the group' only for group-joins, not for setup-contact

* add a comment why the message is not added on setup-contact
2021-11-07 20:30:55 +01:00
link2xt
5b131cf77c Do not generate QR codes for ad-hoc groups 2021-11-07 15:55:47 +00:00
link2xt
ce6ec64069 Do not assign group IDs to ad hoc groups 2021-11-07 15:55:47 +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
bjoern
53d049e5f5 prepare 1.63 (#2796)
* update changelog for 1.63

* bump version to 1.63.0
2021-11-06 21:00:54 +01:00
bjoern
4968f72dfb fix permanently hiding of one-to-one chats after secure-join (#2791)
* test one-to-one chats on setup-contact/secure-join

only one chat is created after scanning a QR code:

- on setup-contact, one-to-ones are created on both sided

- on secure-join, the joined group chat is created;
  one-to-ones are not created intitally,
  but should become visible on receiving messages

* make sure, Alice creates the chat with Bob on setup-contact

not totally sure if that change in #2508 was on-purpose,
however, all yet released versions
did create the one-to-one chat also on the Inviter's (Alice) side,
so, let's stay with that,
i do not see many reasons to change that.

* unblock hidden (Blocked::Yes) one-to-one chats

one-to-one chats may be hidden by secure-join,
in case someone later writes a message to it
(not unlikely), the chat needs to be shown.

before, messages are just not shown,
the corresponding chat did not appear.

the 'Blocked' wording of a 'Chat' must not be mixed with the
'Blocking' of a contact. 'Chat-Blocking' is mostly a visibility thing,
that may change as messages come in.

this change should not affect _really_ blocked contacts -
they are filtered out already before
and their messages are usually not even downloaded.
also, before allow_creation is checked,
that may disallow chat creation for show_emails reasons.

all in all, it just does the same
as if the user has manualy deleted the chat before and it would be created.

* simplify test
2021-11-06 18:46:10 +01:00
dependabot[bot]
b24a0ed8fd Merge pull request #2794 from deltachat/dependabot/cargo/serde_json-1.0.69 2021-11-05 23:29:32 +00:00
dependabot[bot]
c810347c7c cargo: bump serde_json from 1.0.68 to 1.0.69
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.68 to 1.0.69.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.68...v1.0.69)

---
updated-dependencies:
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-11-05 21:13:20 +00:00
dependabot[bot]
cf8c4142c7 Merge pull request #2784 from deltachat/dependabot/cargo/libc-0.2.106 2021-11-05 19:35:21 +00:00
dependabot[bot]
f71901b5f9 Merge pull request #2786 from deltachat/dependabot/cargo/backtrace-0.3.63 2021-11-05 19:33:54 +00:00
dependabot[bot]
4419f9c4e7 Merge pull request #2789 from deltachat/dependabot/cargo/anyhow-1.0.45 2021-11-05 19:33:02 +00:00
dependabot[bot]
4e5982b682 cargo: bump anyhow from 1.0.44 to 1.0.45
Bumps [anyhow](https://github.com/dtolnay/anyhow) from 1.0.44 to 1.0.45.
- [Release notes](https://github.com/dtolnay/anyhow/releases)
- [Commits](https://github.com/dtolnay/anyhow/compare/1.0.44...1.0.45)

---
updated-dependencies:
- dependency-name: anyhow
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-11-02 21:14:41 +00:00
bjoern
39e1510e64 add dc_get_last_error() (#2788)
* add dc_get_last_error()

* make clippy happy

* simplify block_on() call
2021-11-02 22:09:04 +01:00
dependabot[bot]
64206160cc Merge pull request #2785 from deltachat/dependabot/cargo/surf-2.3.2 2021-11-01 22:56:28 +00:00
dependabot[bot]
6376659348 cargo: bump backtrace from 0.3.62 to 0.3.63
Bumps [backtrace](https://github.com/rust-lang/backtrace-rs) from 0.3.62 to 0.3.63.
- [Release notes](https://github.com/rust-lang/backtrace-rs/releases)
- [Commits](https://github.com/rust-lang/backtrace-rs/compare/0.3.62...0.3.63)

---
updated-dependencies:
- dependency-name: backtrace
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-11-01 21:17:04 +00:00
dependabot[bot]
43b2a4ad27 cargo: bump surf from 2.3.1 to 2.3.2
Bumps [surf](https://github.com/http-rs/surf) from 2.3.1 to 2.3.2.
- [Release notes](https://github.com/http-rs/surf/releases)
- [Changelog](https://github.com/http-rs/surf/blob/main/CHANGELOG.md)
- [Commits](https://github.com/http-rs/surf/compare/v2.3.1...v2.3.2)

---
updated-dependencies:
- dependency-name: surf
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-11-01 21:16:52 +00:00
dependabot[bot]
eaf06bb239 cargo: bump libc from 0.2.105 to 0.2.106
Bumps [libc](https://github.com/rust-lang/libc) from 0.2.105 to 0.2.106.
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Commits](https://github.com/rust-lang/libc/compare/0.2.105...0.2.106)

---
updated-dependencies:
- dependency-name: libc
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-11-01 21:16:34 +00: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
bjoern
31d113207b prepare 1.62 (#2769)
* update changelog for 1.62

* bump version to 1.62.0
2021-10-31 12:42:53 +01: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
dependabot[bot]
b8b7563fca Merge pull request #2768 from deltachat/dependabot/cargo/syn-1.0.81 2021-10-30 18:17:16 +00:00
dependabot[bot]
0d3f90770e cargo: bump syn from 1.0.80 to 1.0.81
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.80 to 1.0.81.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/1.0.80...1.0.81)

---
updated-dependencies:
- dependency-name: syn
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-29 22:23:51 +00:00
dependabot[bot]
51a4f0aa76 Merge pull request #2774 from deltachat/dependabot/cargo/stop-token-0.6.1 2021-10-29 22:22:26 +00:00
link2xt
ebb89e20b4 fixup! Modernize python setup 2021-10-28 22:03:52 +00:00
dependabot[bot]
8fc60e321b cargo: bump stop-token from 0.6.0 to 0.6.1
Bumps [stop-token](https://github.com/async-rs/stop-token) from 0.6.0 to 0.6.1.
- [Release notes](https://github.com/async-rs/stop-token/releases)
- [Commits](https://github.com/async-rs/stop-token/commits)

---
updated-dependencies:
- dependency-name: stop-token
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-28 21:12:05 +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
dependabot[bot]
300f5be4f3 Merge pull request #2765 from deltachat/dependabot/cargo/libc-0.2.105 2021-10-27 20:05:16 +00:00
bjoern
c5d47ffcb0 add missing DC_STR_* constants (#2767) 2021-10-27 10:38:29 +02:00
bjoern
3b7b8ea0f1 non-blocking group QR joins (#2508)
* refactor: cleanup send_handshake_msg()

- rename to send_alice_handshake_msg() as used by Alice only

- remove dead code from Bob
  (Bob's code is at BobState::send_handshake_message() since some time)

- take a contact_id and not a chat_id;
  this makes things less confusing when
  info-messages are put to the final group chat

* always directly return chat-id from dc_join_securejoin()

* take care not to create a group twice

* adapt documentation

* add info-msg on group invites; add inviter directly after creation

* document existing 'joinqr' command in repl tool

* do not create empty one-to-one chats for group-joins

* refactor: cleanup fingerprint_equals_sender()

- the function takes a contact_id directly now.
  before it consumes the first contact of a one-to-one chat -
  which may be easily confused with the group-chat in creation.
  moreover, the conversion contact_id -> chat_id -> contact_id
  is unneeded overhead.

* show info-messages in destination chat for alice

* fingerprint_equals_sender() returns Err on database failure

* tweak documentation

* clarify what an 'unfinished tasks' task is.

* add regression test for create_for_contact_with_blocked()

* rename Blocked::Manually to better fitting Blocked::Yes

* tweak test_secure_join() and make sure, Alice and Bob have only on chat after a group-join
2021-10-26 16:34:07 +02:00
dependabot[bot]
59739ee5c9 cargo: bump libc from 0.2.104 to 0.2.105
Bumps [libc](https://github.com/rust-lang/libc) from 0.2.104 to 0.2.105.
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Commits](https://github.com/rust-lang/libc/compare/0.2.104...0.2.105)

---
updated-dependencies:
- dependency-name: libc
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-25 21:13:11 +00:00
bjoern
63207eb681 test only: also send+receive a message in the SELF-chat-test (#2764)
* also send+receive a message in the SELF-chat-test

* use get_last_msg_in() instead of code copied from there
2021-10-25 12:45:37 +02:00
bjoern
65f09c238b add multi-device sync (#2669)
* add basic multi-device-sync functions

* generate json

* add context.parse_sync_items()

* add context.execute_sync_items()

* piggyback sync-commands message, add body for human-readable part

* avoid double json renderings

* mimeparser parses incoming .json sync-files

* do not piggyback sync-files

* execute sync items

* return status of send_sync_msg()

* send sync messages as multipart/report

* add a per-item-timestamp and also allow adding other per-item-fields in the future

* if the self-chat does not exist, create it blocked/hidden

* create tokens closer to real qr-code needs

* respect bcc_self setting, add test for that

* sync qr code tokens after promoting groups

* send sync-messages only if an experimental switch is set

* trigger send_sync_msg() after sending messages and after creating/redraw/revive qr-code

* add DC_STR_* constants to deltachat.h

* adapt to refactored qr module as of #2729

* tweak test

* use SendSyncMsgs config name instead of SendExperimentalSyncMsgs - we can remove or rename the config nevertheless, but have the option to keep it without renaming

* tweak docs

* remove currently unused effective timestamp calculation

* clarify when send_sync_msg() is called

* make sure, sync-messages are encrypted and are sent by SELF

* tweak docs, fix typos
2021-10-25 12:40:32 +02:00
dependabot[bot]
bb97d842df Merge pull request #2760 from deltachat/dependabot/cargo/libc-0.2.104 2021-10-23 13:21:02 +00:00
dependabot[bot]
4dba5ab5f9 Merge pull request #2762 from deltachat/dependabot/cargo/backtrace-0.3.62 2021-10-23 13:20:19 +00:00
dependabot[bot]
4c0e46fd44 Merge pull request #2759 from deltachat/dependabot/cargo/stop-token-0.6.0 2021-10-23 12:43:08 +00: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
dependabot[bot]
53f51ad312 cargo: bump backtrace from 0.3.61 to 0.3.62
Bumps [backtrace](https://github.com/rust-lang/backtrace-rs) from 0.3.61 to 0.3.62.
- [Release notes](https://github.com/rust-lang/backtrace-rs/releases)
- [Commits](https://github.com/rust-lang/backtrace-rs/compare/0.3.61...0.3.62)

---
updated-dependencies:
- dependency-name: backtrace
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-20 21:11:17 +00:00
dependabot[bot]
3878c4f041 cargo: bump libc from 0.2.103 to 0.2.104
Bumps [libc](https://github.com/rust-lang/libc) from 0.2.103 to 0.2.104.
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Commits](https://github.com/rust-lang/libc/compare/0.2.103...0.2.104)

---
updated-dependencies:
- dependency-name: libc
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-18 21:18:49 +00:00
dependabot[bot]
499e4d3242 cargo: bump stop-token from 0.5.1 to 0.6.0
Bumps [stop-token](https://github.com/async-rs/stop-token) from 0.5.1 to 0.6.0.
- [Release notes](https://github.com/async-rs/stop-token/releases)
- [Commits](https://github.com/async-rs/stop-token/commits)

---
updated-dependencies:
- dependency-name: stop-token
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-18 21:18:34 +00:00
Hocuri
b5d0907090 Get back stack traces and error messages when tests fail (#2758)
Before this PR, when a test failed, we often got:

```
thread panicked while processing panic. aborting.
error: test failed, to rerun pass '-p deltachat --lib'

Caused by:
  process didn't exit successfully: `/home/user/deltachat-android/jni/deltachat-core-rust/target/debug/deps/deltachat-33648fc4aaad608c 'contact::tests::test_selfavatar_changed_event' --nocapture` (signal: 4, SIGILL: illegal instruction)
```

instead of the error message and stack trace.

This PR fixes this.
2021-10-18 10:48:13 +02:00
Hocuri
6613fa67ee Add DC_EVENT_SELFAVATAR_CHANGED (#2742)
* Add DC_EVENT_SELFAVATAR_CHANGED

* Add test.

Unfortunately I can't easily also test that the avatar is not copied
from unencrypted messages:

In the second encrypted message, the avatar would not be sent again
then, because we only send avatars once a day or so.

* Unfortunately I can't easily also test that the avatar is not copied from unencrypted messages:

In the second encrypted message, the avatar would not be sent again
then, because we only send avatars once a day or so.
2021-10-18 10:42:16 +02:00
bjoern
41ec380b55 add let's encrypt certificate missing on some older android devices (#2752)
* add let's encrypt certificate missing on some older android devices

* create Certificate with Lazy::new()

* document certificate source

* use smaller *.der format instead of *.pem
2021-10-17 14:28:34 +02:00
dependabot[bot]
7fb305e898 Merge pull request #2746 from deltachat/dependabot/cargo/thiserror-1.0.30 2021-10-15 23:00:26 +00:00
dependabot[bot]
d4255a4979 Merge pull request #2753 from deltachat/dependabot/cargo/stop-token-0.5.1 2021-10-15 22:58:35 +00:00
dependabot[bot]
b21dcd17b7 cargo: bump stop-token from 0.4.0 to 0.5.1
Bumps [stop-token](https://github.com/async-rs/stop-token) from 0.4.0 to 0.5.1.
- [Release notes](https://github.com/async-rs/stop-token/releases)
- [Commits](https://github.com/async-rs/stop-token/commits)

---
updated-dependencies:
- dependency-name: stop-token
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-15 21:12:24 +00:00
bjoern
0caea85d16 priorize CertificateChecks setting from user over the one from provider-db (#2749)
* priorize CertificateChecks setting from user over the one from provider-db

* avoid some duplicate code

* remove questionable comment
2021-10-13 21:45:51 +02:00
dependabot[bot]
42e0fb5eb9 cargo: bump thiserror from 1.0.29 to 1.0.30
Bumps [thiserror](https://github.com/dtolnay/thiserror) from 1.0.29 to 1.0.30.
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/1.0.29...1.0.30)

---
updated-dependencies:
- dependency-name: thiserror
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-12 21:14:43 +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
link2xt
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
dependabot[bot]
49b07c1c6a Merge pull request #2697 from deltachat/dependabot/cargo/async-tar-0.4.2 2021-10-09 11:50:19 +00:00
dependabot[bot]
51d220f1e0 Merge pull request #2732 from deltachat/dependabot/cargo/stop-token-0.4.0 2021-10-09 11:14:10 +00:00
dependabot[bot]
9f81a94d86 cargo: bump stop-token from 0.2.0 to 0.4.0
Bumps [stop-token](https://github.com/async-rs/stop-token) from 0.2.0 to 0.4.0.
- [Release notes](https://github.com/async-rs/stop-token/releases)
- [Commits](https://github.com/async-rs/stop-token/commits)

---
updated-dependencies:
- dependency-name: stop-token
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-09 10:58:29 +00:00
dependabot[bot]
f6098fc931 cargo: bump async-tar from 0.3.0 to 0.4.2
Bumps [async-tar](https://github.com/dignifiedquire/async-tar) from 0.3.0 to 0.4.2.
- [Release notes](https://github.com/dignifiedquire/async-tar/releases)
- [Commits](https://github.com/dignifiedquire/async-tar/compare/v0.3.0...v0.4.2)

---
updated-dependencies:
- dependency-name: async-tar
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-09 10:58:22 +00: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
Hocuri
5e29cae81a Fix: Don't update quota in an endless loop (#2726)
The problem was:
When opening the connectivity view while there is no network,
get_connectivity_html() calls schedule_quota_update(), which schedules a
UpdateRecentQuota job. But in update_recent_quota(), connecting fails
and a ConnectivityChanged event is emitted (connectivity changes from
Error to Connecting and back). Therefore the UI calls
get_connectivity_html() again, and the loop is complete.

This made the UI completely unresponsible. To reproduce, just turn wi-fi
off and open the connectivity view.

The fix is:
schedule_quota_update() now only schedules a new job if there is no old
job. To prevent the possible (though probably unlikely) problem that an
old quota update job has a backoff of, like, a day and therefore quota
is not updated, I reduced the backoff time for quota jobs to 10s.

Fixes possibly https://github.com/deltachat/deltachat-android/issues/2043, but we should "re-try" this
2021-10-05 10:57:34 +02:00
bjoern
1ee19bf3ca prepare 1.61 (#2715)
* update changelog for 1.61

* adapt hints in version-helper

* bump version to 1.61.0
2021-10-03 17:53:15 +02:00
bjoern
b18bdd1b00 fix "QR process failed" error and add a test (#2725)
* better readable enum

* add a failing test

* let new secure-joins abort existing ones

before, a stale secure-join or setup-contact
made the whole qr-scanning unusable until
the app is restarted,
resulting in "QR process failed" errors.

this commit fixes the issue by
aborting existing scans -
in cases, a user really wants two concurrect joins running,
this is not perfect, but that did not worked before as well.

* remove unused AlreadyRunning variant

* make clippy happy
2021-10-03 13:17:09 +02:00
link2xt
6c59b0de85 Remove unused Imap.interrupt
It is always set to `None`.
2021-10-03 01:14:50 +00:00
dependabot[bot]
c1d82ad417 Merge pull request #2717 from deltachat/dependabot/cargo/smallvec-1.7.0 2021-10-02 17:33:10 +00:00
dependabot[bot]
ba931773d1 Merge pull request #2716 from deltachat/dependabot/cargo/pretty_assertions-1.0.0 2021-10-02 16:19:33 +00:00
bjoern
b6f88a9fca make string 123 MiB of 456 MiB used translatable (#2723) 2021-10-01 21:07:38 +02:00
bjoern
b0902102a2 add some more hints and missing crosslinks to dc_get_chat_type() (#2724) 2021-10-01 21:07:23 +02:00
bjoern
4f19036408 extend forward-test by broadcasts (#2722) 2021-09-30 18:18:37 +02:00
dependabot[bot]
fe1f9c0ed9 Merge pull request #2720 from deltachat/dependabot/cargo/async-smtp-3e7a8f3 2021-09-30 12:23:47 +00:00
bjoern
bcadd0cd5c broadcasts (#2707)
* add Chattype::Broadcast and create_broadcast_list()

* do not disclose recipients for broadcasts

* allow sending/add-/remove-member for broadcast

* set broadcast subject same as for one-to-one chats

* broadcast-recipient-list does not include SELF

* use special icon for broadcast groups

* generate initial broadcast names

* make clippy happy

* send BCC message unencrypted to avoid unexpected disclosing; encryption is opportunistic anyway. if we have 'protected chats' at some point, we can think that over.

* reword 'To:'-group

* simplify can-send-check

* add broadcast tests

* tweak comments

* Update deltachat-ffi/deltachat.h

Co-authored-by: Hocuri <hocuri@gmx.de>

* change name of can_edit() to is_self_in_chat()

Co-authored-by: Hocuri <hocuri@gmx.de>
2021-09-30 13:56:05 +02:00
bjoern
30a3da97da do not leak group names on forwarding, add tests for that (#2719)
* add a test to check no possibly sensible data are forwarded

* do not leak group names on forwarding

* adapt existing test
2021-09-30 13:19:37 +02:00
dependabot[bot]
a8b2a20146 cargo: bump async-smtp from 2c21f5f to 3e7a8f3
Bumps [async-smtp](https://github.com/async-email/async-smtp) from `2c21f5f` to `3e7a8f3`.
- [Release notes](https://github.com/async-email/async-smtp/releases)
- [Commits](2c21f5fb64...3e7a8f3de1)

---
updated-dependencies:
- dependency-name: async-smtp
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-09-29 21:10:13 +00:00
bjoern
82819a642f update provider database (#2718) 2021-09-29 12:59:38 +02:00
dependabot[bot]
3960d4129e cargo: bump smallvec from 1.6.1 to 1.7.0
Bumps [smallvec](https://github.com/servo/rust-smallvec) from 1.6.1 to 1.7.0.
- [Release notes](https://github.com/servo/rust-smallvec/releases)
- [Commits](https://github.com/servo/rust-smallvec/compare/v1.6.1...v1.7.0)

---
updated-dependencies:
- dependency-name: smallvec
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-09-28 21:12:49 +00:00
dependabot[bot]
e405ddf080 cargo: bump pretty_assertions from 0.7.2 to 1.0.0
Bumps [pretty_assertions](https://github.com/colin-kiegel/rust-pretty-assertions) from 0.7.2 to 1.0.0.
- [Release notes](https://github.com/colin-kiegel/rust-pretty-assertions/releases)
- [Changelog](https://github.com/colin-kiegel/rust-pretty-assertions/blob/main/CHANGELOG.md)
- [Commits](https://github.com/colin-kiegel/rust-pretty-assertions/compare/v0.7.2...v1.0.0)

---
updated-dependencies:
- dependency-name: pretty_assertions
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-09-28 21:12:37 +00:00
dependabot[bot]
1eadbbb7cd Merge pull request #2698 from deltachat/dependabot/cargo/rustyline-9.0.0 2021-09-28 17:54:21 +00:00
bjoern
941b8caa8b move create_multiuser_record() to ChatId (#2706)
this is needed for targeting "non-blocking group QR joins"
as create_multiuser_record() would also be needed from other places.

this will make rebasing/rewriting and finally reviewing #2508 easier.
2021-09-27 20:24:25 +02:00
bjoern
95bce993ad set message-state OutMdnRcvd on first read-receipt (#2699)
in the past, group-messages were marked as "read by recipient"
only when at least 50% of the group members have send a read receipt -
in practise, this does happen never or much too late esp. in larger groups.

setting the state OutMdnRcvd already on the first read-receipt
seems to be much more intuitive and useful as you at least know
one person has read the message.

this is also what other messengers as telegram are doing here.

moreover, this fixes a bug that did not add all read-receipts
to the "Info" screen - once "enough" read-receipts were received,
and the state was already set to OutMdnRcvd, subsequent read-receipts
were ignored.
probably because the "Info" screen did not show the read-receipts since forever -
and for the second tick, the addutional read-receipts are not needed.
2021-09-27 13:39:27 +02: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
cyBerta
d8b47dc4aa add parameter description for DC_EVENT_CHAT_EPHEMERAL_TIMER_MODIFIED (#2705)
* add parameter description for DC_EVENT_CHAT_EPHEMERAL_TIMER_MODIFIED

* Update deltachat-ffi/deltachat.h

add description for data2 parameter

Co-authored-by: bjoern <r10s@b44t.com>

Co-authored-by: bjoern <r10s@b44t.com>
2021-09-23 11:18:01 +02:00
bjoern
a5826d6a06 let quota-warning reappear after import, rewarn at 95% (#2702)
* let quota-warning reappear after import

an import removes all device-messages,
including the quota warning.

resetting `Config::QuotaExceeding` makes sure,
the warning reappears soon after import -
otherwise the warning would reappear only after
storage is cleaned up and exceeds again.

* a second quota warning when 95% storage exceeded

* factor out warning-check and add a test for that
2021-09-22 12:41:35 +02:00
dependabot[bot]
5df0be8311 cargo: bump rustyline from 8.2.0 to 9.0.0
Bumps [rustyline](https://github.com/kkawakam/rustyline) from 8.2.0 to 9.0.0.
- [Release notes](https://github.com/kkawakam/rustyline/releases)
- [Changelog](https://github.com/kkawakam/rustyline/blob/master/History.md)
- [Commits](https://github.com/kkawakam/rustyline/compare/v8.2.0...v9.0.0)

---
updated-dependencies:
- dependency-name: rustyline
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-09-20 21:12:49 +00:00
bjoern
66a5e0743d make connectivity and quota views translatable (#2694)
* add missing stock strings for connectivity and quota

* reword quota error

* use 'Incoming/Outgoing Messages' instead of 'Inbox/Outbox'

* just say 'Not supported by your provider.' if quota cannot be read.

- the context is already given by the headline
  'Storage on domain.org'
- the string is short and does not disturb much
  (it is a very common error)
- the string does not mention 'quota' as such,
  which will be hard to translate ('Kontingentsinformationen') -
  even if ppl as we know about the Quota extensions an such things.

there was also the idea to hide the whole section,
however, that is confusing in a multi-device-usage
when things are sometimes shown and sometimes not.
2021-09-20 21:43:53 +02:00
bjoern
43d1d9b1b3 emit MsgsChanged(chat_id, 0) on full downloads (#2696)
before, MsgsChanged(chat_id, new_msg_id) was emitted,
but that does not cover the deleted message.

in theory, we could emit both,
however, that would just be a waste of refresh in uis.

also before, events were used this way,
however, also the documentations are updated to
reflect reality better.
2021-09-20 20:50:22 +02:00
bjoern
3e0f601212 implement set/get_ui_config() resurrection (#2672)
* Implement set/get_ui_config and use those methods if config string starts with 'ui.'

* use ensure! macro
2021-09-20 20:50:07 +02: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
Simon Laux
b33ad05c3b chore add .DS_Store to gitignore 2021-09-18 19:01:55 +02:00
bjoern
398cea6466 document DC_STATE and DC_CHAT_TYPE explicitly (#2688)
* document DC_STATE explicitly and add real hyperlinks

* document DC_CHAT_TYPE explicitly

* sort constants alphabetically
2021-09-18 13:51:07 +02: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
bjoern
bffb41326c better names for more mailinglist-types (#2685)
* add a test for xing mailinglists

* strip long hash-prefixes from mailinglist name if we got the name from the List-Id as a last resort

* add a test for newsletter@ mailinglists

these mailinglists have the list-name in `From:`
and can be detected by addresses starting with `newsletter@`.

* if not list-name is set, use the `From:` name for addresses starting with `newsletter@`

this is similar to what we do with `notifications@`

* Update src/dc_receive_imf.rs

Co-authored-by: Hocuri <hocuri@gmx.de>

* add an example to the regex

Co-authored-by: Hocuri <hocuri@gmx.de>
2021-09-16 18:43:37 +02:00
dependabot[bot]
c532055153 Merge pull request #2683 from deltachat/dependabot/cargo/anyhow-1.0.44 2021-09-16 12:31:07 +00:00
dependabot[bot]
be595f8601 Merge pull request #2686 from deltachat/dependabot/cargo/serde_json-1.0.68 2021-09-16 12:20:26 +00:00
bjoern
1d1d98e02b do not use term Message-ID for msg_id, clarify that on downloading also complete replacements may happen. (#2684) 2021-09-16 14:17:08 +02:00
dependabot[bot]
771e84af6e cargo: bump serde_json from 1.0.67 to 1.0.68
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.67 to 1.0.68.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.67...v1.0.68)

---
updated-dependencies:
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-09-14 21:12:30 +00:00
dependabot[bot]
bbfed20d34 cargo: bump anyhow from 1.0.43 to 1.0.44
Bumps [anyhow](https://github.com/dtolnay/anyhow) from 1.0.43 to 1.0.44.
- [Release notes](https://github.com/dtolnay/anyhow/releases)
- [Commits](https://github.com/dtolnay/anyhow/compare/1.0.43...1.0.44)

---
updated-dependencies:
- dependency-name: anyhow
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-09-13 21:12:34 +00:00
bjoern
0f2095947c download on demand (#2631)
* draft a download-api

* basic implementation

* allow partial downloads for protected chats

* use a separate column for download_state

* force a minimal timeout for delete_server_after in combination with partial messages

* add a warning if a possible download may expire by delete_server_after

* test load_imap_deletion_msgid()

* add a test for a partial download

* improve documentation and visibility

* let get_download_limit() return Result<Option>

* rusty getters

* apply MIN_DELETE_SERVER_AFTER to shown availability time

* move stub-creation to download.rs, use stock-strings, nicer logging

* make clippy happy (cargo clippy --tests)

* refine tests and comments

* fix typo

* remove superfluous closure in ffi

* respect partial_download for immediately scheduled DeleteMsgOnImap jobs
2021-09-13 21:12:00 +02:00
Hocuri
46956caf75 Fix: Recognize ndns that put the headers into "message/global-headers" part (Improve ndn detection) (#2598)
I sent a message, and the ndn (Non Delivery Notification) was not parsed correctly, so here comes
the fix and the test.
2021-09-12 21:02:51 +02: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
bjoern
da2f30786b get correct names of .xt.local mailinglists (#2665)
* add a test for .xt.local mailinglists

* get correct names of .xt.local mailinglists

these mailinglist probably come from the xt:Commerce system
and are pretty widely used.

i have not seen an .xt.local mailinglist with name set in List-Id,
however, if that happens, it will still be taken.

only if the name is unset,
we use the name from the From-header.
2021-09-12 15:34:29 +02:00
bjoern
50a5e715d2 simpler subject of Autocrypt-Setup-Message (#2673)
since some time, core handles per-message-subjects
and Mimefactory also picks that up.

therefore, we can remove the old special handling.
2021-09-12 14:34:55 +02: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
dependabot[bot]
2a0f6f5cf7 Merge pull request #2671 from deltachat/dependabot/cargo/sha2-0.9.8 2021-09-11 10:18:56 +00:00
dependabot[bot]
b27793e852 cargo: bump sha2 from 0.9.6 to 0.9.8
Bumps [sha2](https://github.com/RustCrypto/hashes) from 0.9.6 to 0.9.8.
- [Release notes](https://github.com/RustCrypto/hashes/releases)
- [Commits](https://github.com/RustCrypto/hashes/compare/sha2-v0.9.6...sha2-v0.9.8)

---
updated-dependencies:
- dependency-name: sha2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-09-09 21:13:26 +00:00
Robert Schütz
8fb5e038a9 fix pkg-config file
The CMAKE_INSTALL_FULL_<dir> variables are only defined if
GNUInstallDirs is included.
2021-09-08 17:48:33 -07:00
bjoern
e518dc3331 clarify dc_is_configured() (#2668) 2021-09-08 16:05:38 +02:00
dependabot[bot]
ea1368a36b Merge pull request #2661 from deltachat/dependabot/cargo/syn-1.0.76 2021-09-08 09:36:41 +00:00
dependabot[bot]
0aeb2bd6fb cargo: bump syn from 1.0.75 to 1.0.76
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.75 to 1.0.76.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/1.0.75...1.0.76)

---
updated-dependencies:
- dependency-name: syn
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-09-08 08:34:30 +00:00
dependabot[bot]
0263d0816a Merge pull request #2662 from deltachat/dependabot/cargo/thiserror-1.0.29 2021-09-08 08:33:09 +00:00
dependabot[bot]
bb71f6ec98 cargo: bump thiserror from 1.0.28 to 1.0.29
Bumps [thiserror](https://github.com/dtolnay/thiserror) from 1.0.28 to 1.0.29.
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/1.0.28...1.0.29)

---
updated-dependencies:
- dependency-name: thiserror
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-09-06 21:12:39 +00: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
dependabot[bot]
c31216f043 Merge pull request #2645 from deltachat/dependabot/cargo/sha2-0.9.6 2021-09-05 03:37:33 +00:00
dependabot[bot]
f66bde7275 cargo: bump sha2 from 0.9.5 to 0.9.6
Bumps [sha2](https://github.com/RustCrypto/hashes) from 0.9.5 to 0.9.6.
- [Release notes](https://github.com/RustCrypto/hashes/releases)
- [Commits](https://github.com/RustCrypto/hashes/compare/sha2-v0.9.5...sha2-v0.9.6)

---
updated-dependencies:
- dependency-name: sha2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-09-05 03:20:48 +00: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
bjoern
3c43d790a3 update chat/contact data only when there was no newer update (#2642)
* check update timestamps for signatures, user-avatars, ephemeral-settings, last-subject

* check update timestamp for group-avatars

* check update timestamp for group-names

* check update timestamp for memberlist

* check update timestamp for protection-settings

* add a more advanced test

* add another more advanced test

* set last-subject-timestamp more carefully

* bubble up errros from set_*timestamp() and check for from_id==0 before

* simplify Params::set_i64()

* remove comment that is more confusing than helpful

* use update_timestamp() wording consistently
2021-09-04 22:16:39 +02: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
dependabot[bot]
aa2e03382b Merge pull request #2650 from deltachat/dependabot/cargo/thiserror-1.0.28 2021-09-04 15:42:24 +00:00
dependabot[bot]
2a59e6121b Merge pull request #2652 from deltachat/dependabot/cargo/serde_json-1.0.67 2021-09-04 15:40:59 +00:00
dependabot[bot]
1a438d61df Merge pull request #2649 from deltachat/dependabot/cargo/futures-0.3.17 2021-09-04 15:26:52 +00:00
bjoern
444486f5df better readable code fragments on c.delta.chat (#2647)
* better readable code fragments on c.delta.chat

* make it even a bit nicer
2021-09-04 17:10:05 +02:00
dependabot[bot]
1eae2477c3 cargo: bump serde_json from 1.0.66 to 1.0.67
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.66 to 1.0.67.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.66...v1.0.67)

---
updated-dependencies:
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-09-04 15:02:45 +00:00
dependabot[bot]
7b3eefc6c6 cargo: bump thiserror from 1.0.26 to 1.0.28
Bumps [thiserror](https://github.com/dtolnay/thiserror) from 1.0.26 to 1.0.28.
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/1.0.26...1.0.28)

---
updated-dependencies:
- dependency-name: thiserror
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-09-04 15:01:34 +00:00
dependabot[bot]
4dd0830baf Merge pull request #2643 from deltachat/dependabot/cargo/sha-1-0.9.8 2021-09-04 15:00:52 +00:00
dependabot[bot]
8e3f062881 cargo: bump futures from 0.3.16 to 0.3.17
Bumps [futures](https://github.com/rust-lang/futures-rs) from 0.3.16 to 0.3.17.
- [Release notes](https://github.com/rust-lang/futures-rs/releases)
- [Changelog](https://github.com/rust-lang/futures-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/futures-rs/compare/0.3.16...0.3.17)

---
updated-dependencies:
- dependency-name: futures
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-09-04 15:00:24 +00:00
dependabot[bot]
cf445f265a Merge pull request #2627 from deltachat/dependabot/cargo/surf-2.3.1 2021-09-04 14:58:18 +00:00
dependabot[bot]
963c66b76c Merge pull request #2644 from deltachat/dependabot/cargo/async-std-1.10.0 2021-09-04 14:57:43 +00:00
dependabot[bot]
79df667e1e Merge pull request #2648 from deltachat/dependabot/cargo/mailparse-0.13.6 2021-09-04 14:54:28 +00:00
dependabot[bot]
785c796bd6 Merge pull request #2646 from deltachat/dependabot/cargo/pgp-0.7.2 2021-09-04 14:53:20 +00:00
dependabot[bot]
6a2112ba66 Merge pull request #2622 from deltachat/dependabot/cargo/syn-1.0.75 2021-09-03 09:45:06 +00:00
dependabot[bot]
3f170279da cargo: bump syn from 1.0.74 to 1.0.75
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.74 to 1.0.75.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/1.0.74...1.0.75)

---
updated-dependencies:
- dependency-name: syn
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-09-03 09:21:11 +00:00
dependabot[bot]
3408501a75 cargo: bump async-std from 1.9.0 to 1.10.0
Bumps [async-std](https://github.com/async-rs/async-std) from 1.9.0 to 1.10.0.
- [Release notes](https://github.com/async-rs/async-std/releases)
- [Changelog](https://github.com/async-rs/async-std/blob/master/CHANGELOG.md)
- [Commits](https://github.com/async-rs/async-std/compare/v1.9.0...v1.10.0)

---
updated-dependencies:
- dependency-name: async-std
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-09-03 09:20:31 +00:00
dependabot[bot]
3b765cb3c9 Merge pull request #2625 from deltachat/dependabot/cargo/fast-socks5-0.4.3 2021-09-03 09:18:55 +00:00
dependabot[bot]
8a9ea388ed Merge pull request #2609 from deltachat/dependabot/cargo/bitflags-1.3.2 2021-09-03 09:15:37 +00:00
dependabot[bot]
77acf910bf cargo: bump bitflags from 1.3.1 to 1.3.2
Bumps [bitflags](https://github.com/bitflags/bitflags) from 1.3.1 to 1.3.2.
- [Release notes](https://github.com/bitflags/bitflags/releases)
- [Changelog](https://github.com/bitflags/bitflags/blob/main/CHANGELOG.md)
- [Commits](https://github.com/bitflags/bitflags/compare/1.3.1...1.3.2)

---
updated-dependencies:
- dependency-name: bitflags
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-09-02 18:41:20 +00:00
dependabot[bot]
c04c87658c cargo: bump mailparse from 0.13.5 to 0.13.6
Bumps [mailparse](https://github.com/staktrace/mailparse) from 0.13.5 to 0.13.6.
- [Release notes](https://github.com/staktrace/mailparse/releases)
- [Commits](https://github.com/staktrace/mailparse/compare/v0.13.5...v0.13.6)

---
updated-dependencies:
- dependency-name: mailparse
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-09-02 18:39:51 +00:00
dependabot[bot]
fd784ec223 cargo: bump async-trait from 0.1.50 to 0.1.51 (#2572)
Bumps [async-trait](https://github.com/dtolnay/async-trait) from 0.1.50 to 0.1.51.
- [Release notes](https://github.com/dtolnay/async-trait/releases)
- [Commits](https://github.com/dtolnay/async-trait/compare/0.1.50...0.1.51)

---
updated-dependencies:
- dependency-name: async-trait
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-09-02 20:39:47 +02:00
dependabot[bot]
25f1b0c4af cargo: bump criterion from 0.3.4 to 0.3.5 (#2564)
Bumps [criterion](https://github.com/bheisler/criterion.rs) from 0.3.4 to 0.3.5.
- [Release notes](https://github.com/bheisler/criterion.rs/releases)
- [Changelog](https://github.com/bheisler/criterion.rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/bheisler/criterion.rs/compare/0.3.4...0.3.5)

---
updated-dependencies:
- dependency-name: criterion
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-09-02 20:38:28 +02:00
dependabot[bot]
580ec6e6ce cargo: bump pgp from 0.7.1 to 0.7.2
Bumps [pgp](https://github.com/rpgp/rpgp) from 0.7.1 to 0.7.2.
- [Release notes](https://github.com/rpgp/rpgp/releases)
- [Changelog](https://github.com/rpgp/rpgp/blob/master/release.toml)
- [Commits](https://github.com/rpgp/rpgp/compare/v0.7.1...v0.7.2)

---
updated-dependencies:
- dependency-name: pgp
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-09-01 22:19:33 +00:00
dependabot[bot]
8e5195c4f6 cargo: bump native-tls from 0.2.7 to 0.2.8 (#2597)
Bumps [native-tls](https://github.com/sfackler/rust-native-tls) from 0.2.7 to 0.2.8.
- [Release notes](https://github.com/sfackler/rust-native-tls/releases)
- [Changelog](https://github.com/sfackler/rust-native-tls/blob/master/CHANGELOG.md)
- [Commits](https://github.com/sfackler/rust-native-tls/compare/v0.2.7...v0.2.8)

---
updated-dependencies:
- dependency-name: native-tls
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-09-02 00:18:14 +02:00
dependabot[bot]
729a1e1cd2 Merge pull request #2641 from deltachat/dependabot/cargo/serde-1.0.130 2021-09-01 20:55:33 +00:00
dependabot[bot]
78b93f3621 cargo: bump serde from 1.0.127 to 1.0.130
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.127 to 1.0.130.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.127...v1.0.130)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-09-01 20:11:06 +00:00
dependabot[bot]
4111489daf cargo: bump anyhow from 1.0.42 to 1.0.43 (#2610)
Bumps [anyhow](https://github.com/dtolnay/anyhow) from 1.0.42 to 1.0.43.
- [Release notes](https://github.com/dtolnay/anyhow/releases)
- [Commits](https://github.com/dtolnay/anyhow/compare/1.0.42...1.0.43)

---
updated-dependencies:
- dependency-name: anyhow
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-09-01 22:09:03 +02:00
dependabot[bot]
b7bd4c6ba7 cargo: bump sha-1 from 0.9.7 to 0.9.8
Bumps [sha-1](https://github.com/RustCrypto/hashes) from 0.9.7 to 0.9.8.
- [Release notes](https://github.com/RustCrypto/hashes/releases)
- [Commits](https://github.com/RustCrypto/hashes/compare/sha-1-v0.9.7...sha-1-v0.9.8)

---
updated-dependencies:
- dependency-name: sha-1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-09-01 20:08:40 +00:00
dependabot[bot]
83dc0bc2b0 Merge pull request #2632 from deltachat/dependabot/cargo/libc-0.2.101 2021-09-01 20:07:10 +00: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
Jikstra
2b74a705ef Make sure we don't emit mutliple events about import progress with the same progress number (#2639) 2021-08-29 17:43:00 +02:00
link2xt
9dedcad220 imap: use anyhow for error handling 2021-08-29 17:57:29 +03:00
bjoern
71e0493c4a add device message if quota is exceeding (#2621)
* resultify update_recent_quota()

* add a device-message if quota exceeds QUOTA_WARN_THRESHOLD_PERCENTAGE

* check if a quota warning should be added during housekeeping, this is at least once a day

* dc_get_config("quota_exceeding") is useful for bots

* make clippy happy

* reword QuotaExceedingMsgBody message

* avoid lots of warnings if quota jitters around the warning threshold

* allow clippy::assertions_on_constants

these constants depend on each other, it makes sense to check that they are not changed in an incompatible way
2021-08-26 15:31:25 +02:00
dependabot[bot]
1679ddddf0 cargo: bump libc from 0.2.98 to 0.2.101
Bumps [libc](https://github.com/rust-lang/libc) from 0.2.98 to 0.2.101.
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Commits](https://github.com/rust-lang/libc/compare/0.2.98...0.2.101)

---
updated-dependencies:
- dependency-name: libc
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-25 21:08:14 +00:00
dependabot[bot]
de258645f4 cargo: bump surf from 2.2.0 to 2.3.1
Bumps [surf](https://github.com/http-rs/surf) from 2.2.0 to 2.3.1.
- [Release notes](https://github.com/http-rs/surf/releases)
- [Changelog](https://github.com/http-rs/surf/blob/main/CHANGELOG.md)
- [Commits](https://github.com/http-rs/surf/compare/v2.2.0...v2.3.1)

---
updated-dependencies:
- dependency-name: surf
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-24 21:12:32 +00:00
dependabot[bot]
b463b602a9 cargo: bump fast-socks5 from 0.4.2 to 0.4.3
Bumps [fast-socks5](https://github.com/dizda/fast-socks5) from 0.4.2 to 0.4.3.
- [Release notes](https://github.com/dizda/fast-socks5/releases)
- [Commits](https://github.com/dizda/fast-socks5/compare/v0.4.2...v0.4.3)

---
updated-dependencies:
- dependency-name: fast-socks5
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-23 21:10:21 +00: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
Jikstra
90703b0dd2 Implement socks5 support
This adds following settings:

- Socks5Enabled
- Socks5Host
- Socks5Port
- Socks5User
- Socks5Password

Currently http requests and dns requests are not getting executed as they currently can't get tunneled through socks5 proxy. Therefore gmail with oauth2 wont work through tor.
2021-08-22 19:55:38 +02: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
dependabot[bot]
f95e1db8e2 Merge pull request #2574 from deltachat/dependabot/cargo/serde_json-1.0.66 2021-08-22 11:30:51 +00:00
bjoern
d0c97bce4c tweak quota display (#2616)
* resultify get_connectivity_html()

* tweak quota titles, avoid confusing 'quota' wording

* show bars for quota usage

* skip secondady 'Storage' title, see comment for reasoning
2021-08-22 12:46:46 +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
bjoern
d0bfb555dd prepare 1.59 (#2614)
* update changelog for 1.59.0

* bump version to 1.59.0
2021-08-20 18:20:06 +02:00
bjoern
6ffaa38b37 add 'device chat about' to now existing status (#2613)
the 'device chat about' was shown as a single message
as at that time, there was just not 'status'.

meanwhile, we have the status option,
and it feels much more natural to get the information there,
esp. as the subtitle on all UIs already read
'Messages in this chat are generated locally' -
and a tap on that will show the hint, without scrolling or so.

this also teaches the user where to find such information -
and the "welcome" chat is less spammy and really starts with the text
"Welcome to Delta Chat!"
2021-08-20 12:30:55 +02:00
bjoern
339d46ecf0 update provider database, add yggmail and mail2tor (#2608)
* allow dotless domains and hostnames

* update provider database

ran ./src/provider/update.py ../provider-db/_providers/ > src/provider/data.rs
to pull in recent changes from https://github.com/deltachat/provider-db
2021-08-20 10:48:27 +02:00
bjoern
5399c9151d Add Quota to Connectivity View (#2612)
* add imap::get_quota_roots()

* schedule quote-checking job on getting connectivity-html

* get quota and debug print it

* basic quota output

* update quota at most once per minute, emit event on changes

* use more meaningful names

* add some comments, move update_recent_quota() to quota.rs

* show root name only if there are several roots

* make clippy happy, some refactorings

* allow only one update-quota job per time

* add now supported QUOTA to standards.md
2021-08-20 10:40:24 +02:00
bjoern
53cd633e8d add migrated accounts to events emitter (#2607)
successor of #2559
closes #2606
2021-08-16 22:10:34 +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
B. Petersen
b8dad1dbaf add support for socket PLAIN coming from provider-db 2021-08-15 20:28:09 +03:00
dependabot[bot]
72d503fa32 Merge pull request #2602 from deltachat/dependabot/cargo/bitflags-1.3.1 2021-08-14 16:07:47 +00:00
Hocuri
223aeb7b1a Fix: Make emails forwarded by GMX readable (#2600)
Recognizing these emails as forwarded would probably be too complicated and require too much special-casing, but now the user can access the email text via "Show full message".

fix #2599

Co-authored-by: B. Petersen <r10s@b44t.com>
2021-08-14 18:05:17 +02:00
dependabot[bot]
b315c6f6d5 cargo: bump bitflags from 1.2.1 to 1.3.1
Bumps [bitflags](https://github.com/bitflags/bitflags) from 1.2.1 to 1.3.1.
- [Release notes](https://github.com/bitflags/bitflags/releases)
- [Changelog](https://github.com/bitflags/bitflags/blob/main/CHANGELOG.md)
- [Commits](https://github.com/bitflags/bitflags/compare/1.2.1...1.3.1)

---
updated-dependencies:
- dependency-name: bitflags
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-12 21:16:44 +00:00
Hocuri
481276cf46 In dc_maybe_network_lost() directly set the connectivity "Not connected" (#2551)
* In dc_maybe_network_lost() directly set the connectivity "Not connected"

r10s reported that without doing this, the connectivity would stay at
"Connected" for 16 more seconds after network is gone and
dc_maybe_network_lost() was called.

* Set the state for all connections
2021-08-09 17:25:34 +02:00
Hocuri
faab61b0d4 Connectivity view: Only set smtp to "connected" if the last message was actually sent (#2541)
fix #2539

It's always a bit ambiguous which function should do set_err or set last_send_error, I used this rule here:

If some code returns Status::RetryLater, then it sets last_send_error, because Status::RetryLater means that the user won't see the error directly on the message (if we returned Status::Failed(Err(_)), then the message would be shown as failed to the user) Also, smtp_send always sets last_send_error because, well, sending just failed or succeeded.

Also, remove unused field pending_error.
2021-08-09 12:31:33 +02: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
Simon Laux
ac245a6cb2 accounts: add get_selected_account_id function 2021-08-07 22:39:48 +03:00
dependabot[bot]
126beb62f3 Merge pull request #2529 from deltachat/dependabot/cargo/libc-0.2.98 2021-08-07 18:10:04 +00:00
dependabot[bot]
1f642046bc cargo: bump serde_json from 1.0.64 to 1.0.66
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.64 to 1.0.66.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.64...v1.0.66)

---
updated-dependencies:
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-07 15:20:51 +00:00
dependabot[bot]
d79e4a6571 Merge pull request #2527 from deltachat/dependabot/cargo/thiserror-1.0.26 2021-08-07 15:19:23 +00:00
dependabot[bot]
cadc0b2c00 Merge pull request #2585 from deltachat/dependabot/cargo/serde-1.0.127 2021-08-07 15:04:32 +00:00
dependabot[bot]
87071e6d4b cargo: bump thiserror from 1.0.25 to 1.0.26
Bumps [thiserror](https://github.com/dtolnay/thiserror) from 1.0.25 to 1.0.26.
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/1.0.25...1.0.26)

---
updated-dependencies:
- dependency-name: thiserror
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-07 14:49:28 +00:00
dependabot[bot]
057b004553 cargo: bump serde from 1.0.126 to 1.0.127
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.126 to 1.0.127.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.126...v1.0.127)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-07 14:45:51 +00: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
Michael Mc Donnell
ee44a162b6 Skip Gmail labels
Gmail labels are not folders and should be skipped. For example, emails
appear in the inbox and under "All Mail" as soon as it is received. The
code used to wrongly conclude that the email had already been moved and
left it in the inbox.
2021-08-04 01:11:35 +03:00
bjoern
c09a83df2b prepare 1.58 (#2584)
* update changelog for 1.58.0

* bump version to 1.58.0
2021-08-02 21:55:32 +02:00
bjoern
8729d2c4aa also move WAL file when moving database (#2583)
the WAL files come from sqlite WAL mode,
they have the same name as the database file with an extra `-wal` suffix.

according to https://sqlite.org/wal.html#the_wal_file ,
the WAL file is part of the persistent state of the database
and should be kept with the database if the database is copied or moved.
2021-08-02 20:43:46 +02:00
gerryfrancis
fdf3397437 Too many words (#2582) 2021-08-02 15:31:41 +02:00
bjoern
3712524765 prepare 1.57 (#2580)
* update changelog for 1.57.0

* bump version to 1.57.0
2021-08-01 21:08:08 +02:00
Jikstra
0b5c4df432 Add -DCMAKE_INSTALL_PREFIX flag example to README 2021-08-01 17:01:07 +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
TsT
c380647c12 anchor link fix (#2569) 2021-07-29 19:57:06 +02:00
Friedel Ziegelmayer
e22a9999d7 fix(message): make markseen_msgs async compatible
Otherwise this method can not be called from an actually spawned async method, as `PreparedStatement` is `!Send`
2021-07-29 15:47:52 +02:00
bjoern
57870ec54a remove archived count suffix (#2566)
"Archived Chats" also contain old contact requests now
(an maybe new one if the user archives them),
so, there may be easily some thousands chats in "Archived Chats" -
and the count has no real meaning to the user,
esp. as we not even display the number of "Real Chats".

Might be that this "Link" will go away anyway sooner or later,
however, for now, it is just fine to remove the badge counter.
2021-07-28 17:53:12 +02:00
bjoern
a6e1dc4f16 update provider database (#2565)
ran ./src/provider/update.py ../provider-db/_providers/ > src/provider/data.rs
to pull in recent changes from https://github.com/deltachat/provider-db
2021-07-28 15:22:02 +02:00
holger krekel
fc441d4a44 hide URL for test account creation (#2560)
* hide URL for test account creation

* Update python/README.rst

Co-authored-by: bjoern <r10s@b44t.com>
2021-07-28 15:13:20 +02:00
bjoern
9a77a7b66f fix archiving requests (#2563)
* add a test for archived requests

* fix archived requests

* move requests but the last one to "Archived Chats"

this way, the app looks familiar after the contact request upgrade.
the subselect was copied from the old get_last_deaddrop_fresh_msg()
(which was removed by the contact request upgrade #2514)

* just move all old requests to "Archived Chats"

ux-wise, the advantage of keeping the last one is questionable,
one may think, always the last one is shown in chatlist.

showing _all_ fresh request is not doable
as past cores did not really take care of that
and the db-state is not consistent in that regard.

that would make the already complicated code even more complicated,
so we decided to go the easy way.
2021-07-28 14:56:54 +02: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
Robert Schütz
0691aa3d2c add back unwrap_or_else() 2021-07-26 01:57:47 +03:00
Robert Schütz
ef9fbf9eba allow installing lib and include under different prefixes 2021-07-26 01:57:47 +03:00
Jikstra
3647aac4e6 Add information about system wide libdeltachat 2021-07-26 00:04:02 +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
dependabot[bot]
5c36b6e119 Merge pull request #2523 from deltachat/dependabot/cargo/indexmap-1.7.0 2021-07-23 23:59:43 +00:00
dependabot[bot]
cd0da723ce cargo: bump indexmap from 1.6.2 to 1.7.0
Bumps [indexmap](https://github.com/bluss/indexmap) from 1.6.2 to 1.7.0.
- [Release notes](https://github.com/bluss/indexmap/releases)
- [Commits](https://github.com/bluss/indexmap/compare/1.6.2...1.7.0)

---
updated-dependencies:
- dependency-name: indexmap
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-23 23:16:08 +00:00
dependabot[bot]
49fc72fa42 cargo: bump libc from 0.2.97 to 0.2.98
Bumps [libc](https://github.com/rust-lang/libc) from 0.2.97 to 0.2.98.
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Commits](https://github.com/rust-lang/libc/compare/0.2.97...0.2.98)

---
updated-dependencies:
- dependency-name: libc
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-23 23:15:57 +00:00
dependabot[bot]
a1aaa1e0b4 Merge pull request #2555 from deltachat/dependabot/cargo/futures-0.3.16 2021-07-23 23:12:44 +00:00
dependabot[bot]
1eab99df56 Merge pull request #2531 from deltachat/dependabot/cargo/anyhow-1.0.42 2021-07-23 23:12:10 +00:00
dependabot[bot]
d9caf5853d Merge pull request #2546 from deltachat/dependabot/cargo/sha-1-0.9.7 2021-07-23 23:11:45 +00:00
dependabot[bot]
8869c34539 Merge pull request #2554 from deltachat/dependabot/cargo/syn-1.0.74 2021-07-23 23:11:13 +00:00
dependabot[bot]
05bb25c645 cargo: bump futures from 0.3.15 to 0.3.16
Bumps [futures](https://github.com/rust-lang/futures-rs) from 0.3.15 to 0.3.16.
- [Release notes](https://github.com/rust-lang/futures-rs/releases)
- [Changelog](https://github.com/rust-lang/futures-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/futures-rs/compare/0.3.15...0.3.16)

---
updated-dependencies:
- dependency-name: futures
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-23 21:11:31 +00:00
dependabot[bot]
b340459752 cargo: bump syn from 1.0.73 to 1.0.74
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.73 to 1.0.74.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/1.0.73...1.0.74)

---
updated-dependencies:
- dependency-name: syn
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-22 21:10:25 +00:00
bjoern
980d2a9433 add dc_accounts_maybe_network_lost() (#2550) 2021-07-22 11:29:51 +02:00
bjoern
5f365b259b tweak connectivity html (#2549)
* escape strings added to html

* use more common emojis for connectivity report

all emojis are from 2010 and older now.
an alternative would have been to use css,
however, that may have other issues
and as the whole report is subject to change anyway,
i go for the easy solution.

* use 'modern' meta pattern, remove unused div and styles

* use css instead emojis; looks better that way

also, we have the same look on all systems.

* add connectivity command to repl tool
2021-07-21 23:02:09 +02:00
dependabot[bot]
b070198063 cargo: bump sha-1 from 0.9.6 to 0.9.7
Bumps [sha-1](https://github.com/RustCrypto/hashes) from 0.9.6 to 0.9.7.
- [Release notes](https://github.com/RustCrypto/hashes/releases)
- [Commits](https://github.com/RustCrypto/hashes/compare/sha-1-v0.9.6...sha-1-v0.9.7)

---
updated-dependencies:
- dependency-name: sha-1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-19 21:13:09 +00:00
Hocuri
6e7f63dba7 Fix which chats messages are assigned to (#2465)
fix https://github.com/deltachat/deltachat-core-rust/issues/2463
fix #2116

The email could be private (i.e. only sent to me) or non-private (i.e. also sent to sb else). Also, it could be a classical email or a chat message. Below, I'm describing for each of the four combinations whether they should be assigned to a chat by create_or_lookup_group() or lookup_chat_by_reply(). Because I needed to use these function names a lot, I shortened them to l:group() and l:by_reply() in this PR description.

(!) means todo, (! -> Done) means I fixed something.

## Private classical email: 
l:group() and l:by_reply() must both take care not to put it into group
l:group() no (! -> Done), l:by_reply no (! -> Done)
except for classical MUA replies to two-member-groups, they should be put into the parent group

### wrt alias-support:

A private classical email is very probably not going to be an answer to email that went to an alias address:

Suppose Alice writes to support@example.com.
support@example.com forwards to bob@example.com and claire@example.com.
When Bob answers, he will _probably_ answer `To: alice@example.com, support@example.com` (=> it's a non-private classical email).

With this PR, if he does only answer `To: alice@example.com`, (=> it's a private classical email), Alice's DC will show the answer in the private chat with Bob. Which actually makes more sense than showing it in the support@example.com chat I think. Also, if it was shown in the support@example.com chat, then Alice would answer in the support@example.com chat, then Claire would get Alice's message but not Bob's and therefore miss some context.
That being said - **I could change this**. Pretty easily actually, I would just have to remove the call to `is_probably_private_reply()` from `lookup_chat_by_reply()`. Didn't think through all edge cases yet, but should work.

## Private chat message:
l:group() has to put private chat messages into the group: It won't mistakenly put a message there (because it can rely on Chat-Group-Id). Currently, `is_probably_private_reply()` returns true for private chat messages, but l:group still has to put them into the group chat. (it's not nice that the function called is_probably_private_reply returns true for all private chat messages, but I didn't find any nicer solution) l:by_reply() must not assign it to sth special
l:group yes, l:by_reply no

By the way, for chat messages, `try_getting_grpid()` doesn't look at InReplyTo or References, in order not to put private chat-message replies into the group chat.

For alias-support, the same goes as for the private classical emails.

## Non-private classical email:
Just put it into any group, and if there is none, create one. 

_Off-topic:
We currently don't look at the recipients lists, which means that a message can easily be assigned to a group although it was not sent to all group members. One day we could somehow compare the recipients list with the members list, but that needs some more discussing (esp. what do we do if they don't match? Create a new group? Show a hint in the UI?) and is nothing for a bug-fixing PR like this one._

l_group yes, l_by_reply yes, even for outgoing messages (! -> Done, this also was the issue reported by @gerryfrancis in the testing group:

Outgoing messages were not put into a chat by In-Reply-To/References, which is correct for chat messages, but for non-private classical outgoing emails, a new ad-hoc group was created everytime.

So, I added this: https://github.com/deltachat/deltachat-core-rust/pull/2465/files#diff-e7606b521f6710ddc6e5236ba5d7eefc917b7ad744b9e71762fd42830c55485bR703-R711)

## Non-private chat message:
Can be put into chat by l:by_reply() because it must be a group message
l:group yes, l:by_reply yes (to make alias support work if the support person uses DC)

Nothing to test or fix here; we have to put chat group messages into the group, which is trivial. And we have to make sure that alias-support works, which already was well tested.
2021-07-19 16:02:11 +02: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
Simon Laux
49acfd90eb update core changelog 2021-07-17 20:06:11 +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
bjoern
188353d581 add in-doc links for DC_EVENT_CONNECTIVITY_CHANGED, list unused param as for the other events (#2542) 2021-07-17 12:39:05 +02:00
Simon Laux
3bd5b7e604 changelog: update to include previous changes (#2532)
* changelog: update to include prevous changes
and use new format/structure

* changelog: capitalize API

* changelog: add a missing pr refernece

* Apply suggestions from code review

Co-authored-by: Hocuri <hocuri@gmx.de>

Co-authored-by: Hocuri <hocuri@gmx.de>
2021-07-15 14:00:36 +02:00
Hendrik Jansen
61e1e18088 Merge pull request #2479 from deltachat/can_send_group_fix
Fix can_send for users not in a group
2021-07-15 11:50:32 +02:00
hendrik
a5065c21af fixed can_send() for users not in group 2021-07-14 23:10:58 +02:00
dependabot[bot]
cd958c6a33 cargo: bump anyhow from 1.0.41 to 1.0.42
Bumps [anyhow](https://github.com/dtolnay/anyhow) from 1.0.41 to 1.0.42.
- [Release notes](https://github.com/dtolnay/anyhow/releases)
- [Commits](https://github.com/dtolnay/anyhow/compare/1.0.41...1.0.42)

---
updated-dependencies:
- dependency-name: anyhow
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-09 21:12:18 +00:00
Hocuri
308403ad99 Connectivity view (instead of spamming the user with error_network when sth fails) (#2319)
See https://support.delta.chat/t/discussion-how-to-show-error-states/1363/10 <!-- comment -->

It turns out that it's pretty easy to distinguish between lots of states (currently Error/NotConnected, Connecting…, Getting new messages… and Connected). What's not that easy is distinguishing between an actual error and no network, because if the server just doesn't respond, it could mean that we don't have network or that we are trying ipv6, but only ipv4 works.

**WRT debouncing:**

Sending of EVENT_CONNECTIVITY_CHANGED is not debounced, but emitted every time one of the 3 threads (Inbox, Mvbox and Sentbox) has a network error, starts fetching data, or is done fetching data.
This means that it is emitted:
- 9 times when dc_maybe_network() is called or we get network connection
- 12 times when we lose network connection

Some measurements: dc_get_connectivity() takes a little more than 1ms (in my measurements back in March), dc_get_connectivity_html() takes 10-20ms. This means that it's no immmediate problem to call them very often, might increase battery drain though. For the UI it may be a lot of work to update the title everytime; at least Android is smart enough to update the title only once.

Possible problems (we don't have to worry about them now I think):
- Due to the scan_folders feature, if the user has lots of folders, the state could be "Connecting..." for quite a long time, generally DC seemed a little unresponsive to me because it took so long for "Connecting..." to go away. Telegram has a state "Updating..." that sometimes comes after "Connecting...".

To be done in other PRs:
- Better handle the case that the password was changed on the server and authenticating fails, see https://github.com/deltachat/deltachat-core-rust/issues/1923 and https://github.com/deltachat/deltachat-core-rust/issues/1768
- maybe event debouncing  (except for "Connected" connectivity events)

fix https://github.com/deltachat/deltachat-android/issues/1760
2021-07-08 22:50:11 +02:00
Sebastian Klähn
599be61566 Merge pull request #2526 from deltachat/fix_2325
Fix #2325 (Stickerforwarding)
2021-07-06 20:50:07 +02:00
Sebastian Klähn
64088f02a2 format 2021-07-06 20:08:40 +02:00
Sebastian Klähn
77aa8b2c3f remove unnecessary function-args 2021-07-06 20:05:18 +02:00
Sebastian Klähn
5bffdc6bbf use ?-operator instead of unwrap() 2021-07-06 20:04:35 +02:00
Sebastian Klähn
350fe06ea9 fix tests 2021-07-06 17:26:16 +02:00
Sebastian Klähn
e100dca348 tests 2021-07-05 22:25:57 +02:00
Sebastian Klähn
f1c4c40aec make fix 2021-07-05 22:25:51 +02: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
B. Petersen
e77651f2f5 clarify docs 2021-06-30 00:02:15 +02:00
B. Petersen
056f3ecf03 remove dc_accounts_import_account() api
in most (all?) UIs, import/export works on an already created account,
so, dc_accounts_import_account() does not really help here -
but adds some noise and confusion
eg. as for the other dc_accounts_t functions,
the corrsponding dc_context_t functions must not be called.

if really a new account is required for import,
it seems to be easier to call add_account() before import.
2021-06-30 00:02:15 +02: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
B. Petersen
15c38ba395 token::save() resultified, doc updated 2021-06-25 23:09:31 +02:00
B. Petersen
70e776e407 refine general dc_check_qr() documentation 2021-06-25 23:09:31 +02:00
B. Petersen
6b5ba35d5b make clippy happy 2021-06-25 23:09:31 +02:00
B. Petersen
7b9e54be56 return unique token for new qr codes
as by reviving qr codes,
there may be more than one token for a chat,
ensure, the most recent token and only one token is returned
by the sql-command for looking up tokens
(used for generating new codes)
2021-06-25 23:09:31 +02:00
B. Petersen
6202f85a6f test withdrawing qr codes 2021-06-25 23:09:31 +02:00
B. Petersen
8ac2bd0298 handle withdraw/revive qr code actions 2021-06-25 23:09:31 +02:00
B. Petersen
3f00a6efbe allow token::save() to handle existing tokens 2021-06-25 23:09:31 +02: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
link2xt
1a830c23b5 Do not hide outgoing messages from contact requests
Normally they should not end up in contact requests, but if they do,
we want to show them. Otherwise it is completely impossible to see
them until the chat is moved out of contact requests.
2021-06-19 17:40:07 +03:00
link2xt
18ace81842 Create chats for outgoing classic mails
Previously chats created by outgoing classic emails went into contact
requests (deaddrop). Outgoing messages are not shown in contact
requests, so created chat was not shown anywhere. With this fix chat
is created both for outgoing classic emails and outgoing chat emails.
2021-06-19 17:40:07 +03:00
link2xt
838957badd Do not hide classic emails from contact requests on setting change
Since classical messages are not deleted when show_emails setting is
set to "0" and remain in the database, they should be shown
somewhere. Otherwise they may reappear later when the setting is
enabled again.
2021-06-19 17:40:07 +03:00
link2xt
f820671d53 Use Auto-Submitted: auto-generated header to identify bots
New `dc_msg_is_bot()` C API and corresponding `Message.is_bot()`
Python API can be used to check if incoming message is sent by a bot,
e.g. to avoid two echo bots replying indefinitely to each other.

"Bot" flag is not set for outgoing messages, but may be set for
BCC-self messages. For now documentation says that `dc_msg_is_bot()`
return value is unspecified for outgoing messages. It can be better
specified later if needed for specific applications, e.g. sharing an
account with a helper bot.
2021-06-19 17:36:20 +03:00
Simon Laux
bf61c16dc1 set_draft message changed event returns now draft's msg id
set_draft message changed event returns now draft msg id
instead of 0
2021-06-19 03:25:18 +03:00
link2xt
96f0e47091 Fix a DC_DESIRED_TEXT_LEN comment typo ("usind") 2021-06-19 03:15:57 +03:00
B. Petersen
514c4bc8a7 test removing the last, seletected account
this just result again in no accounts.
before, get_selected_account() has paniced.
2021-06-19 02:31:57 +03:00
B. Petersen
b53613d1e0 let get_selection_account return an Option<> 2021-06-19 02:31:57 +03:00
B. Petersen
4c4f24fb35 avoid creating a default account, adapt tests
the default account created by dc_accounts_new()
is annoying when doing a migrate/import account;
in this case, you must not forget to remove the default account.
in between you have two account,
and accounts are swiched.

it seems to be better
to just call add_account() on a new account object as needed.
2021-06-19 02:31:57 +03:00
B. Petersen
475fa24876 move links to angle brackets to avoid rustdoc errors 2021-06-19 01:39:04 +03:00
link2xt
cf8736da48 Concourse CI pipeline to replace Circle CI 2021-06-15 00:03:00 +03:00
B. Petersen
a638259c36 add a test to make sure, the selected account is persisted on reopening 2021-06-14 22:07:35 +02:00
link2xt
d821cdf1c8 Improve drafts detection
systemli.org seems not to include Received: header in messages sent to
self, including BCC-self and messages sent to Saved message chat. This
results in all these messages not being displayed on other devices in
multi-device setting. To work around this problem we restrict draft
detection based on Received: header to classical mails.

Delta Chat already implements proper draft detection based on the
\Draft message flag and \Drafts folder flag. However, Thunderbird does
not set \Draft flag when message is stored as "Template". To make
draft detection for Thunderbird more robust, in case Received: header
check is removed altogether later, we check for X-Mozilla-Draft-Info
header which Thunderbird sets both for "Drafts" and "Templates".
2021-06-14 19:34:24 +03:00
dependabot[bot]
62e9fbf68c Merge pull request #2495 from deltachat/dependabot/cargo/once_cell-1.8.0 2021-06-14 14:27:46 +00:00
dependabot[bot]
15664be4f6 cargo: bump once_cell from 1.7.2 to 1.8.0
Bumps [once_cell](https://github.com/matklad/once_cell) from 1.7.2 to 1.8.0.
- [Release notes](https://github.com/matklad/once_cell/releases)
- [Changelog](https://github.com/matklad/once_cell/blob/master/CHANGELOG.md)
- [Commits](https://github.com/matklad/once_cell/compare/v1.7.2...v1.8.0)

---
updated-dependencies:
- dependency-name: once_cell
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-14 08:07:26 +00:00
link2xt
62388514dd chat: make get_msg_cnt() and get_fresh_msg_cnt() work for deaddrop
Also do not count hidden messages in get_msg_cnt().
2021-06-13 23:05:08 +03:00
link2xt
ad7c7e90b3 Resultify Contact::block 2021-06-13 17:30:42 +03:00
Hocuri
b16785bb62 Tweak test 2021-06-12 16:03:55 +02:00
Hocuri
d12d9d94d6 Improve test_migration_flags, add EvTracker to test_utils 2021-06-12 16:03:55 +02:00
B. Petersen
991d15615e fix minor dbversion inconsistencies
probably they come in by the latest sqlx<->rusqlite moves,
however, as they are followed by subsequent migrations,
that should not have been a big bug in the past
(maybe unless the app was killed at a bad moment)
2021-06-12 16:03:55 +02:00
B. Petersen
5dee1efa59 add missing dbversion update 2021-06-12 16:03:55 +02:00
B. Petersen
1870684c43 add a test that catches some cases where dbversion was forgotten to update 2021-06-12 16:03:55 +02:00
dependabot[bot]
1803db2dfe Merge pull request #2488 from deltachat/dependabot/cargo/libc-0.2.97 2021-06-11 22:42:22 +00:00
dependabot[bot]
7fee3d995c Merge pull request #2478 from deltachat/dependabot/cargo/syn-1.0.73 2021-06-11 22:36:25 +00:00
dependabot[bot]
4b62500989 cargo: bump syn from 1.0.72 to 1.0.73
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.72 to 1.0.73.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/1.0.72...1.0.73)

---
updated-dependencies:
- dependency-name: syn
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-11 22:19:21 +00:00
dependabot[bot]
8f2cb1e8ab cargo: bump libc from 0.2.95 to 0.2.97
Bumps [libc](https://github.com/rust-lang/libc) from 0.2.95 to 0.2.97.
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Commits](https://github.com/rust-lang/libc/compare/0.2.95...0.2.97)

---
updated-dependencies:
- dependency-name: libc
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-11 22:19:07 +00:00
dependabot[bot]
72ebd83479 Merge pull request #2477 from deltachat/dependabot/cargo/itertools-0.10.1 2021-06-11 22:17:42 +00:00
dependabot[bot]
2842042304 Merge pull request #2484 from deltachat/dependabot/cargo/anyhow-1.0.41 2021-06-11 22:17:04 +00:00
Hocuri
25fed9ab52 comment 2021-06-11 13:09:22 +02:00
Hocuri
751b9add09 remove unneeded files 2021-06-11 13:09:22 +02:00
Hocuri
b727190da5 test low media quality a little more 2021-06-11 13:09:22 +02:00
Hocuri
368fa9fc44 Test image rotation 2021-06-11 13:09:22 +02:00
B. Petersen
c07c5bb358 create own topic for Voice messages, update year 2021-06-11 13:09:04 +02:00
B. Petersen
67f8fb4b66 update spec to Chat-Content: sticker 2021-06-11 13:09:04 +02:00
B. Petersen
056721b916 update spec to new Chat-User-Avatar usage 2021-06-11 13:09:04 +02:00
B. Petersen
4fe3a80f96 allow stickers with gif-images 2021-06-11 13:08:48 +02:00
B. Petersen
6c530b4c77 test sending and receiving stickers 2021-06-11 13:08:48 +02:00
B. Petersen
c616b65ce4 allow sending stickers via repl tool 2021-06-11 13:08:48 +02:00
dependabot[bot]
50f680a00b cargo: bump anyhow from 1.0.40 to 1.0.41
Bumps [anyhow](https://github.com/dtolnay/anyhow) from 1.0.40 to 1.0.41.
- [Release notes](https://github.com/dtolnay/anyhow/releases)
- [Commits](https://github.com/dtolnay/anyhow/compare/1.0.40...1.0.41)

---
updated-dependencies:
- dependency-name: anyhow
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-11 06:17:13 +00:00
dependabot[bot]
47e0f224ca cargo: bump itertools from 0.10.0 to 0.10.1
Bumps [itertools](https://github.com/rust-itertools/itertools) from 0.10.0 to 0.10.1.
- [Release notes](https://github.com/rust-itertools/itertools/releases)
- [Changelog](https://github.com/rust-itertools/itertools/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-itertools/itertools/compare/v0.10.0...v0.10.1)

---
updated-dependencies:
- dependency-name: itertools
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-10 06:26:18 +00:00
B. Petersen
8b872b7e6f bump version to 1.56.0 2021-06-07 21:55:51 +02:00
B. Petersen
29356a6ca8 update changelog for 1.56.0 2021-06-07 21:55:51 +02:00
link2xt
c5539de4da More robust In-Reply-To parsing
Use `parse_message_id` on the header contents before using it.

Database still stores the raw value.
2021-06-07 21:38:00 +02:00
B. Petersen
b017af78ce update provider database
ran `./src/provider/update.py ../provider-db/_providers/ > src/provider/data.rs`
to pull in recent changes from https://github.com/deltachat/provider-db
2021-06-07 16:19:05 +02:00
Hocuri
3b897eac53 Fix downscaling images (#2469)
* Add failing test

* typo

* Fix the bug
2021-06-07 10:14:03 +02:00
link2xt
d8a3014896 securejoin: display error reason if there is any 2021-06-06 23:53:43 +03:00
dependabot[bot]
4209960c0f Merge pull request #2460 from deltachat/dependabot/cargo/strum-0.21.0 2021-06-06 11:12:09 +00:00
dependabot[bot]
04c8622e94 cargo: bump strum from 0.20.0 to 0.21.0
Bumps [strum](https://github.com/Peternator7/strum) from 0.20.0 to 0.21.0.
- [Release notes](https://github.com/Peternator7/strum/releases)
- [Changelog](https://github.com/Peternator7/strum/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Peternator7/strum/commits)

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-06 07:05:19 +00:00
dependabot[bot]
002e33d28c Merge pull request #2464 from deltachat/dependabot/cargo/strum_macros-0.21.1 2021-06-06 07:03:32 +00:00
dependabot[bot]
35aeda3849 Merge pull request #2466 from deltachat/dependabot/cargo/futures-lite-1.12.0 2021-06-06 07:02:50 +00:00
link2xt
af287ee9a8 Do not allow to delete contacts with ongoing chats
Even if chat has no messages, contacts should not be deleted.
Otherwise chat will reference invalid contact ID which can't be loaded
from the database, resulting in broken contact list in group chats.
2021-06-06 09:50:12 +03:00
link2xt
cc3e8c5117 imap: refactor to always create Imap configured
`Imap` structure is always created in a configured state now. There is
no default value for `ImapConfig` anymore.

Also resultify Scheduler::start() to fail on database errors, for
example if IMAP configuration cannot be read from the database during
`start_io()`. Previosuly errors during reading keys such as
`mvbox_watch` were simply ignored and folders were not watched until
the application is completely restarted, now start_io() will fail and
scheduler will only be started at the next start_io() call which
usually happens when app is brought to the foreground.
2021-06-06 09:49:23 +03:00
dependabot[bot]
1127521923 cargo: bump futures-lite from 1.11.3 to 1.12.0
Bumps [futures-lite](https://github.com/smol-rs/futures-lite) from 1.11.3 to 1.12.0.
- [Release notes](https://github.com/smol-rs/futures-lite/releases)
- [Changelog](https://github.com/smol-rs/futures-lite/blob/master/CHANGELOG.md)
- [Commits](https://github.com/smol-rs/futures-lite/compare/v1.11.3...v1.12.0)

---
updated-dependencies:
- dependency-name: futures-lite
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-04 07:32:19 +00:00
Hocuri
bf7f64d50b Ignore Drafts folder when scanning (#2454)
* Add failing test for #2369

* Completely ignore Drafts folder

fix #2369

* Also ignore messages that have the Draft flag set but are not in the Drafts folder
2021-06-03 21:14:39 +02:00
dependabot[bot]
8380ac28c1 cargo: bump strum_macros from 0.20.1 to 0.21.1
Bumps [strum_macros](https://github.com/Peternator7/strum) from 0.20.1 to 0.21.1.
- [Release notes](https://github.com/Peternator7/strum/releases)
- [Changelog](https://github.com/Peternator7/strum/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Peternator7/strum/commits)

---
updated-dependencies:
- dependency-name: strum_macros
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-03 07:23:26 +00:00
dependabot[bot]
d8ba466c6a Merge pull request #2452 from deltachat/dependabot/cargo/thiserror-1.0.25 2021-05-28 23:06:58 +00:00
dependabot[bot]
0c2a3c8347 Merge pull request #2453 from deltachat/dependabot/cargo/libc-0.2.95 2021-05-28 22:43:59 +00:00
Hocuri
e3e2adeea5 Fix all outgoing messages popping up in selfchat (#2456)
Fix https://github.com/deltachat/deltachat-android/issues/1940, fix https://github.com/deltachat/deltachat-core-rust/issues/2220 (I assume these are the same bug)

The problem was:
- Gmail adds a header `Bcc: <self-address>` to our bcc-self message
- `to_id` was just set to the first recipient, in this case _self_
- it was seen that `to_id` is _self_, so it's a self-sent message
2021-05-28 20:02:46 +02:00
Hocuri
46e901be78 Fix benchmark compile error (#2457) 2021-05-28 18:48:13 +02:00
dependabot[bot]
d899a38d17 cargo: bump libc from 0.2.94 to 0.2.95
Bumps [libc](https://github.com/rust-lang/libc) from 0.2.94 to 0.2.95.
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Commits](https://github.com/rust-lang/libc/compare/0.2.94...0.2.95)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-26 06:30:24 +00:00
dependabot[bot]
b60994b313 cargo: bump thiserror from 1.0.24 to 1.0.25
Bumps [thiserror](https://github.com/dtolnay/thiserror) from 1.0.24 to 1.0.25.
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/1.0.24...1.0.25)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-24 07:55:01 +00:00
link2xt
8b19b6f9fe ci: don't build circleci on branches 2021-05-23 19:34:59 +03:00
link2xt
ea88a567f9 ci: require that tag contains at least 1 character 2021-05-23 19:32:31 +03:00
link2xt
38c23104da ci: build wheels only for tags 2021-05-23 19:30:10 +03:00
link2xt
2a83147d90 tox: fix "test command found but not installed in testenv" warning
Determine architecture from python instead of using sh and uname
2021-05-23 18:40:40 +03:00
link2xt
7e3bfd38f0 scripts: use rust 1.52.1 for docker-coredeps-arm64
Building aarch64 wheels under qemu takes a long time.
rust 1.52.1 includes fix for cargo that may result in
compilation being stuck: https://github.com/rust-lang/cargo/pull/9201
2021-05-23 18:20:54 +03:00
link2xt
8b78e12b36 Set ServerAliveInterval to ping SSH server every 30 seconds
Otherwise connection may be dropped if there is no output for some time.
2021-05-23 13:16:16 +03:00
link2xt
15660f2741 Set ServerAliveInterval to ping SSH server every 30 seconds
Otherwise connection may be dropped if there is no output for some time.
2021-05-23 13:10:24 +03:00
link2xt
03520fbd4b Increase wheel building timeout again 2021-05-23 13:01:21 +03:00
link2xt
b1228cbbe5 ci: increase remote python packaging timeout to 30m 2021-05-23 11:43:30 +03:00
link2xt
09f5b015bb python: support running auditwheels for aarch64 2021-05-23 11:43:30 +03:00
link2xt
67ca93b093 ci: build aarch64 wheels
Also drop python 3.6, aarch64 wheels fail to build there
2021-05-23 10:55:01 +03:00
link2xt
dabf31204c scripts: do not build py310 wheels
There is no py310 cffi wheel yet.
2021-05-23 09:50:24 +03:00
link2xt
c22580e07f scripts: build wheels for python 3.6-3.10
These are all versions supported by manylinux2014 now
2021-05-23 09:26:16 +03:00
link2xt
0028f579b6 Update docker-coredeps to use python3.6
Python 3.5 is removed from the latest manylinux2014 images
2021-05-23 09:24:58 +03:00
link2xt
9522240992 scripts: add docker-coredeps-arm64 2021-05-23 09:05:07 +03:00
link2xt
8ab3415c58 CMakeLists.txt: specify only C language
By default C and CXX are enabled.
This resulted in unnecessary C++ compiler check.
2021-05-22 20:29:02 +03:00
link2xt
e858fca356 dc_receive_imf: add python test for server-side message moving
There was a bugreport for previous versions of DC that BCC-self
messages are not marked as seen if server-side Sieve rule moves them.

This test is an unsuccessful attempt to reproduce the bug,
which was confirmed to be fixed.
2021-05-22 18:53:16 +03:00
link2xt
7d4affcc8d python: disable BCC-self in test_markseen_message_and_mdn
This test checks that MDN is marked as seen on ac1.  Because ac1 also
receives BCC-self, it is possible that event of marking this message
as seen is confused with marking MDN as seen, and the test passes even
if MDN is not marked as seen.  Explicitly disabling BCC-self for ac1
ensures it receives only one message (MDN).

Also start direct_imap as early as possible, before sending the
message. It is possible now, because BCC-self is not sent.
2021-05-22 18:52:55 +03:00
link2xt
60d596bb0e README: remove "remote tests" badge
This CI workflow does not exist anymore.
2021-05-22 16:17:25 +03:00
dependabot[bot]
c57bfde010 Merge pull request #2449 from deltachat/dependabot/cargo/rustyline-8.2.0 2021-05-22 12:37:04 +00:00
dependabot[bot]
afd7e7eaac cargo: bump rustyline from 8.1.0 to 8.2.0
Bumps [rustyline](https://github.com/kkawakam/rustyline) from 8.1.0 to 8.2.0.
- [Release notes](https://github.com/kkawakam/rustyline/releases)
- [Changelog](https://github.com/kkawakam/rustyline/blob/master/History.md)
- [Commits](https://github.com/kkawakam/rustyline/compare/v8.1.0...v8.2.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-21 06:51:43 +00:00
dependabot[bot]
cfc324c95b Merge pull request #2448 from deltachat/dependabot/cargo/rustyline-8.1.0 2021-05-19 23:28:31 +00:00
dependabot[bot]
aa5d6077a8 cargo: bump rustyline from 8.0.0 to 8.1.0
Bumps [rustyline](https://github.com/kkawakam/rustyline) from 8.0.0 to 8.1.0.
- [Release notes](https://github.com/kkawakam/rustyline/releases)
- [Changelog](https://github.com/kkawakam/rustyline/blob/master/History.md)
- [Commits](https://github.com/kkawakam/rustyline/compare/v8.0.0...v8.1.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-19 23:02:42 +00:00
dependabot[bot]
4a2beac6fc Merge pull request #2447 from deltachat/dependabot/cargo/async-std-resolver-0.20.3 2021-05-19 21:37:01 +00:00
dependabot[bot]
b5dc954408 cargo: bump async-std-resolver from 0.20.2 to 0.20.3
Bumps [async-std-resolver](https://github.com/bluejekyll/trust-dns) from 0.20.2 to 0.20.3.
- [Release notes](https://github.com/bluejekyll/trust-dns/releases)
- [Changelog](https://github.com/bluejekyll/trust-dns/blob/v0.20.3/CHANGELOG.md)
- [Commits](https://github.com/bluejekyll/trust-dns/compare/v0.20.2...v0.20.3)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-17 07:48:56 +00:00
Hocuri
a9f5077cf9 Make scan_folders work when inbox is not watched (#2446)
When watch_inbox was off, scan_folders failed and a toast "IMAP operation attempted while it is torn down" was shown.

--

The problem was:

When inbox_watch is off, scan_folders() is called at 244260a978/src/scheduler.rs (L107) but connect_configured() is not called before.



* Add test

* Don't only setup handle, but connect_configured() in scan_folders()
2021-05-16 22:18:38 +02:00
link2xt
09280508bc ci: run python tests on github workers 2021-05-16 16:30:40 +03:00
link2xt
4391835a8d qr: remove outdated comment
The comment referred to using Param::SetLongitude instead of "n".
It was fixed in 6bb0c164f9
2021-05-15 17:15:13 +03:00
dependabot[bot]
05f9ac0583 Merge pull request #2440 from deltachat/dependabot/cargo/sha-1-0.9.6 2021-05-15 01:10:27 +00:00
dependabot[bot]
fd9d632cd6 cargo: bump sha-1 from 0.9.5 to 0.9.6
Bumps [sha-1](https://github.com/RustCrypto/hashes) from 0.9.5 to 0.9.6.
- [Release notes](https://github.com/RustCrypto/hashes/releases)
- [Commits](https://github.com/RustCrypto/hashes/compare/sha-1-v0.9.5...sha-1-v0.9.6)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-15 00:56:03 +00:00
dependabot[bot]
c9e626322b Merge pull request #2439 from deltachat/dependabot/cargo/sha2-0.9.5 2021-05-15 00:54:40 +00:00
dependabot[bot]
f343ec47b4 Merge pull request #2438 from deltachat/dependabot/cargo/futures-0.3.15 2021-05-15 00:49:12 +00:00
dependabot[bot]
efb1534d5c Merge pull request #2441 from deltachat/dependabot/cargo/serde-1.0.126 2021-05-15 00:48:13 +00:00
dependabot[bot]
6ec765cad6 cargo: bump serde from 1.0.125 to 1.0.126
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.125 to 1.0.126.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.125...v1.0.126)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-13 07:02:22 +00:00
dependabot[bot]
372a4ee539 cargo: bump sha2 from 0.9.4 to 0.9.5
Bumps [sha2](https://github.com/RustCrypto/hashes) from 0.9.4 to 0.9.5.
- [Release notes](https://github.com/RustCrypto/hashes/releases)
- [Commits](https://github.com/RustCrypto/hashes/compare/sha2-v0.9.4...sha2-v0.9.5)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-12 06:25:22 +00:00
dependabot[bot]
418b591602 cargo: bump futures from 0.3.14 to 0.3.15
Bumps [futures](https://github.com/rust-lang/futures-rs) from 0.3.14 to 0.3.15.
- [Release notes](https://github.com/rust-lang/futures-rs/releases)
- [Changelog](https://github.com/rust-lang/futures-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/futures-rs/compare/0.3.14...0.3.15)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-12 06:25:14 +00:00
B. Petersen
e387b4f4dd bumb version to 1.55.0 2021-05-11 13:58:46 +02:00
B. Petersen
88a10eaf2c update changelog for 1.55.0 2021-05-11 13:58:46 +02:00
dependabot[bot]
4aae12ead7 Merge pull request #2435 from deltachat/dependabot/cargo/backtrace-0.3.59 2021-05-10 16:21:34 +00:00
dependabot[bot]
89c985120b Merge pull request #2433 from deltachat/dependabot/cargo/url-2.2.2 2021-05-10 16:14:23 +00:00
dependabot[bot]
40bb0616da Merge pull request #2432 from deltachat/dependabot/cargo/rusqlite-0.25.3 2021-05-10 16:10:48 +00:00
dependabot[bot]
2b81c274f1 Merge pull request #2434 from deltachat/dependabot/cargo/escaper-0.1.1 2021-05-10 16:07:42 +00:00
dependabot[bot]
0266b70b23 cargo: bump backtrace from 0.3.58 to 0.3.59
Bumps [backtrace](https://github.com/rust-lang/backtrace-rs) from 0.3.58 to 0.3.59.
- [Release notes](https://github.com/rust-lang/backtrace-rs/releases)
- [Commits](https://github.com/rust-lang/backtrace-rs/compare/0.3.58...0.3.59)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-10 10:30:29 +00:00
dependabot[bot]
9c0d84090e cargo: bump escaper from 0.1.0 to 0.1.1
Bumps [escaper](https://github.com/dignifiedquire/rust-escaper) from 0.1.0 to 0.1.1.
- [Release notes](https://github.com/dignifiedquire/rust-escaper/releases)
- [Commits](https://github.com/dignifiedquire/rust-escaper/compare/0.1.0...0.1.1)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-10 10:30:22 +00:00
dependabot[bot]
baf7e98c1e cargo: bump url from 2.2.1 to 2.2.2
Bumps [url](https://github.com/servo/rust-url) from 2.2.1 to 2.2.2.
- [Release notes](https://github.com/servo/rust-url/releases)
- [Commits](https://github.com/servo/rust-url/compare/v2.2.1...v2.2.2)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-10 10:30:10 +00:00
dependabot[bot]
2d20a81f22 cargo: bump rusqlite from 0.25.1 to 0.25.3
Bumps [rusqlite](https://github.com/rusqlite/rusqlite) from 0.25.1 to 0.25.3.
- [Release notes](https://github.com/rusqlite/rusqlite/releases)
- [Changelog](https://github.com/rusqlite/rusqlite/blob/master/Changelog.md)
- [Commits](https://github.com/rusqlite/rusqlite/compare/v0.25.1...v0.25.3)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-10 10:29:58 +00:00
link2xt
4be4472dfb mimefactory: use format=flowed for read receipt text
This avoids too long lines which are rejected by some spam filters.
2021-05-10 12:07:14 +03:00
link2xt
98c1158cde tox.ini: use py3 env instead of py37
This allows to run `tox `on systems with only a single Python 3
version installed, such as Python 3.9.

CI script scripts/run-python-test.sh specifies `-e py37` explicitly
anyway.
2021-05-10 02:51:06 +03:00
link2xt
3769ad32bd tox.ini: remove outdated comment 2021-05-10 02:49:13 +03:00
Hocuri
1c436777e0 Fix #2429 (message was downloaded multiple times a second), add test (#2430)
The problem was:

If a message has the \Deleted flag set, we ignore it. But we forgot to
update last_uid, so that uid_next was not updated at 47e639b777/src/imap.rs (L730) and the same message was
fetched over and over again.

Fix #2429
2021-05-09 18:43:55 +02:00
link2xt
adac903818 Debloat the binary by using less AsRef arguments
Using `impl AsRef<str>` as the argument instead of `&str` makes it
possible to call the function with `&str`, `String` and other types
that implement `AsRef` trait.

The cost of it is that compiled binary contains mulitple versions of
the same function, one for each variant of types. If function contains
multiple generic `impl AsRef` arguments, the number of versions possibly
compiled into binary grows exponentially with the number of arguments.

Simple way to avoid it is to call `.as_ref()` on the caller side to
convert the argument to `&str`. In most cases even adding a `&` and
relying on `Deref` coercion is sufficient.

This patch changes many functions that accepted `impl AsRef<str>` and
`impl AsRef<Path>` to accept `&str` and `&Path` instead.

In some places `.clone()` calls are removed. Calling `.clone()` on
`String` and passing `String` to a function accepting `impl
AsRef<str>` is completely unnecessary as `&str` reference could be
passed instead. There is no clippy warning against it yet, but
changing argument type to `&str` allowed to find these cases.

The result of debloating is not impressive, several hundred kilobytes
are saved, which is about 3% of the `.so` binary, but the code is
cleaner too.
2021-05-09 16:25:11 +03:00
Hendrik Jansen
03f0659454 Merge pull request #2428 from deltachat/new-branch-test
Correct typo
2021-05-09 11:05:30 +02:00
Hocuri
296c230bc9 Correct typo 2021-05-09 10:27:11 +02:00
link2xt
ffd00978e9 github actions: build windows repl exe 2021-05-08 18:52:01 +03:00
link2xt
a8f58ec2cf deltachat.h: fix a typo 2021-05-07 22:34:17 +03:00
dependabot[bot]
d8a2c05c71 Merge pull request #2421 from deltachat/dependabot/cargo/sha-1-0.9.5 2021-05-07 15:05:33 +00:00
dependabot[bot]
7e4386c197 cargo: bump sha-1 from 0.9.4 to 0.9.5
Bumps [sha-1](https://github.com/RustCrypto/hashes) from 0.9.4 to 0.9.5.
- [Release notes](https://github.com/RustCrypto/hashes/releases)
- [Commits](https://github.com/RustCrypto/hashes/compare/sha-1-v0.9.4...sha-1-v0.9.5)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-07 14:50:54 +00:00
dependabot[bot]
f595264418 Merge pull request #2420 from deltachat/dependabot/cargo/sha2-0.9.4 2021-05-07 14:46:15 +00:00
dependabot[bot]
f3e8f5babc cargo: bump sha2 from 0.9.3 to 0.9.4
Bumps [sha2](https://github.com/RustCrypto/hashes) from 0.9.3 to 0.9.4.
- [Release notes](https://github.com/RustCrypto/hashes/releases)
- [Commits](https://github.com/RustCrypto/hashes/compare/sha2-v0.9.3...sha2-v0.9.4)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-06 08:24:39 +00:00
Floris Bruynooghe
d7b4a5fc9e Move module functions to type methods
This moves the module-level lookup and creation functions to the
types, which make the naming more consistent.  Now the lookup_* get_*
and create_* functions all behave similarly.

Peraps even more important the API of the lookup now allows
distinguishing failure from not found.  This in turn is important to
be able to remove reliance on a ChatId with a 0 or "unset" value.  The
locations where this ChatId(0) is still used is in database queries
which should be solved in an independed commit.
2021-05-04 22:32:05 +02:00
Floris Bruynooghe
be413b20f1 Explicit API for creating chats with blocked status
This introduces the explicit ChatIdBlocked struct to more explicitly
create a chat with a blocked status.  It also adds a common shortcut
to ChatId itself which is more natural to use in many cases.
2021-05-04 22:32:05 +02:00
dependabot[bot]
99d9773b75 Merge pull request #2418 from deltachat/dependabot/cargo/syn-1.0.72 2021-05-04 12:26:12 +00:00
dependabot[bot]
633929b84c cargo: bump syn from 1.0.71 to 1.0.72
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.71 to 1.0.72.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/1.0.71...1.0.72)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-04 08:26:01 +00:00
link2xt
f42da17a78 Simplify SQL error handling (#2415)
* Remove sql::error submodule

Use anyhow errors instead.

* Remove explicit checks for open SQL connection

An error will be thrown anyway during attempt to execute query.

* Don't use `with_conn()` and remove it

* Remove unused `with_conn_async`

* Resultify markseen_msgs
2021-05-03 23:01:06 +03:00
link2xt
d421670477 scripts/set_core_version.py: suggest using annotated tags
According to `git help tag`, annotated tags are meant for releases.

If tags are not annotated, `git describe` ignores them.
2021-05-03 21:47:10 +03:00
B. Petersen
c4f36836d4 clarify tagging hint 2021-05-03 17:19:15 +02:00
bjoern
553f4c4b88 prepare 1.54 (#2412) 2021-05-03 02:50:20 +03:00
link2xt
30c463e0ba Add extension to avatars base64-encoded in headers 2021-05-03 01:32:37 +02:00
link2xt
d5c1e26354 python: list requests as a requirement
It is used in `testplugin.py`.
2021-05-03 00:16:52 +03:00
Hocuri
b7864f232b Compress avatar to below 20k (#2384)
- Currently, group images are compressed as well because it was easier to implement that way.
- Currently, in the unlikely case that the avatar is compressed down to 20x20 pixels but still bigger than 20KB, the user doesn't get any indication of this, the avatar simply isn't changed (at least on Android).

  If we want to change this, the easiest way is probably to let `dc_set_config()` in the ffi call `error!()` if `Selfavatar` can't be set. The same might make sense for some or all other configs. BUUUUUT: At least Android doesn't show error!() toasts anymore, probably because they were used too often and too spammy.
- The factor by which we scale down if the file is too big is 1.5.
2021-05-02 19:54:13 +02:00
link2xt
8e9d8ae1ec Fix disabling of vendoring in CMakeLists.txt 2021-05-02 16:50:41 +03:00
link2xt
f52c23d1c7 ci: remove CIRCLE_* environment variables from scripts
Instead, allow specifying free-form BUILD_ID from the command line.

scripts/remote_python_packaging.sh still uses CIRCLE_ variables to avoid
changing working CircleCI config.
2021-05-02 15:02:30 +03:00
link2xt
957f942872 Cargo.toml: move "rusqlite/bundled" to "vendored" feature
It is enabled from deltachat-ffi/Cargo.toml by default.

Fix for abac35c872
2021-05-02 13:58:39 +02:00
dependabot[bot]
6971bfc3d4 cargo: bump rustyline from 4.1.0 to 8.0.0 (#2402) 2021-05-01 20:39:12 +00:00
link2xt
16dcd712f0 dependabot: allow 10 pull requests
Default of 5 is too small.
2021-05-01 23:31:41 +03:00
dependabot[bot]
9f337e8be5 Merge pull request #2407 from deltachat/dependabot/cargo/mailparse-0.13.4 2021-05-01 20:12:20 +00:00
dependabot[bot]
c4217ea929 Merge pull request #2408 from deltachat/dependabot/cargo/syn-1.0.71 2021-05-01 20:10:00 +00:00
dependabot[bot]
3a742f1d09 cargo: bump syn from 1.0.67 to 1.0.71
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.67 to 1.0.71.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/1.0.67...1.0.71)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-01 19:54:37 +00:00
dependabot[bot]
ae0dbf024d cargo: bump mailparse from 0.13.2 to 0.13.4
Bumps [mailparse](https://github.com/staktrace/mailparse) from 0.13.2 to 0.13.4.
- [Release notes](https://github.com/staktrace/mailparse/releases)
- [Commits](https://github.com/staktrace/mailparse/commits/v0.13.4)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-01 19:54:30 +00:00
link2xt
01d3611f3b check_verified_properties: handle NULL in verified_key_fingerprint
A regression due to switching from/to rusqlite
2021-05-01 22:46:08 +03:00
dependabot[bot]
f1608b503f Merge pull request #2403 from deltachat/dependabot/cargo/dirs-3.0.2 2021-05-01 19:42:06 +00:00
dependabot[bot]
98beb7f40c Merge pull request #2405 from deltachat/dependabot/cargo/syn-1.0.67 2021-05-01 19:40:28 +00:00
dependabot[bot]
574bb8fd7f Merge pull request #2404 from deltachat/dependabot/cargo/regex-1.4.6 2021-05-01 19:39:52 +00:00
dependabot[bot]
f5de2e7684 cargo: bump syn from 1.0.64 to 1.0.67
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.64 to 1.0.67.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/1.0.64...1.0.67)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-01 19:23:55 +00:00
dependabot[bot]
42086ceec5 cargo: bump regex from 1.4.5 to 1.4.6
Bumps [regex](https://github.com/rust-lang/regex) from 1.4.5 to 1.4.6.
- [Release notes](https://github.com/rust-lang/regex/releases)
- [Changelog](https://github.com/rust-lang/regex/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/regex/compare/1.4.5...1.4.6)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-01 19:23:50 +00:00
dependabot[bot]
cfb22c23df cargo: bump dirs from 3.0.1 to 3.0.2
Bumps [dirs](https://github.com/soc/dirs-rs) from 3.0.1 to 3.0.2.
- [Release notes](https://github.com/soc/dirs-rs/releases)
- [Commits](https://github.com/soc/dirs-rs/commits)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-01 19:23:44 +00:00
dependabot[bot]
d49de4b3e4 Merge pull request #2399 from deltachat/dependabot/cargo/futures-0.3.14 2021-05-01 19:19:17 +00:00
dependabot[bot]
540ad71473 cargo: bump futures from 0.3.13 to 0.3.14
Bumps [futures](https://github.com/rust-lang/futures-rs) from 0.3.13 to 0.3.14.
- [Release notes](https://github.com/rust-lang/futures-rs/releases)
- [Changelog](https://github.com/rust-lang/futures-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/futures-rs/compare/0.3.13...0.3.14)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-01 19:02:40 +00:00
dependabot[bot]
b27ad955f8 Merge pull request #2400 from deltachat/dependabot/cargo/async-std-1.9.0 2021-05-01 19:00:44 +00:00
link2xt
5546ed772e cargo: update stop-token and async-imap 2021-05-01 21:41:02 +03:00
dependabot[bot]
23e891f051 cargo: bump async-std from 1.8.0 to 1.9.0
Bumps [async-std](https://github.com/async-rs/async-std) from 1.8.0 to 1.9.0.
- [Release notes](https://github.com/async-rs/async-std/releases)
- [Changelog](https://github.com/async-rs/async-std/blob/master/CHANGELOG.md)
- [Commits](https://github.com/async-rs/async-std/compare/v1.8.0...v1.9.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-01 18:39:33 +00:00
dependabot[bot]
7dd5b05a00 cargo: bump backtrace from 0.3.56 to 0.3.58
Bumps [backtrace](https://github.com/rust-lang/backtrace-rs) from 0.3.56 to 0.3.58.
- [Release notes](https://github.com/rust-lang/backtrace-rs/releases)
- [Commits](https://github.com/rust-lang/backtrace-rs/compare/0.3.56...0.3.58)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-01 21:38:04 +03:00
dependabot[bot]
b7d274e0f9 cargo: bump async-std-resolver from 0.19.7 to 0.20.2
Bumps [async-std-resolver](https://github.com/bluejekyll/trust-dns) from 0.19.7 to 0.20.2.
- [Release notes](https://github.com/bluejekyll/trust-dns/releases)
- [Changelog](https://github.com/bluejekyll/trust-dns/blob/main/CHANGELOG.md)
- [Commits](https://github.com/bluejekyll/trust-dns/compare/v0.19.7...v0.20.2)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-01 21:37:43 +03:00
dependabot[bot]
437b7ef1f1 cargo: bump anyhow from 1.0.39 to 1.0.40
Bumps [anyhow](https://github.com/dtolnay/anyhow) from 1.0.39 to 1.0.40.
- [Release notes](https://github.com/dtolnay/anyhow/releases)
- [Commits](https://github.com/dtolnay/anyhow/compare/1.0.39...1.0.40)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-01 21:25:03 +03:00
dependabot[bot]
6934947d0d cargo: bump pretty_assertions from 0.6.1 to 0.7.2
Bumps [pretty_assertions](https://github.com/colin-kiegel/rust-pretty-assertions) from 0.6.1 to 0.7.2.
- [Release notes](https://github.com/colin-kiegel/rust-pretty-assertions/releases)
- [Changelog](https://github.com/colin-kiegel/rust-pretty-assertions/blob/main/CHANGELOG.md)
- [Commits](https://github.com/colin-kiegel/rust-pretty-assertions/compare/v0.6.1...v0.7.2)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-01 19:53:26 +03:00
dependabot[bot]
d920ec96fa cargo: bump proptest from 0.10.1 to 1.0.0
Bumps [proptest](https://github.com/altsysrq/proptest) from 0.10.1 to 1.0.0.
- [Release notes](https://github.com/altsysrq/proptest/releases)
- [Changelog](https://github.com/AltSysrq/proptest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/altsysrq/proptest/compare/v0.10.1...1.0.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-01 19:53:11 +03:00
dependabot[bot]
ebfeec8907 cargo: bump async-trait from 0.1.48 to 0.1.50
Bumps [async-trait](https://github.com/dtolnay/async-trait) from 0.1.48 to 0.1.50.
- [Release notes](https://github.com/dtolnay/async-trait/releases)
- [Commits](https://github.com/dtolnay/async-trait/compare/0.1.48...0.1.50)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-01 19:49:45 +03:00
dependabot[bot]
6d064dca84 cargo: bump quick-xml from 0.18.1 to 0.22.0
Bumps [quick-xml](https://github.com/tafia/quick-xml) from 0.18.1 to 0.22.0.
- [Release notes](https://github.com/tafia/quick-xml/releases)
- [Changelog](https://github.com/tafia/quick-xml/blob/master/Changelog.md)
- [Commits](https://github.com/tafia/quick-xml/compare/v0.18.1...v0.22.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-01 19:46:50 +03:00
dependabot[bot]
2c2fad6f28 Merge pull request #2391 from deltachat/dependabot/cargo/kamadak-exif-0.5.4 2021-05-01 16:37:21 +00:00
link2xt
60b4f3f21a chat: use anyhow::Result to avoid repeating , Error> 2021-05-01 19:29:17 +03:00
dependabot[bot]
c128e54896 cargo: bump kamadak-exif from 0.5.3 to 0.5.4
Bumps [kamadak-exif](https://github.com/kamadak/exif-rs) from 0.5.3 to 0.5.4.
- [Release notes](https://github.com/kamadak/exif-rs/releases)
- [Commits](https://github.com/kamadak/exif-rs/compare/0.5.3...0.5.4)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-01 16:12:17 +00:00
link2xt
0ea6f72624 github: add Dependabot configuration
Configuration file is documented at https://docs.github.com/en/code-security/supply-chain-security/enabling-and-disabling-version-updates
2021-05-01 19:10:51 +03:00
link2xt
855b6b18fd contact: synchronize status between devices
This feature is similar to existing avatar synchronization.

Whenever encrypted BCC-to-self copy of chat message is received, status
setting is updated with the signature of the message.
2021-05-01 19:08:06 +03:00
link2xt
abac35c872 Make it possible to disable bundled SQLite
Also disable it in CMakeLists.txt which is used to install libdeltachat
system-wide.
2021-05-01 19:07:25 +03:00
link2xt
17ad4e99ee Update rusqlite from 0.24 to 0.25 2021-05-01 19:07:25 +03:00
link2xt
c5aef03008 Update changelog 2021-05-01 17:05:18 +03:00
link2xt
c7f2a43654 Update changelog 2021-05-01 15:27:08 +03:00
Simon Laux
19176d9d47 add "Forwarded:" to summary2,
this affects notifications and the chatlist
2021-05-01 15:08:27 +03:00
link2xt
db1a7023eb scripts: remove old/run-python.sh
It is replaced by scripts/run_all.sh
2021-05-01 15:04:07 +03:00
link2xt
ae31b5895b Remove old/gh-actions-rust.yml 2021-05-01 14:54:59 +03:00
link2xt
35b6dd797d tox.ini: pin breathe version
Python 3.5 compatibility is broken in the latest version.
2021-05-01 14:45:19 +03:00
link2xt
1d708de82f docker-coredeps: update to manylinux2014
Rust does not work on manylinux2010 due to old GNU C Library.

We have been using manylinux2014 on CI machine already, but this change
was never commited.
2021-05-01 14:20:37 +03:00
B. Petersen
f7139331e7 test that the correct headers are moved 2021-05-01 07:40:56 +03:00
link2xt
131651cc02 base64-encode avatar into the hidden header 2021-05-01 07:40:56 +03:00
link2xt
bba437523a Process Chat-User-Avatar headers with embedded base64 images 2021-05-01 07:40:56 +03:00
link2xt
f76bc44cdc mimeparser: parse hidden headers 2021-05-01 07:40:56 +03:00
link2xt
f6eb169c60 mimefactory: implement hidden headers 2021-05-01 07:40:56 +03:00
link2xt
e15ec2eb7a mimefactory: create MessageHeaders structure 2021-05-01 07:40:56 +03:00
link2xt
b3b46688fc Better comments for protected_headers and unprotected_headers
Make it clear that protected_headers are protected only
opportunistically and will go into IMF header section if the message
is not encrypted.
2021-05-01 07:40:56 +03:00
link2xt
9faf4a5fa7 python: remove unused imports 2021-04-30 10:56:27 +03:00
Robert Schütz
628c30f130 python: fix build against system library 2021-04-30 10:35:42 +03:00
B. Petersen
f40b557454 add tests for marknoticed_chat(), markseen_msgs() and get_state() 2021-04-26 23:15:26 +02:00
B. Petersen
e1b9e8f2c9 stop more times in repl tool 2021-04-26 23:15:26 +02:00
B. Petersen
65c17cfea2 dc_markseen_msgs() should not handle deaddrop
messages are marked as 'noticed' already when the chat is opened
as all UIs call dc_marknoticed_chat();

also marking messages as 'noticed' when dc_markseen_msgs() is called
is not needed therefore - but stands in the way of further improvements
for the deaddrop, eg. UI may let the user decide when the deaddrop
can be removed from chatlist ('All done' button or so)
2021-04-26 23:15:26 +02:00
B. Petersen
39d3a594af let dc_marknoticed_chat() also handle the virtual deaddrop chat 2021-04-26 23:15:26 +02:00
link2xt
949e671d9c ci: fail on cargo check warnings 2021-04-26 01:11:32 +03:00
link2xt
eef51f064a sql: set PRAGMA synchronous=normal
It was set in `sqlx` code, but not in `rusqlite` mode.

synchronous=FULL makes benchmark that write to the database a lot slower.
2021-04-25 23:44:16 +03:00
B. Petersen
143c5e6249 re-add test_db_reopen() for rusqlite
so that we do not forget about that test
and the issues we had with that :)
2021-04-25 22:33:14 +03:00
link2xt
8610b0c945 sql: switch from sqlx to rusqlite 2021-04-25 22:33:14 +03:00
link2xt
d179dced4e Get rid of mod.rs files.
Since Rust 2018 [1] it is no longer required to move module code to
`mod.rs` when submodules are added. This eliminates common problem of
having multiple buffers named `mod.rs` in editor.

[1] https://doc.rust-lang.org/edition-guide/rust-2018/module-system/path-clarity.html#no-more-modrs
2021-04-23 22:45:45 +03:00
link2xt
1dc055fb66 cargo update -p sqlx 2021-04-23 00:00:00 +00:00
Hocuri
819775ac39 Revert "More logging for "core spams imap events""
This reverts commit 5394327bf6.
2021-04-23 09:15:15 +02:00
277 changed files with 48046 additions and 21815 deletions

View File

@@ -1,68 +0,0 @@
version: 2.1
executors:
default:
docker:
- image: filecoin/rust:latest
working_directory: /mnt/crate
doxygen:
docker:
- image: hrektts/doxygen
jobs:
build_doxygen:
executor: doxygen
steps:
- checkout
- run: bash scripts/run-doxygen.sh
- run: mkdir -p workspace/c-docs
- run: cp -av deltachat-ffi/{html,xml} workspace/c-docs/
- persist_to_workspace:
root: workspace
paths:
- c-docs
remote_python_packaging:
machine: true
steps:
- checkout
# the following commands on success produces
# workspace/{wheelhouse,py-docs} as artefact directories
- run: bash scripts/remote_python_packaging.sh
- persist_to_workspace:
root: workspace
paths:
# - c-docs
- py-docs
- wheelhouse
upload_docs_wheels:
machine: true
steps:
- checkout
- attach_workspace:
at: workspace
- run: ls -laR workspace
- run: scripts/ci_upload.sh workspace/py-docs workspace/wheelhouse workspace/c-docs
workflows:
version: 2.1
test:
jobs:
- remote_python_packaging:
filters:
branches:
only: master
- upload_docs_wheels:
requires:
- remote_python_packaging
- build_doxygen
filters:
branches:
only: master
- build_doxygen:
filters:
branches:
only: master

9
.github/dependabot.yml vendored Normal file
View File

@@ -0,0 +1,9 @@
version: 2
updates:
- package-ecosystem: "cargo"
directory: "/"
schedule:
interval: "monthly"
commit-message:
prefix: "cargo"
open-pull-requests-limit: 50

26
.github/mergeable.yml vendored Normal file
View File

@@ -0,0 +1,26 @@
version: 2
mergeable:
- when: pull_request.*
name: "Changelog check"
validate:
- do: or
validate:
- do: description
must_include:
regex: '#skip-changelog'
- do: and
validate:
- do: dependent
changed:
file: 'src/**'
required: ['CHANGELOG.md']
- do: dependent
changed:
file: 'deltachat-ffi/**'
required: ['CHANGELOG.md']
fail:
- do: checks
status: 'action_required'
payload:
title: Changelog might need an update
summary: "Check if CHANGELOG.md needs an update or add #skip-changelog to the PR description."

View File

@@ -8,6 +8,9 @@ on:
- staging
- trying
env:
RUSTFLAGS: -Dwarnings
jobs:
fmt:
@@ -18,9 +21,11 @@ jobs:
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.50.0
toolchain: stable
override: true
- run: rustup component add rustfmt
- name: Cache rust cargo artifacts
uses: swatinem/rust-cache@v1
- uses: actions-rs/cargo@v1
with:
command: fmt
@@ -32,13 +37,15 @@ jobs:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.50.0
toolchain: stable
components: clippy
override: true
- name: Cache rust cargo artifacts
uses: swatinem/rust-cache@v1
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --workspace --tests --examples
args: --workspace --tests --examples --benches
docs:
name: Rust doc comments
@@ -65,26 +72,26 @@ jobs:
build_and_test:
name: Build and test
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.experimental }}
strategy:
matrix:
# macOS disabled due to random failures related to caching
#os: [ubuntu-latest, windows-latest, macOS-latest]
os: [ubuntu-latest, windows-latest]
rust: [1.50.0]
experimental: [false]
# include:
# - os: ubuntu-latest
# rust: nightly
# experimental: true
# - os: windows-latest
# rust: nightly
# experimental: true
# - os: macOS-latest
# rust: nightly
# experimental: true
include:
# Currently used Rust version, same as in `rust-toolchain` file.
- os: ubuntu-latest
rust: 1.61.0
python: 3.9
- os: windows-latest
rust: 1.61.0
python: false # Python bindings compilation on Windows is not supported.
# Minimum Supported Rust Version = 1.56.0
#
# Minimum Supported Python Version = 3.7
# This is the minimum version for which manylinux Python wheels are
# built.
- os: ubuntu-latest
rust: 1.56.0
python: 3.7
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@master
@@ -94,32 +101,43 @@ jobs:
toolchain: ${{ matrix.rust }}
override: true
- name: Cache cargo registry
uses: actions/cache@v2
with:
path: ~/.cargo/registry
key: ${{ matrix.os }}-${{ matrix.rust }}-cargo-registry-${{ hashFiles('**/Cargo.toml') }}
- name: Cache cargo index
uses: actions/cache@v2
with:
path: ~/.cargo/git
key: ${{ matrix.os }}-${{ matrix.rust }}-cargo-index-${{ hashFiles('**/Cargo.toml') }}
- name: Cache cargo build
uses: actions/cache@v2
with:
path: target
key: ${{ matrix.os }}-${{ matrix.rust }}-cargo-build-target-${{ hashFiles('**/Cargo.toml') }}
- name: Cache rust cargo artifacts
uses: swatinem/rust-cache@v1
- name: check
uses: actions-rs/cargo@v1
with:
command: check
args: --all --bins --examples --tests --features repl
command: check
args: --all --bins --examples --tests --features repl --benches
- name: tests
uses: actions-rs/cargo@v1
with:
command: test
args: --all
- name: install python
if: ${{ matrix.python }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- name: install tox
if: ${{ matrix.python }}
run: pip install tox
- name: build C library
if: ${{ matrix.python }}
uses: actions-rs/cargo@v1
with:
command: build
args: -p deltachat_ffi
- name: run python tests
if: ${{ matrix.python }}
env:
DCC_NEW_TMP_EMAIL: ${{ secrets.DCC_NEW_TMP_EMAIL }}
DCC_RS_TARGET: debug
DCC_RS_DEV: ${{ github.workspace }}
working-directory: python
run: tox -e lint,mypy,doc,py3

21
.github/workflows/dependabot.yml vendored Normal file
View File

@@ -0,0 +1,21 @@
name: Dependabot auto-approve
on: pull_request
permissions:
pull-requests: write
jobs:
dependabot:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v1.1.1
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Approve a PR
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

View File

@@ -0,0 +1,32 @@
# documentation: https://github.com/deltachat/sysadmin/tree/master/download.delta.chat
name: Delete node PR previews
on:
pull_request:
types: [closed]
jobs:
delete:
runs-on: ubuntu-latest
steps:
- name: Get Pullrequest ID
id: getid
run: |
export PULLREQUEST_ID=$(jq .number < $GITHUB_EVENT_PATH)
echo ::set-output name=prid::$PULLREQUEST_ID
- name: Renaming
run: |
# create empty file to copy it over the outdated deliverable on download.delta.chat
echo "This preview build is outdated and has been removed." > empty
cp empty deltachat-node-${{ steps.getid.outputs.prid }}.tar.gz
- name: Replace builds with dummy files
uses: horochx/deploy-via-scp@v1.0.1
with:
user: ${{ secrets.USERNAME }}
key: ${{ secrets.SSH_KEY }}
host: "download.delta.chat"
port: 22
local: "deltachat-node-${{ steps.getid.outputs.prid }}.tar.gz"
remote: "/var/www/html/download/node/preview/"

34
.github/workflows/node-docs.yml vendored Normal file
View File

@@ -0,0 +1,34 @@
name: Generate & upload node.js documentation
on:
push:
branches:
- master
jobs:
generate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Use Node.js 16.x
uses: actions/setup-node@v1
with:
node-version: 16.x
- name: npm install and generate documentation
run: |
cd node
npm i --ignore-scripts
npx typedoc
mv docs js
- name: Upload
uses: horochx/deploy-via-scp@v1.0.1
with:
user: ${{ secrets.USERNAME }}
key: ${{ secrets.KEY }}
host: "delta.chat"
port: 22
local: "node/js"
remote: "/var/www/html/"

162
.github/workflows/node-package.yml vendored Normal file
View File

@@ -0,0 +1,162 @@
name: 'node.js build'
on:
pull_request:
push:
tags:
- '*'
- '!py-*'
jobs:
prebuild:
name: 'prebuild'
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-18.04, macos-latest, windows-latest]
steps:
- name: Checkout
uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '16'
- name: System info
run: |
rustc -vV
rustup -vV
cargo -vV
npm --version
node --version
- name: Cache node modules
uses: actions/cache@v2
with:
path: |
${{ env.APPDATA }}/npm-cache
~/.npm
key: ${{ matrix.os }}-node-${{ hashFiles('**/package.json') }}
- name: Cache cargo index
uses: actions/cache@v2
with:
path: |
~/.cargo/registry/
~/.cargo/git
target
key: ${{ matrix.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}-2
- name: Install dependencies & build
if: steps.cache.outputs.cache-hit != 'true'
run: |
cd node
npm install --verbose
- name: Build Prebuild
run: |
cd node
npm run prebuildify
tar -zcvf "${{ matrix.os }}.tar.gz" -C prebuilds .
- name: Upload Prebuild
uses: actions/upload-artifact@v1
with:
name: ${{ matrix.os }}
path: node/${{ matrix.os }}.tar.gz
pack-module:
needs: prebuild
name: 'Package deltachat-node and upload to download.delta.chat'
runs-on: ubuntu-18.04
steps:
- name: install tree
run: sudo apt install tree
- name: Checkout
uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '16'
- name: get tag
id: tag
uses: dawidd6/action-get-tag@v1
continue-on-error: true
- name: Get Pullrequest ID
id: prepare
run: |
tag=${{ steps.tag.outputs.tag }}
if [ -z "$tag" ]; then
node -e "console.log('DELTACHAT_NODE_TAR_GZ=deltachat-node-' + '${{ github.ref }}'.split('/')[2] + '.tar.gz')" >> $GITHUB_ENV
else
echo "DELTACHAT_NODE_TAR_GZ=deltachat-node-${{ steps.tag.outputs.tag }}.tar.gz" >> $GITHUB_ENV
echo "No preview will be uploaded this time, but the $tag release"
fi
- name: System info
run: |
rustc -vV
rustup -vV
cargo -vV
npm --version
node --version
echo $DELTACHAT_NODE_TAR_GZ
- name: Download ubuntu prebuild
uses: actions/download-artifact@v1
with:
name: ubuntu-18.04
- name: Download macos prebuild
uses: actions/download-artifact@v1
with:
name: macos-latest
- name: Download windows prebuild
uses: actions/download-artifact@v1
with:
name: windows-latest
- shell: bash
run: |
mkdir node/prebuilds
tar -xvzf ubuntu-18.04/ubuntu-18.04.tar.gz -C node/prebuilds
tar -xvzf macos-latest/macos-latest.tar.gz -C node/prebuilds
tar -xvzf windows-latest/windows-latest.tar.gz -C node/prebuilds
tree node/prebuilds
rm -rf ubuntu-18.04 macos-latest windows-latest
- name: install dependencies without running scripts
run: |
npm install --ignore-scripts
- name: build typescript part
run: |
npm run build:bindings:ts
- name: package
shell: bash
run: |
mv node/README.md README.md
npm pack .
ls -lah
mv $(find deltachat-node-*) $DELTACHAT_NODE_TAR_GZ
- name: Upload Prebuild
uses: actions/upload-artifact@v1
with:
name: deltachat-node.tgz
path: ${{ env.DELTACHAT_NODE_TAR_GZ }}
# Upload to download.delta.chat/node/preview/
- name: Upload deltachat-node preview to download.delta.chat/node/preview/
if: ${{ ! steps.tag.outputs.tag }}
id: upload-preview
shell: bash
run: |
echo -e "${{ secrets.SSH_KEY }}" >__TEMP_INPUT_KEY_FILE
chmod 600 __TEMP_INPUT_KEY_FILE
scp -o StrictHostKeyChecking=no -v -i __TEMP_INPUT_KEY_FILE -P "22" -r $DELTACHAT_NODE_TAR_GZ "${{ secrets.USERNAME }}"@"download.delta.chat":"/var/www/html/download/node/preview/"
continue-on-error: true
- name: "Post links to details"
if: steps.upload-preview.outcome == 'success'
run: node ./node/scripts/postLinksToDetails.js
env:
URL: preview/${{ env.DELTACHAT_NODE_TAR_GZ }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Upload to download.delta.chat/node/
- name: Upload deltachat-node build to download.delta.chat/node/
if: ${{ steps.tag.outputs.tag }}
id: upload
shell: bash
run: |
echo -e "${{ secrets.SSH_KEY }}" >__TEMP_INPUT_KEY_FILE
chmod 600 __TEMP_INPUT_KEY_FILE
scp -o StrictHostKeyChecking=no -v -i __TEMP_INPUT_KEY_FILE -P "22" -r $DELTACHAT_NODE_TAR_GZ "${{ secrets.USERNAME }}"@"download.delta.chat":"/var/www/html/download/node/"

67
.github/workflows/node-tests.yml vendored Normal file
View File

@@ -0,0 +1,67 @@
name: 'node.js tests'
on:
pull_request:
push:
branches:
- master
- staging
- trying
jobs:
tests:
name: 'tests'
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-18.04, macos-latest, windows-latest]
steps:
- name: Checkout
uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '16'
- name: System info
run: |
rustc -vV
rustup -vV
cargo -vV
npm --version
node --version
- name: Cache node modules
uses: actions/cache@v2
with:
path: |
${{ env.APPDATA }}/npm-cache
~/.npm
key: ${{ matrix.os }}-node-${{ hashFiles('**/package.json') }}
- name: Cache cargo index
uses: actions/cache@v2
with:
path: |
~/.cargo/registry/
~/.cargo/git
target
key: ${{ matrix.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}-2
- name: Install dependencies & build
if: steps.cache.outputs.cache-hit != 'true'
run: |
cd node
npm install --verbose
- name: Test
if: runner.os != 'Windows'
run: |
cd node
npm run test
env:
DCC_NEW_TMP_EMAIL: ${{ secrets.DCC_NEW_TMP_EMAIL }}
- name: Run tests on Windows, except lint
if: runner.os == 'Windows'
run: |
cd node
npm run test:mocha
env:
DCC_NEW_TMP_EMAIL: ${{ secrets.DCC_NEW_TMP_EMAIL }}

View File

@@ -1,21 +0,0 @@
name: Remote tests
on: [push]
jobs:
remote_tests_python:
name: Remote Python tests
runs-on: ubuntu-latest
env:
CIRCLE_BRANCH: ${{ github.ref }}
CIRCLE_JOB: remote_tests_python
CIRCLE_BUILD_NUM: ${{ github.run_number }}
DCC_NEW_TMP_EMAIL: ${{ secrets.DCC_NEW_TMP_EMAIL }}
steps:
- uses: actions/checkout@v2
- run: mkdir -m 700 -p ~/.ssh
- run: touch ~/.ssh/id_ed25519
- run: chmod 600 ~/.ssh/id_ed25519
- run: 'echo "$SSH_KEY" | base64 -d > ~/.ssh/id_ed25519'
shell: bash
env:
SSH_KEY: ${{ secrets.SSH_KEY }}
- run: scripts/remote_tests_python.sh

32
.github/workflows/repl.yml vendored Normal file
View File

@@ -0,0 +1,32 @@
# Manually triggered action to build a Windows repl.exe which users can
# download to debug complex bugs.
name: Build Windows REPL .exe
on:
workflow_dispatch:
jobs:
build_repl:
name: Build REPL example
runs-on: windows-latest
steps:
- uses: actions/checkout@master
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: 1.50.0
override: true
- name: build
uses: actions-rs/cargo@v1
with:
command: build
args: --example repl --features repl,vendored
- name: Upload binary
uses: actions/upload-artifact@v2
with:
name: repl.exe
path: 'target/debug/examples/repl.exe'

28
.github/workflows/upload-docs.yml vendored Normal file
View File

@@ -0,0 +1,28 @@
name: Build & Deploy Documentation on rs.delta.chat
on:
push:
branches:
- master
- docs-gh-action
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
- name: Build the documentation with cargo
run: |
cargo doc --package deltachat --no-deps
- name: Upload to rs.delta.chat
uses: up9cloud/action-rsync@v1.3
env:
USER: ${{ secrets.USERNAME }}
KEY: ${{ secrets.KEY }}
HOST: "delta.chat"
SOURCE: "target/doc"
TARGET: "/var/www/html/rs/"

28
.github/workflows/upload-ffi-docs.yml vendored Normal file
View File

@@ -0,0 +1,28 @@
name: Build & Deploy Documentation on cffi.delta.chat
on:
push:
branches:
- master
- docs-gh-action
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
- name: Build the documentation with cargo
run: |
cargo doc --package deltachat_ffi --no-deps
- name: Upload to cffi.delta.chat
uses: up9cloud/action-rsync@v1.3
env:
USER: ${{ secrets.USERNAME }}
KEY: ${{ secrets.KEY }}
HOST: "delta.chat"
SOURCE: "target/doc"
TARGET: "/var/www/html/cffi/"

12
.gitignore vendored
View File

@@ -28,3 +28,15 @@ deltachat-ffi/xml
.rsynclist
coverage/
.DS_Store
.vscode/launch.json
python/accounts.txt
python/all-testaccounts.txt
tmp/
# from deltachat-node
node_modules/
node/build/
node/dist/
node/prebuilds/
node/.nyc_output/

42
.npmignore Normal file
View File

@@ -0,0 +1,42 @@
.circleci/
.gitmodules
node/.nyc_output/
.travis.yml
appveyor.yml
node/build/
node/README.md
rustfmt.toml
spec.md
test-data/
build2/
node_modules
.git
.idea/
.pytest_cache
CMakeLists.txt
README.md
contrib/
node/ci_scripts/
coverage/
node/.circleci
node/appveyor.yml
ci/
ci_scripts/
python/
target
proptest-regressions
deltachat-ffi/Doxyfile
scripts
webxdc.md
standards.md
draft/
node/examples/
# deltachat-core-rust/assets # don't exclude assets, otherwise it won't build
node/images/
node/test/
node/windows.md
node/*.tar.gz
node/old_docs.md
.vscode/
.github/
node/.prettierrc.yml

1
.npmrc Normal file
View File

@@ -0,0 +1 @@
package-lock=false

View File

@@ -1,4 +1,675 @@
# Changelog
# Changelog
## Unreleased
### Changes
### Fixes
## 1.86.0
### API-Changes
- python: added optional `closed` parameter to `Account` constructor #3394
- python: added optional `passphrase` parameter to `Account.export_all()` and `Account.import_all()` #3394
- python: added `Account.open()` #3394
- python: added `Chat.is_single()` #3394
- python: added `Chat.is_mailinglist()` #3394
- python: added `Chat.is_broadcast()` #3394
- python: added `Chat.is_multiuser()` #3394
- python: added `Chat.is_self_talk()` #3394
- python: added `Chat.is_device_talk()` #3394
- python: added `Chat.is_pinned()` #3394
- python: added `Chat.pin()` #3394
- python: added `Chat.unpin()` #3394
- python: added `Chat.archive()` #3394
- python: added `Chat.unarchive()` #3394
- python: added `Message.get_summarytext()` #3394
- python: added optional `closed` parameter to `ACFactory.get_unconfigured_account()` (pytest plugin) #3394
- python: added optional `passphrase` parameter to `ACFactory.get_pseudo_configured_account()` (pytest plugin) #3394
### Changes
- clean up series of webxdc info messages;
`DC_EVENT_MSGS_CHANGED` is emitted on changes of existing info messages #3395
- update provider database #3399
- refactorings #3375 #3403 #3398 #3404
### Fixes
- do not reset our database if imported backup cannot be decrypted #3397
- node: remove `npx` from build script, this broke flathub build #3396
## 1.85.0
### Changes
- refactorings #3373 #3345 #3380 #3382
- node: move split2 to devDependencies
- python: build Python 3.10 wheels #3392
- update Rust dependencies
### Fixes
- delete outgoing MDNs found in the Sent folder on Gmail #3372
- fix searching one-to-one chats #3377
- do not add legacy info-messages on resending webxdc #3389
## 1.84.0
### Changes
- refactorings #3354 #3347 #3353 #3346
### Fixes
- do not unnecessarily SELECT folders if there are no operations planned on
them #3333
- trim chat encryption info #3350
- fix failure to decrypt first message to self after key synchronization
via Autocrypt Setup Message #3352
- Keep pgp key when you change your own email address #3351
- Do not ignore Sent and Spam folders on Gmail #3369
- handle decryption errors explicitly and don't get confused by encrypted mail attachments #3374
## 1.83.0
### Fixes
- fix node prebuild & package ci #3337
## 1.82.0
### API-Changes
- re-add removed `DC_MSG_ID_MARKER1` as in use on iOS #3330
### Changes
- refactorings #3328
### Fixes
- fix node package ci #3331
- fix race condition in ongoing process (import/export, configuration) allocation #3322
## 1.81.0
### API-Changes
- deprecate unused `marker1before` argument of `dc_get_chat_msgs`
and remove `DC_MSG_ID_MARKER1` constant #3274
### Changes
- now the node-bindings are also part of this repository 🎉 #3283
- support `source_code_url` from Webxdc manifests #3314
- support Webxdc document names and add `document` to `dc_msg_get_webxdc_info()` #3317 #3324
- improve chat encryption info, make it easier to find contacts without keys #3318
- improve error reporting when creating a folder fails #3325
- node: remove unmaintained coverage scripts
- send normal messages with higher priority than MDNs #3243
- make Scheduler stateless #3302
- abort instead of unwinding on panic #3259
- improve python bindings #3297 #3298
- improve documentation #3307 #3306 #3309 #3319 #3321
- refactorings #3304 #3303 #3323
### Fixes
- node: throw error when getting context with an invalid account id
- node: throw error when instanciating a wrapper class on `null` (Context, Message, Chat, ChatList and so on)
- use same contact-color if email address differ only in upper-/lowercase #3327
- repair encrypted mails "mixed up" by Google Workspace "Append footer" function #3315
## 1.80.0
### Changes
- update provider database #3284
- improve python bindings, tests and ci #3287 #3286 #3287 #3289 #3290 #3292
### Fixes
- fix escaping in generated QR-code-SVG #3295
## 1.79.0
### Changes
- Send locations in the background regardless of SMTP loop activity #3247
- refactorings #3268
- improve tests and ci #3266 #3271
### Fixes
- simplify `dc_stop_io()` and remove potential panics and race conditions #3273
- fix correct message escaping consisting of a dot in SMTP protocol #3265
## 1.78.0
### API-Changes
- replaced stock string `DC_STR_ONE_MOMENT` by `DC_STR_NOT_CONNECTED` #3222
- add `dc_resend_msgs()` #3238
- `dc_provider_new_from_email()` does no longer do an DNS lookup for checking custom domains,
this is done by `dc_provider_new_from_email_with_dns()` now #3256
### Changes
- introduce multiple self addresses with the "configured" address always being the primary one #2896
- Further improve finding the correct server after logging in #3208
- `get_connectivity_html()` returns HTML as non-scalable #3213
- add update-serial to `DC_EVENT_WEBXDC_STATUS_UPDATE` #3215
- Speed up message receiving via IMAP a bit #3225
- mark messages as seen on IMAP in batches #3223
- remove Received: based draft detection heuristic #3230
- Use pkgconfig for building Python package #2590
- don't start io on unconfigured context #2664
- do not assign group IDs to ad-hoc groups #2798
- dynamic libraries use dylib extension on Darwin #3226
- refactorings #3217 #3219 #3224 #3235 #3239 #3244 #3254
- improve documentation #3214 #3220 #3237
- improve tests and ci #3212 #3233 #3241 #3242 #3252 #3250 #3255 #3260
### Fixes
- Take `delete_device_after` into account when calculating ephemeral loop timeout #3211 #3221
- Fix a bug where a blocked contact could send a contact request #3218
- Make sure, videochat-room-names are always URL-safe #3231
- Try removing account folder multiple times in case of failure #3229
- Ignore messages from all spam folders if there are many #3246
- Hide location-only messages instead of displaying empty bubbles #3248
## 1.77.0
### API changes
- change semantics of `dc_get_webxdc_status_updates()` second parameter
and remove update-id from `DC_EVENT_WEBXDC_STATUS_UPDATE` #3081
### Changes
- add more SMTP logging #3093
- place common headers like `From:` before the large `Autocrypt:` header #3079
- keep track of securejoin joiner status in database to survive restarts #2920
- remove never used `SentboxMove` option #3111
- improve speed by caching config values #3131 #3145
- optimize `markseen_msgs` #3141
- automatically accept chats with outgoing messages #3143
- `dc_receive_imf` refactorings #3154 #3156 #3159
- add index to speedup deletion of expired ephemeral messages #3155
- muted chats stay archived on new messages #3184
- support `min_api` from Webxdc manifests #3206
- do not read whole webxdc file into memory #3109
- improve tests, refactorings #3073 #3096 #3102 #3108 #3139 #3128 #3133 #3142 #3153 #3151 #3174 #3170 #3148 #3179 #3185
- improve documentation #2983 #3112 #3103 #3118 #3120
### Fixes
- speed up loading of chat messages by a factor of 20 #3171 #3194 #3173
- fix an issue where the app crashes when trying to export a backup #3195
- hopefully fix a bug where outgoing messages appear twice with Amazon SES #3077
- do not delete messages without Message-IDs as duplicates #3095
- assign replies from a different email address to the correct chat #3119
- assing outgoing private replies to the correct chat #3177
- start ephemeral timer when seen status is synchronized via IMAP #3122
- do not create empty contact requests with "setup changed" messages;
instead, send a "setup changed" message into all chats we share with the peer #3187
- do not delete duplicate messages on IMAP immediately to accidentally deleting
the last copy #3138
- clear more columns when message expires due to `delete_device_after` setting #3181
- do not try to use stale SMTP connections #3180
- slightly improve finding the correct server after logging in #3207
- retry message sending automatically if loop is not interrupted #3183
- fix a bug where sometimes the file extension of a long filename containing a dot was cropped #3098
## 1.76.0
### Changes
- move messages in batches #3058
- delete messages in batches #3060
- python: remove arbitrary timeouts from tests #3059
- refactorings #3026
### Fixes
- avoid archived, fresh chats #3053
- Also resync UIDs in folders that are not configured #2289
- treat "NO" IMAP response to MOVE and COPY commands as an error #3058
- Fix a bug where messages in the Spam folder created contact requests #3015
- Fix a bug where drafts disappeared after some days #3067
- Parse MS Exchange read receipts and mark the original message as read #3075
- do not retry message sending infinitely in case of permanent SMTP failure #3070
- set message state to failed when retry limit is exceeded #3072
## 1.75.0
### Changes
- optimize `delete_expired_imap_messages()` #3047
## 1.74.0
### Fixes
- avoid reconnection loop when message without Message-ID is marked as seen #3044
## 1.73.0
### API changes
- added `only_fetch_mvbox` config #3028
### Changes
- don't watch Sent folder by default #3025
- use webxdc app name in chatlist/quotes/replies etc. #3027
- make it possible to cancel message sending by removing the message #3034,
this was previosuly removed in 1.71.0 #2939
- synchronize Seen flags only on watched folders to speed up
folder scanning #3041
- remove direct dependency on `byteorder` crate #3031
- refactorings #3023 #3013
- update provider database #3043
- improve documentation #3017 #3018 #3021
### Fixes
- fix splitting off text from webxdc messages #3032
- call slow `delete_expired_imap_messages()` less often #3037
- make synchronization of Seen status more robust in case unsolicited FETCH
result without UID is returned #3022
- fetch Inbox before scanning folders to ensure iOS does
not kill the app before it gets to fetch the Inbox in background #3040
## 1.72.0
### Fixes
- run migrations on backup import #3006
## 1.71.0
### API Changes
- added APIs to handle database passwords: `dc_context_new_closed()`, `dc_context_open()`,
`dc_context_is_open()` and `dc_accounts_add_closed_account()` #2956 #2972
- use second parameter of `dc_imex` to provide backup passphrase #2980
- added `DC_MSG_WEBXDC`, `dc_send_webxdc_status_update()`,
`dc_get_webxdc_status_updates()`, `dc_msg_get_webxdc_blob()`, `dc_msg_get_webxdc_info()`
and `DC_EVENT_WEBXDC_STATUS_UPDATE` #2826 #2971 #2975 #2977 #2979 #2993 #2994 #2998 #3001 #3003
- added `dc_msg_get_parent()` #2984
- added `dc_msg_force_plaintext()` API for bots #2847
- allow removing quotes on drafts `dc_msg_set_quote(msg, NULL)` #2950
- removed `mvbox_watch` option; watching is enabled when `mvbox_move` is enabled #2906
- removed `inbox_watch` option #2922
- deprecated `os_name` in `dc_context_new()`, pass `NULL` or an empty string #2956
### Changes
- start making it possible to write to mailing lists #2736
- add `hop_info` to `dc_get_info()` #2751 #2914 #2923
- add information about whether the database is encrypted or not to `dc_get_info()` #3000
- selfstatus now defaults to empty #2951 #2960
- validate detached cryptographic signatures as used eg. by Thunderbird #2865
- do not change the draft's `msg_id` on updates and sending #2887
- add `imap` table to keep track of message UIDs #2909 #2938
- replace `SendMsgToSmtp` jobs which stored outgoing messages in blobdir with `smtp` SQL table #2939 #2996
- sql: enable `auto_vacuum=INCREMENTAL` #2931
- sql: build rusqlite with sqlcipher #2934
- synchronize Seen status across devices #2942
- `dc_preconfigure_keypair` now takes ascii armored keys instead of base64 #2862
- put removed member in Bcc instead of To in the message about removal #2864
- improve group updates #2889
- re-write the blob filename creation loop #2981
- update provider database (11 Jan 2022) #2959
- python: allow timeout for internal configure tracker API #2967
- python: remove API deprecated in Python 3.10 #2907
- refactorings #2932 #2957 #2947
- improve tests #2863 #2866 #2881 #2908 #2918 #2901 #2973
- improve documentation #2880 #2886 #2895
- improve ci #2919 #2926 #2969 #2999
### Fixes
- fix leaving groups #2929
- fix unread count #2861
- make `add_parts()` not early-exit #2879
- recognize MS Exchange read receipts as read receipts #2890
- create parent directory if creating a new file fails #2978
- save "configured" flag later #2974
- improve log #2928
- `dc_receive_imf`: don't fail on invalid address in the To field #2940
## 1.70.0
### Fixes
- fix: do not abort Param parsing on unknown keys #2856
- fix: execute `Chat-Group-Member-Removed:` even when arriving disordered #2857
## 1.69.0
### Fixes
- fix group-related system messages in multi-device setups #2848
- fix "Google Workspace" (former "G Suite") issues related to bad resolvers #2852
## 1.68.0
### Fixes
- fix chat assignment when forwarding #2843
- fix layout issues with the generated QR code svg #2842
## 1.67.0
### API changes
- `dc_get_securejoin_qr_svg(chat_id)` added #2815
- added stock-strings `DC_STR_SETUP_CONTACT_QR_DESC` and `DC_STR_SECURE_JOIN_GROUP_QR_DESC`
## 1.66.0
### API changes
- `dc_contact_get_last_seen()` added #2823
- python: `Contact.last_seen` added #2823
- removed `DC_STR_NEWGROUPDRAFT`, we don't set draft after creating group anymore #2805
### Changes
- python: add cutil.from_optional_dc_charpointer() #2824
- refactorings #2807 #2822 #2825
## 1.65.0
### Changes
- python: add mypy support and some type hints #2809
### Fixes
- do not disable ephemeral timer when downloading a message partially #2811
- apply existing ephemeral timer also to partially downloaded messages;
after full download, the ephemeral timer starts over #2811
- replace user-visible error on verification failure with warning;
the error is logged to the corresponding chat anyway #2808
## 1.64.0
### Fixes
- add 'waiting for being added to the group' only for group-joins,
not for setup-contact #2797
- prioritize In-Reply-To: and References: headers over group IDs when assigning
messages to chats to fix incorrect assignment of Delta Chat replies to
classic email threads #2795
## 1.63.0
### API changes
- `dc_get_last_error()` added #2788
### Changes
- Optimize Autocrypt gossip #2743
### Fixes
- fix permanently hiding of one-to-one chats after secure-join #2791
## 1.62.0
### API Changes
- `dc_join_securejoin()` now always returns immediately;
the returned chat may not allow sending (`dc_chat_can_send()` returns false)
which may change as usual on `DC_EVENT_CHAT_MODIFIED` #2508 #2767
- introduce multi-device-sync-messages;
as older cores display them as files in self-chat,
they are currently only sent if config option `send_sync_msgs` is set #2669
- add `DC_EVENT_SELFAVATAR_CHANGED` #2742
### Changes
- use system DNS instead of google for MX queries #2780
- improve error logging #2758
- improve tests #2764 #2781
- improve ci #2770
- refactorings #2677 #2728 #2740 #2729 #2766 #2778
### Fixes
- add Let's Encrypt certificate to core as it may be missing older devices #2752
- prioritize certificate setting from user over the one from provider-db #2749
- fix "QR process failed" error #2725
- do not update quota in endless loop #2726
## 1.61.0
### API Changes
- download-on-demand added: `dc_msg_get_download_state()`, `dc_download_full_msg()`
and `download_limit` config option #2631 #2696
- `dc_create_broadcast_list()` and chat type `DC_CHAT_TYPE_BROADCAST` added #2707 #2722
- allow ui-specific configs using `ui.`-prefix in key (`dc_set_config(context, "ui.*", value)`) #2672
- new strings from `DC_STR_PARTIAL_DOWNLOAD_MSG_BODY`
to `DC_STR_PART_OF_TOTAL_USED` #2631 #2694 #2707 #2723
- emit warnings and errors from account manager with account-id 0 #2712
### Changes
- notify about incoming contact requests #2690
- messages are marked as read on first read receipt #2699
- quota warning reappears after import, rewarning at 95% #2702
- lock strict TLS if certificate checks are automatic #2711
- always check certificates strictly when connecting over SOCKS5 in Automatic mode #2657
- `Accounts` is not cloneable anymore #2654 #2658
- update chat/contact data only when there was no newer update #2642
- better detection of mailing list names #2665 #2685
- log all decisions when applying ephemeral timer to chats #2679
- connectivity view now translatable #2694 #2723
- improve Doxygen documentation #2647 #2668 #2684 #2688 #2705
- refactorings #2656 #2659 #2677 #2673 #2678 #2675 #2663 #2692 #2706
- update provider database #2618
### Fixes
- ephemeral timer rollback protection #2693 #2709
- recreate configured folders if they are deleted #2691
- ignore MDNs sent to self #2674
- recognize NDNs that put headers into "message/global-headers" part #2598
- avoid `dc_get_contacts()` returning duplicate contact ids #2591
- do not leak group names on forwarding messages #2719
- in case of smtp-errors, iterate over all addresses to fix ipv6/v4 problems #2720
- fix pkg-config file #2660
- fix "QR process failed" error #2725
## 1.60.0
### Added
- add device message to warn about QUOTA #2621
- add SOCKS5 support #2474 #2620
### Changes
- don't emit multiple events with the same import/export progress number #2639
- reduce message length limit to 5000 chars #2615
### Fixes
- keep event emitter from closing when there are no accounts #2636
## 1.59.0
### Added
- add quota information to `dc_get_connectivity_html()`
### Changes
- refactorings #2592 #2570 #2581
- add 'device chat about' to now existing status #2613
- update provider database #2608
### Fixes
- provider database supports socket=PLAIN and dotless domains now #2604 #2608
- add migrated accounts to events emitter #2607
- fix forwarding quote-only mails #2600
- do not set WantsMdn param for outgoing messages #2603
- set timestamps for system messages #2593
- do not treat gmail labels as folders #2587
- avoid timing problems in `dc_maybe_network_lost()` #2551
- only set smtp to "connected" if the last message was actually sent #2541
## 1.58.0
### Fixes
- move WAL file together with database
and avoid using data if the database was not closed correctly before #2583
## 1.57.0
### API Changes
- breaking change: removed deaddrop chat #2514 #2563
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 an option to accept the chat via
`dc_accept_chat()` should be shown in the UI.
- `dc_accept_chat()`: unblock the chat or accept contact request
- `dc_block_chat()`: block the chat, currently works only for mailing
lists.
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
- breaking change: removed `DC_EVENT_ERROR_NETWORK` and `DC_STR_SERVER_RESPONSE`
Instead, there is a new api `dc_get_connectivity()`
and `dc_get_connectivity_html()`;
`DC_EVENT_CONNECTIVITY_CHANGED` is emitted on changes
- breaking change: removed `dc_accounts_import_account()`
Instead you need to add an account and call `dc_imex(DC_IMEX_IMPORT_BACKUP)`
on its context
- update account api, 2 new methods:
`int dc_all_work_done (dc_context_t* context);`
`int dc_accounts_all_work_done (dc_accounts_t* accounts);`
- add api to check if a message was `Auto-Submitted`
cffi: `int dc_msg_is_bot (const dc_msg_t* msg);`
python: `Message.is_bot()`
- `dc_context_t* dc_accounts_get_selected_account (dc_accounts_t* accounts);`
now returns `NULL` if there is no selected account
- added `dc_accounts_maybe_network_lost()` for systems core cannot find out
connectivity loss on its own (eg. iOS) #2550
### Added
- use Auto-Submitted: auto-generated header to identify bots #2502
- allow sending stickers via repl tool
- chat: make `get_msg_cnt()` and `get_fresh_msg_cnt()` work for deaddrop chat #2493
- withdraw/revive own qr-codes #2512
- add Connectivity view (a better api for getting the connection status) #2319 #2549 #2542
### Changes
- updated spec: new `Chat-User-Avatar` usage, `Chat-Content: sticker`, structure, copyright year #2480
- update documentation #2548 #2561 #2569
- breaking: `Accounts::create` does not also create an default account anymore #2500
- remove "forwarded" from stickers, as the primary way of getting stickers
is by asking a bot and then forwarding them currently #2526
- mimeparser: use mailparse to parse RFC 2231 filenames #2543
- allow email addresses without dot in the domain part #2112
- allow installing lib and include under different prefixes #2558
- remove counter from name provided by `DC_CHAT_ID_ARCHIVED_LINK` #2566
- improve tests #2487 #2491 #2497
- refactorings #2492 #2503 #2504 #2506 #2515 #2520 #2567 #2575 #2577 #2579
- improve ci #2494
- update provider-database #2565
### Removed
- remove `dc_accounts_import_account()` api #2521
- remove `DC_EVENT_ERROR_NETWORK` and `DC_STR_SERVER_RESPONSE` #2319
### Fixes
- allow stickers with gif-images #2481
- fix database migration #2486
- do not count hidden messages in get_msg_cnt(). #2493
- improve drafts detection #2489
- fix panic when removing last, selected account from account manager #2500
- set_draft's message-changed-event returns now draft's msg id instead of 0 #2304
- avoid hiding outgoing classic emails #2505
- fixes for message timestamps #2517
- do not process names, avatars, location XMLs, message signature etc.
for duplicate messages #2513
- fix `can_send` for users not in group #2479
- fix receiving events for accounts added by `dc_accounts_add_account()` #2559
- fix which chats messages are assigned to #2465
- fix: don't create chats when MDNs are received #2578
## 1.56.0
- fix downscaling images #2469
- fix outgoing messages popping up in selfchat #2456
- securejoin: display error reason if there is any #2470
- do not allow deleting contacts with ongoing chats #2458
- fix: ignore drafts folder when scanning #2454
- fix: scan folders also when inbox is not watched #2446
- more robust In-Reply-To parsing #2182
- update dependencies #2441 #2438 #2439 #2440 #2447 #2448 #2449 #2452 #2453 #2460 #2464 #2466
- update provider-database #2471
- refactorings #2459 #2457
- improve tests and ci #2445 #2450 #2451
## 1.55.0
- fix panic when receiving some HTML messages #2434
- fix downloading some messages multiple times #2430
- fix formatting of read receipt texts #2431
- simplify SQL error handling #2415
- explicit rust API for creating chats with blocked status #2282
- debloat the binary by using less AsRef arguments #2425
## 1.54.0
- switch back from `sqlx` to `rusqlite` due to performance regressions #2380 #2381 #2385 #2387
- global search performance improvement #2364 #2365 #2366
- improve SQLite performance with `PRAGMA synchronous=normal` #2382
- python: fix building of bindings against system-wide install of `libdeltachat` #2383 #2385
- python: list `requests` as a requirement #2390
- fix creation of many delete jobs when being offline #2372
- synchronize status between devices #2386
- deaddrop (contact requests) chat improvements #2373
- add "Forwarded:" to notification and chatlist summaries #2310
- place user avatar directly into `Chat-User-Avatar` header #2232 #2384
- improve tests #2360 #2362 #2370 #2377 #2387
- cleanup #2359 #2361 #2374 #2376 #2379 #2388
## 1.53.0

View File

@@ -1,15 +1,38 @@
cmake_minimum_required(VERSION 3.16)
project(deltachat)
project(deltachat LANGUAGES C)
include(GNUInstallDirs)
find_program(CARGO cargo)
if(APPLE)
set(DYNAMIC_EXT "dylib")
elseif(UNIX)
set(DYNAMIC_EXT "so")
else()
set(DYNAMIC_EXT "dll")
endif()
add_custom_command(
OUTPUT
"target/release/libdeltachat.a"
"target/release/libdeltachat.so"
"target/release/libdeltachat.${DYNAMIC_EXT}"
"target/release/pkgconfig/deltachat.pc"
COMMAND PREFIX=${CMAKE_INSTALL_PREFIX} ${CARGO} build --package deltachat_ffi --release
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND
PREFIX=${CMAKE_INSTALL_PREFIX}
LIBDIR=${CMAKE_INSTALL_FULL_LIBDIR}
INCLUDEDIR=${CMAKE_INSTALL_FULL_INCLUDEDIR}
${CARGO} build --release --no-default-features
# Build in `deltachat-ffi` directory instead of using
# `--package deltachat_ffi` to avoid feature resolver version
# "1" bug which makes `--no-default-features` affect only
# `deltachat`, but not `deltachat-ffi` package.
#
# We can't enable version "2" resolver [1] because it is not
# stable yet on rust 1.50.0.
#
# [1] https://doc.rust-lang.org/nightly/cargo/reference/features.html#resolver-version-2-command-line-flags
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/deltachat-ffi
)
add_custom_target(
@@ -17,12 +40,11 @@ add_custom_target(
ALL
DEPENDS
"target/release/libdeltachat.a"
"target/release/libdeltachat.so"
"target/release/libdeltachat.${DYNAMIC_EXT}"
"target/release/pkgconfig/deltachat.pc"
)
include(GNUInstallDirs)
install(FILES "deltachat-ffi/deltachat.h" DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(FILES "target/release/libdeltachat.a" DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(FILES "target/release/libdeltachat.so" DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(FILES "target/release/libdeltachat.${DYNAMIC_EXT}" DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(FILES "target/release/pkgconfig/deltachat.pc" DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)

2287
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,91 +1,96 @@
[package]
name = "deltachat"
version = "1.53.0"
version = "1.86.0"
authors = ["Delta Chat Developers (ML) <delta@codespeak.net>"]
edition = "2018"
edition = "2021"
license = "MPL-2.0"
rust-version = "1.56"
[profile.dev]
debug = 0
panic = 'abort'
[profile.release]
lto = true
panic = 'abort'
[dependencies]
deltachat_derive = { path = "./deltachat_derive" }
ansi_term = { version = "0.12.1", optional = true }
anyhow = "1.0.28"
async-imap = "0.4.0"
async-native-tls = { version = "0.3.3" }
async-smtp = { git = "https://github.com/async-email/async-smtp", rev="2275fd8d13e39b2c58d6605c786ff06ff9e05708" }
async-std-resolver = "0.19.5"
async-std = { version = "~1.8.0", features = ["unstable"] }
async-tar = "0.3.0"
async-trait = "0.1.31"
backtrace = "0.3.33"
anyhow = "1"
async-imap = { git = "https://github.com/async-email/async-imap" }
async-native-tls = { version = "0.3" }
async-smtp = { git = "https://github.com/async-email/async-smtp", branch="master", default-features=false, features = ["smtp-transport", "socks5"] }
async-std-resolver = "0.21"
async-std = { version = "1" }
async-tar = { version = "0.4", default-features=false }
backtrace = "0.3"
base64 = "0.13"
bitflags = "1.1.0"
byteorder = "1.3.1"
charset = "0.1"
chrono = "0.4.6"
dirs = { version = "3.0.1", optional=true }
bitflags = "1.3"
chrono = "0.4"
dirs = { version = "4", optional=true }
email = { git = "https://github.com/deltachat/rust-email", branch = "master" }
encoded-words = { git = "https://github.com/async-email/encoded-words", branch="master" }
escaper = "0.1.0"
futures = "0.3.4"
escaper = "0.1"
futures = "0.3"
hex = "0.4.0"
image = { version = "0.23.5", default-features=false, features = ["gif", "jpeg", "ico", "png", "pnm", "webp", "bmp"] }
indexmap = "1.3.0"
itertools = "0.10.0"
image = { version = "0.24.1", default-features=false, features = ["gif", "jpeg", "ico", "png", "pnm", "webp", "bmp"] }
kamadak-exif = "0.5"
lettre_email = { git = "https://github.com/deltachat/lettre", branch = "master" }
libc = "0.2.51"
log = {version = "0.4.8", optional = true }
mailparse = "0.13.0"
native-tls = "0.2.3"
num_cpus = "1.13.0"
num-derive = "0.3.0"
num-traits = "0.2.6"
once_cell = "1.4.1"
libc = "0.2"
log = {version = "0.4.16", optional = true }
mailparse = "0.13"
native-tls = "0.2"
num_cpus = "1.13"
num-derive = "0.3"
num-traits = "0.2"
once_cell = "1.12.0"
percent-encoding = "2.0"
pgp = { version = "0.7.0", default-features = false }
pretty_env_logger = { version = "0.4.0", optional = true }
quick-xml = "0.18.1"
rand = "0.7.0"
regex = "1.1.6"
rust-hsluv = "0.1.4"
rustyline = { version = "4.1.0", optional = true }
sanitize-filename = "0.3.0"
pgp = { version = "0.7", default-features = false }
pretty_env_logger = { version = "0.4", optional = true }
quick-xml = "0.23"
r2d2 = "0.8"
r2d2_sqlite = "0.20"
rand = "0.7"
regex = "1.5"
rusqlite = { version = "0.27", features = ["sqlcipher"] }
rust-hsluv = "0.1"
rustyline = { version = "9", optional = true }
sanitize-filename = "0.4"
serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] }
sha-1 = "0.9.3"
sha2 = "0.9.0"
smallvec = "1.0.0"
sqlx = { git = "https://github.com/deltachat/sqlx", branch = "master", features = ["runtime-async-std-native-tls", "sqlite"] }
# keep in sync with sqlx
libsqlite3-sys = { version = "0.22.0", default-features = false, features = [ "pkg-config", "vcpkg", "bundled" ] }
stop-token = { version = "0.1.1", features = ["unstable"] }
strum = "0.20.0"
strum_macros = "0.20.1"
surf = { version = "2.0.0-alpha.4", default-features = false, features = ["h1-client"] }
thiserror = "1.0.14"
toml = "0.5.6"
url = "2.1.1"
uuid = { version = "0.8", features = ["serde", "v4"] }
sha-1 = "0.10"
sha2 = "0.10"
smallvec = "1"
strum = "0.24"
strum_macros = "0.24"
surf = { version = "2.3", default-features = false, features = ["h1-client"] }
thiserror = "1"
toml = "0.5"
url = "2"
uuid = { version = "1", features = ["serde", "v4"] }
fast-socks5 = "0.4"
humansize = "1"
qrcodegen = "1.7.0"
tagger = "4.3.3"
textwrap = "0.15.0"
zip = { version = "0.6.2", default-features = false, features = ["deflate"] }
[dev-dependencies]
ansi_term = "0.12.0"
async-std = { version = "1.6.4", features = ["unstable", "attributes"] }
criterion = "0.3"
futures-lite = "1.7.0"
log = "0.4.11"
pretty_assertions = "0.6.1"
pretty_env_logger = "0.4.0"
proptest = "0.10"
tempfile = "3.0"
async-std = { version = "1", features = ["unstable", "attributes"] }
criterion = { version = "0.3.4", features = ["async_std"] }
futures-lite = "1.12"
log = "0.4"
pretty_env_logger = "0.4"
proptest = { version = "1", default-features = false, features = ["std"] }
tempfile = "3"
[workspace]
members = [
"deltachat-ffi",
"deltachat_derive",
]
[[example]]
@@ -111,9 +116,21 @@ harness = false
name = "search_msgs"
harness = false
[[bench]]
name = "receive_emails"
harness = false
[[bench]]
name = "get_chat_msgs"
harness = false
[[bench]]
name = "get_chatlist"
harness = false
[features]
default = []
default = ["vendored"]
internals = []
repl = ["internals", "rustyline", "log", "pretty_env_logger", "ansi_term", "dirs"]
vendored = ["async-native-tls/vendored", "async-smtp/native-tls-vendored"]
vendored = ["async-native-tls/vendored", "async-smtp/native-tls-vendored", "rusqlite/bundled-sqlcipher-vendored-openssl"]
nightly = ["pgp/nightly"]

View File

@@ -3,8 +3,6 @@
> Deltachat-core written in Rust
[![Rust CI](https://github.com/deltachat/deltachat-core-rust/actions/workflows/ci.yml/badge.svg)](https://github.com/deltachat/deltachat-core-rust/actions/workflows/ci.yml)
[![Remote tests](https://github.com/deltachat/deltachat-core-rust/actions/workflows/remote_tests.yml/badge.svg)](https://github.com/deltachat/deltachat-core-rust/actions/workflows/remote_tests.yml)
[![CircleCI](https://circleci.com/gh/deltachat/deltachat-core-rust.svg?style=shield)](https://circleci.com/gh/deltachat/deltachat-core-rust/)
## Installing Rust and Cargo
@@ -14,6 +12,8 @@ To download and install the official compiler for the Rust programming language,
$ curl https://sh.rustup.rs -sSf | sh
```
> On Windows, you may need to also install **Perl** to be able to compile deltachat-core.
## Using the CLI client
Compile and run Delta Chat Core command line utility, using `cargo`:
@@ -81,6 +81,16 @@ For more commands type:
> help
```
## Installing libdeltachat system wide
```
$ git clone https://github.com/deltachat/deltachat-core-rust.git
$ cd deltachat-core-rust
$ cmake -B build . -DCMAKE_INSTALL_PREFIX=/usr
$ cmake --build build
$ sudo cmake --install build
```
## Development
```sh
@@ -117,11 +127,11 @@ $ cargo test -- --ignored
Language bindings are available for:
- [C](https://c.delta.chat)
- [Node.js](https://www.npmjs.com/package/deltachat-node)
- [Python](https://py.delta.chat)
- [Go](https://github.com/deltachat/go-deltachat/)
- [Free Pascal](https://github.com/deltachat/deltachat-fp/)
- **C** \[[📂 source](./deltachat-ffi) | [📚 docs](https://c.delta.chat)\]
- **Node.js** \[[📂 source](./node) | [📦 npm](https://www.npmjs.com/package/deltachat-node) | [📚 docs](https://js.delta.chat)\]
- **Python** \[[📂 source](./python) | [📦 pypi](https://pypi.org/project/deltachat) | [📚 docs](https://py.delta.chat)\]
- **Go** \[[📂 source](https://github.com/deltachat/go-deltachat/)\]
- **Free Pascal** \[[📂 source](https://github.com/deltachat/deltachat-fp/)\]
- **Java** and **Swift** (contained in the Android/iOS repos)
The following "frontend" projects make use of the Rust-library

BIN
assets/icon-broadcast.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

149
assets/icon-broadcast.svg Normal file
View File

@@ -0,0 +1,149 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
enable-background="new 0 0 128 128"
viewBox="0 0 60 60"
version="1.1"
id="svg878"
sodipodi:docname="icon-broadcast.svg"
width="60"
height="60"
inkscape:version="1.0.2 (e86c8708, 2021-01-15)"
inkscape:export-filename="/Users/bpetersen/projects/deltachat-core-rust/assets/icon-broadcast.png"
inkscape:export-xdpi="409.60001"
inkscape:export-ydpi="409.60001">
<metadata
id="metadata884">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs882" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1329"
inkscape:window-height="847"
id="namedview880"
showgrid="false"
inkscape:zoom="5.21875"
inkscape:cx="36.598802"
inkscape:cy="32.191617"
inkscape:window-x="111"
inkscape:window-y="205"
inkscape:window-maximized="0"
inkscape:current-layer="svg878"
inkscape:document-rotation="0" />
<radialGradient
id="c"
cx="65.25"
cy="89"
r="26.440001"
gradientTransform="matrix(0.77611266,0.11996647,-0.18999676,1.2286617,-11.305867,-60.065999)"
gradientUnits="userSpaceOnUse">
<stop
stop-color="#FFC107"
offset="0"
id="stop833" />
<stop
stop-color="#FFBD06"
offset=".3502"
id="stop835" />
<stop
stop-color="#FFB104"
offset=".6938"
id="stop837" />
<stop
stop-color="#FFA000"
offset="1"
id="stop839" />
</radialGradient>
<radialGradient
id="b"
cx="52.5"
cy="19.75"
r="92.975998"
gradientUnits="userSpaceOnUse"
gradientTransform="rotate(45.323856,68.997115,75.979538)">
<stop
stop-color="#EF5350"
offset="0"
id="stop848" />
<stop
stop-color="#EB4F4C"
offset=".246"
id="stop850" />
<stop
stop-color="#E04341"
offset=".4878"
id="stop852" />
<stop
stop-color="#CD302F"
offset=".7272"
id="stop854" />
<stop
stop-color="#C62828"
offset=".8004"
id="stop856" />
<stop
stop-color="#C62828"
offset="1"
id="stop858" />
</radialGradient>
<radialGradient
id="a"
cx="16.979"
cy="92"
r="24.165001"
gradientUnits="userSpaceOnUse"
gradientTransform="rotate(45.323856,68.997115,75.979538)"
xlink:href="#b">
<stop
stop-color="#E0E0E0"
offset="0"
id="stop863" />
<stop
stop-color="#CFCFCF"
offset=".3112"
id="stop865" />
<stop
stop-color="#A4A4A4"
offset=".9228"
id="stop867" />
<stop
stop-color="#9E9E9E"
offset="1"
id="stop869" />
</radialGradient>
<rect
y="0"
x="0"
height="60"
width="60"
id="rect1420"
style="fill:#7cc0bc;fill-opacity:1;stroke:none;stroke-width:1.29077" />
<path
id="path872"
style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.336872;stroke-opacity:1"
d="m 8.6780027,35.573064 0.032831,-11.910176 c 0.00138,-0.476406 0.4881282,-0.794259 0.9235226,-0.604877 l 4.1144877,2.345752 -0.02386,8.656315 -4.1268029,2.122946 C 9.1617452,36.370003 8.6766889,36.049472 8.6780027,35.573064 Z m 5.0469633,-1.508222 0.02386,-8.656314 31.145424,-9.537653 c 0.841472,-0.219211 1.65915,0.41667 1.656755,1.283728 l -0.06929,25.139995 c -0.0024,0.867062 -0.825942,1.500799 -1.663803,1.274581 z m 3.8042,6.892234 C 16.681121,40.104348 16.315444,38.819414 16.69043,37.591308 l 2.252234,-7.347193 c 0.2644,-0.861571 0.845185,-1.567441 1.641953,-1.989251 0.796769,-0.421808 1.706956,-0.509819 2.568531,-0.245419 l 7.263888,2.225804 c 1.775518,0.543235 2.780299,2.432591 2.232297,4.208094 L 30.3971,41.790532 c -0.545627,1.777887 -2.432591,2.780297 -4.208095,2.232298 l -7.263891,-2.225804 c -0.545033,-0.165864 -1.01825,-0.460162 -1.395948,-0.83995 z m 12.377693,-7.976728 c -0.07601,-0.07642 -0.17114,-0.133864 -0.280621,-0.167516 l -7.263891,-2.225803 c -0.233244,-0.07209 -0.421626,0.0013 -0.512275,0.04861 -0.09064,0.0474 -0.25772,0.166033 -0.327435,0.396899 l -2.252234,7.347191 c -0.108166,0.354628 0.09088,0.731541 0.447888,0.842099 l 7.263891,2.225802 c 0.354626,0.108174 0.731539,-0.09088 0.842099,-0.447888 l 2.249845,-7.344814 c 0.07453,-0.245145 0.0014,-0.504991 -0.167267,-0.67458 z" />
</svg>

After

Width:  |  Height:  |  Size: 5.1 KiB

BIN
assets/icon-webxdc.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

181
assets/icon-webxdc.svg Normal file
View File

@@ -0,0 +1,181 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="80mm"
height="297mm"
viewBox="0 0 80 297"
version="1.1"
id="svg71"
inkscape:version="1.0.2 (e86c8708, 2021-01-15)"
sodipodi:docname="icon-webxdc.svg"
inkscape:export-filename="C:\Users\user\OneDrive - BFW-Leipzig\Documents\LogoDC\finalohnerand.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96">
<metadata
id="metadata856">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<sodipodi:namedview
id="namedview73"
pagecolor="#767676"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageshadow="2"
inkscape:pageopacity="0"
inkscape:pagecheckerboard="true"
inkscape:document-units="mm"
showgrid="false"
showborder="false"
inkscape:snap-bbox="true"
inkscape:bbox-paths="true"
inkscape:bbox-nodes="true"
inkscape:snap-bbox-edge-midpoints="true"
inkscape:snap-bbox-midpoints="true"
inkscape:object-paths="true"
inkscape:snap-intersection-paths="true"
inkscape:zoom="1.4142136"
inkscape:cx="-90.271136"
inkscape:cy="-1233.1209"
inkscape:window-width="1864"
inkscape:window-height="1027"
inkscape:window-x="56"
inkscape:window-y="25"
inkscape:window-maximized="1"
inkscape:current-layer="layer1"
inkscape:snap-global="false"
showguides="false"
inkscape:guide-bbox="true"
inkscape:document-rotation="0"
units="px">
<sodipodi:guide
position="-154.76097,641.11689"
orientation="0,-1"
id="guide21118" />
<sodipodi:guide
position="-60.286487,633.36619"
orientation="0,-1"
id="guide21120" />
</sodipodi:namedview>
<defs
id="defs68">
<linearGradient
id="linearGradient4375">
<stop
style="stop-color:#364e59;stop-opacity:1;"
offset="0"
id="stop4377" />
<stop
style="stop-color:#364e59;stop-opacity:0;"
offset="1"
id="stop4379" />
</linearGradient>
</defs>
<g
inkscape:label="Ebene 1"
inkscape:groupmode="layer"
id="layer1">
<rect
style="fill:#1a1a1a;stroke:#000000;stroke-width:0.167903"
id="rect880"
width="79.8321"
height="79.8321"
x="-64.03286"
y="-375.9097"
ry="0" />
<path
inkscape:connector-curvature="0"
id="path3799-2"
d="m -24.089585,-372.59579 c -19.986026,0.24336 -36.196903,16.666 -36.196903,36.67011 0,20.00409 16.210877,36.03233 36.196903,35.78912 19.0024236,-0.076 14.5340713,-10.6146 35.538854,-0.85693 -11.50627538,-17.97454 0.390097,-20.36737 0.658079,-35.81316 0,-20.00411 -16.2108788,-36.03235 -36.196911,-35.78914 z"
style="fill:#364e59;fill-opacity:1;stroke:none;stroke-width:1.93355"
sodipodi:nodetypes="sscccs" />
<path
style="fill:none;stroke:#000000;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M -54.193871,-325.26419 Z"
id="path3846" />
<path
style="fill:none;stroke:#000000;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M -49.397951,-326.67773 Z"
id="path3848" />
<path
style="fill:none;stroke:#000000;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m -49.397951,-326.67773 v 0 0"
id="path3850" />
<path
style="fill:none;stroke:#000000;stroke-width:0.01;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m -51.35133,-325.0334 -7.964067,5.98895 z"
id="path3965" />
<path
inkscape:connector-curvature="0"
id="path11037"
d="m -24.089585,-372.19891 c -19.986026,0.24156 -36.196903,16.54352 -36.196903,36.40062 0,7.86524 2.543315,15.1113 6.857155,20.97971 6.577146,8.94734 11.123515,9.77363 11.123515,9.77363 1.343237,1.78324 10.270932,4.3223 10.270932,4.3223 l 16.791727,-70.86654 -0.468369,-0.33457 c 0.458597,0.26445 0.428277,-0.27515 -8.378035,-0.27515 z"
style="fill:#7cc5cc;fill-opacity:1;stroke:none;stroke-width:1.92643"
sodipodi:nodetypes="sssccccss" />
<path
style="fill:none;stroke:#000000;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M -49.944239,-310.69957 Z"
id="path13674" />
<g
id="g15178"
transform="matrix(0.79975737,0,0,0.79975737,53.088959,-63.716396)">
<rect
style="fill:#364e59;fill-opacity:1;stroke-width:0.01;stroke-miterlimit:4;stroke-dasharray:none"
id="rect15072"
width="29.897917"
height="6.8791666"
x="-334.4964"
y="-154.51025"
transform="rotate(45)" />
<rect
style="fill:#364e59;fill-opacity:1;stroke-width:0.01;stroke-miterlimit:4;stroke-dasharray:none"
id="rect15072-5"
width="29.897917"
height="6.8791666"
x="147.63107"
y="-334.4964"
transform="rotate(-45)"
inkscape:transform-center-x="-0.74835017"
inkscape:transform-center-y="0.37417525" />
</g>
<g
id="g22468"
transform="translate(3.3033974)">
<g
id="g15178-0"
transform="matrix(-0.79975737,0,0,0.79975737,-103.11028,-63.716404)"
style="fill:#7cc5cc;fill-opacity:1">
<rect
style="fill:#7cc5cc;fill-opacity:1;stroke-width:0.01;stroke-miterlimit:4;stroke-dasharray:none"
id="rect15072-2"
width="29.897917"
height="6.8791666"
x="-334.4964"
y="-154.51025"
transform="rotate(45)" />
<rect
style="fill:#7cc5cc;fill-opacity:1;stroke-width:0.01;stroke-miterlimit:4;stroke-dasharray:none"
id="rect15072-5-5"
width="29.897917"
height="6.8791666"
x="147.63107"
y="-334.4964"
transform="rotate(-45)"
inkscape:transform-center-x="-0.74835017"
inkscape:transform-center-y="0.37417525" />
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 6.5 KiB

View File

@@ -0,0 +1,10 @@
<text
xml:space="preserve"
style="font-weight:bold;font-size:24.4118px;line-height:1.25;font-family:sans-serif;fill:#aaaaaa;fill-opacity:1;stroke:none;stroke-width:0.915439"
x="42.325161"
y="23.32255"
id="text72398">get.delta.chat</text>
<path
id="path84310"
style="opacity:0.25;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.915439"
d="M 17.13769,0.00129321 C 7.6753075,0.11650893 0,7.8915283 0,17.362467 c 0,9.47094 7.6753075,17.059745 17.13769,16.944599 8.99669,-0.03598 6.880074,-5.025654 16.824785,-0.405885 -5.447648,-8.510047 0.184241,-9.642482 0.311117,-16.955289 0,-9.4709395 -7.673512,-17.0597453 -17.135895,-16.94459879 z M 17.0769,4.9986797 c 1.84214,0 3.447355,0.253959 4.815003,0.7616693 1.381603,0.5076411 2.072253,1.207862 2.072253,2.0990711 0,0.4286855 -0.167495,0.7836052 -0.50242,1.0656242 -0.334921,0.2819844 -0.724544,0.4237724 -1.171121,0.4237724 -0.641952,0 -1.396532,-0.3909376 -2.261778,-1.169353 C 19.14963,7.3898036 18.402555,6.83791 17.788507,6.5220182 17.188416,6.1950547 16.484552,6.0321266 15.675129,6.0321266 c -1.032717,0 -1.883352,0.1854523 -2.553215,0.5578447 -0.655913,0.372254 -0.98517,0.8460916 -0.98517,1.4214436 0,0.5414792 0.272815,1.0495355 0.817093,1.5233385 0.544275,0.4738026 1.946291,1.3367446 4.207097,2.5889976 2.414319,1.342419 4.117377,2.390985 5.108232,3.146807 1.004795,0.755857 1.821505,1.675853 2.449514,2.758846 0.628002,1.082993 0.942253,2.227607 0.942253,3.434674 0,2.120834 -0.929555,3.993314 -2.785656,5.617786 -1.84214,1.613228 -3.99694,2.41915 -6.467082,2.41915 -2.246845,0 -4.145607,-0.647976 -5.694677,-1.945312 -1.5490699,-1.297336 -2.3225722,-3.028063 -2.3225722,-5.194049 0,-2.087031 0.8506345,-3.83094 2.5532182,-5.229825 1.716541,-1.398884 3.824203,-2.245599 6.322256,-2.538897 -0.697774,-0.631749 -1.668763,-1.387225 -2.910816,-2.267155 -1.367648,-0.970199 -2.287914,-1.73045 -2.762402,-2.283243 -0.474491,-0.5640381 -0.711618,-1.1795944 -0.711618,-1.8451814 0,-0.9927581 0.572093,-1.7710351 1.716451,-2.3351077 1.144362,-0.5753173 2.636724,-0.8635642 4.478865,-0.8635642 z m 1.110327,10.3738083 c -4.005262,0.5302 -6.007576,2.75279 -6.007576,6.667322 0,2.01932 0.49495,3.587291 1.485805,4.704157 1.004806,1.116832 2.169696,1.675299 3.495479,1.675299 1.381602,0 2.520072,-0.535632 3.413229,-1.60738 0.893168,-1.082959 1.339187,-2.545264 1.339187,-4.384079 0,-2.662348 -1.242022,-5.013441 -3.726124,-7.055319 z" />

Binary file not shown.

View File

@@ -8,16 +8,14 @@ async fn address_book_benchmark(n: u32, read_count: u32) {
let dir = tempdir().unwrap();
let dbfile = dir.path().join("db.sqlite");
let id = 100;
let context = Context::new("FakeOS".into(), dbfile.into(), id)
.await
.unwrap();
let context = Context::new(dbfile.into(), id).await.unwrap();
let book = (0..n)
.map(|i| format!("Name {}\naddr{}@example.org\n", i, i))
.collect::<Vec<String>>()
.join("");
Contact::add_address_book(&context, book).await.unwrap();
Contact::add_address_book(&context, &book).await.unwrap();
let query: Option<&str> = None;
for _ in 0..read_count {

View File

@@ -8,7 +8,7 @@ async fn create_accounts(n: u32) {
let dir = tempdir().unwrap();
let p: PathBuf = dir.path().join("accounts").into();
let accounts = Accounts::new("my_os".into(), p.clone()).await.unwrap();
let mut accounts = Accounts::new(p.clone()).await.unwrap();
for expected_id in 2..n {
let id = accounts.add_account().await.unwrap();

40
benches/get_chat_msgs.rs Normal file
View File

@@ -0,0 +1,40 @@
use async_std::path::Path;
use criterion::async_executor::AsyncStdExecutor;
use criterion::{black_box, criterion_group, criterion_main, Criterion};
use deltachat::chat::{self, ChatId};
use deltachat::chatlist::Chatlist;
use deltachat::context::Context;
async fn get_chat_msgs_benchmark(dbfile: &Path, chats: &[ChatId]) {
let id = 100;
let context = Context::new(dbfile.into(), id).await.unwrap();
for c in chats.iter().take(10) {
black_box(chat::get_chat_msgs(&context, *c, 0).await.ok());
}
}
fn criterion_benchmark(c: &mut Criterion) {
// To enable this benchmark, set `DELTACHAT_BENCHMARK_DATABASE` to some large database with many
// messages, such as your primary account.
if let Ok(path) = std::env::var("DELTACHAT_BENCHMARK_DATABASE") {
let chats: Vec<_> = async_std::task::block_on(async {
let context = Context::new((&path).into(), 100).await.unwrap();
let chatlist = Chatlist::try_load(&context, 0, None, None).await.unwrap();
let len = chatlist.len();
(0..len).map(|i| chatlist.get_chat_id(i).unwrap()).collect()
});
c.bench_function("chat::get_chat_msgs (load messages from 10 chats)", |b| {
b.to_async(AsyncStdExecutor)
.iter(|| get_chat_msgs_benchmark(black_box(path.as_ref()), black_box(&chats)))
});
} else {
println!("env var not set: DELTACHAT_BENCHMARK_DATABASE");
}
}
criterion_group!(benches, criterion_benchmark);
criterion_main!(benches);

27
benches/get_chatlist.rs Normal file
View File

@@ -0,0 +1,27 @@
use criterion::async_executor::AsyncStdExecutor;
use criterion::{black_box, criterion_group, criterion_main, Criterion};
use deltachat::chatlist::Chatlist;
use deltachat::context::Context;
async fn get_chat_list_benchmark(context: &Context) {
Chatlist::try_load(context, 0, None, None).await.unwrap();
}
fn criterion_benchmark(c: &mut Criterion) {
// To enable this benchmark, set `DELTACHAT_BENCHMARK_DATABASE` to some large database with many
// messages, such as your primary account.
if let Ok(path) = std::env::var("DELTACHAT_BENCHMARK_DATABASE") {
let context =
async_std::task::block_on(async { Context::new(path.into(), 100).await.unwrap() });
c.bench_function("chatlist:try_load (Get Chatlist)", |b| {
b.to_async(AsyncStdExecutor)
.iter(|| get_chat_list_benchmark(black_box(&context)))
});
} else {
println!("env var not set: DELTACHAT_BENCHMARK_DATABASE");
}
}
criterion_group!(benches, criterion_benchmark);
criterion_main!(benches);

84
benches/receive_emails.rs Normal file
View File

@@ -0,0 +1,84 @@
use async_std::{path::PathBuf, task::block_on};
use criterion::{
async_executor::AsyncStdExecutor, black_box, criterion_group, criterion_main, BatchSize,
Criterion,
};
use deltachat::{
config::Config,
context::Context,
dc_receive_imf::dc_receive_imf,
imex::{imex, ImexMode},
};
use tempfile::tempdir;
async fn recv_all_emails(context: Context) -> Context {
for i in 0..100 {
let imf_raw = format!(
"Subject: Benchmark
Message-ID: Mr.OssSYnOFkhR.{i}@testrun.org
Date: Sat, 07 Dec 2019 19:00:27 +0000
To: alice@example.com
From: sender@testrun.org
Chat-Version: 1.0
Chat-Disposition-Notification-To: sender@testrun.org
Chat-User-Avatar: 0
In-Reply-To: Mr.OssSYnOFkhR.{i_dec}@testrun.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed; delsp=no
Hello {i}",
i = i,
i_dec = i - 1,
);
dc_receive_imf(&context, black_box(imf_raw.as_bytes()), false)
.await
.unwrap();
}
context
}
async fn create_context() -> Context {
let dir = tempdir().unwrap();
let dbfile = dir.path().join("db.sqlite");
let id = 100;
let context = Context::new(dbfile.into(), id).await.unwrap();
let backup: PathBuf = std::env::current_dir()
.unwrap()
.join("delta-chat-backup.tar")
.into();
if backup.exists().await {
println!("Importing backup");
imex(&context, ImexMode::ImportBackup, &backup, None)
.await
.unwrap();
}
let addr = "alice@example.com";
context.set_config(Config::Addr, Some(addr)).await.unwrap();
context
.set_config(Config::ConfiguredAddr, Some(addr))
.await
.unwrap();
context
.set_config(Config::Configured, Some("1"))
.await
.unwrap();
context
}
fn criterion_benchmark(c: &mut Criterion) {
let mut group = c.benchmark_group("Receive messages");
group.bench_function("Receive 100 simple text msgs", |b| {
b.to_async(AsyncStdExecutor).iter_batched(
|| block_on(create_context()),
|context| recv_all_emails(black_box(context)),
BatchSize::LargeInput,
);
});
group.finish();
}
criterion_group!(benches, criterion_benchmark);
criterion_main!(benches);

View File

@@ -6,9 +6,7 @@ use std::path::Path;
async fn search_benchmark(path: impl AsRef<Path>) {
let dbfile = path.as_ref();
let id = 100;
let context = Context::new("FakeOS".into(), dbfile.into(), id)
.await
.unwrap();
let context = Context::new(dbfile.into(), id).await.unwrap();
for _ in 0..10u32 {
context.search_msgs(None, "hello").await.unwrap();
@@ -22,6 +20,8 @@ fn criterion_benchmark(c: &mut Criterion) {
c.bench_function("search hello", |b| {
b.iter(|| block_on(async { search_benchmark(black_box(&path)).await }))
});
} else {
println!("env var not set: DELTACHAT_BENCHMARK_DATABASE");
}
}

View File

@@ -1,6 +1,6 @@
[package]
name = "deltachat_ffi"
version = "1.53.0"
version = "1.86.0"
description = "Deltachat FFI"
authors = ["Delta Chat Developers (ML) <delta@codespeak.net>"]
edition = "2018"
@@ -17,13 +17,13 @@ crate-type = ["cdylib", "staticlib"]
[dependencies]
deltachat = { path = "../", default-features = false }
libc = "0.2"
human-panic = "1.0.1"
num-traits = "0.2.6"
human-panic = "1"
num-traits = "0.2"
serde_json = "1.0"
async-std = "1.6.0"
anyhow = "1.0.28"
thiserror = "1.0.14"
rand = "0.7.3"
async-std = "1"
anyhow = "1"
thiserror = "1"
rand = "0.7"
[features]
default = ["vendored"]

View File

@@ -583,7 +583,7 @@ SORT_MEMBERS_CTORS_1ST = NO
# appear in their defined order.
# The default value is: NO.
SORT_GROUP_NAMES = NO
SORT_GROUP_NAMES = YES
# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by
# fully-qualified names, including namespaces. If set to NO, the class list will

View File

@@ -4,4 +4,16 @@ div.fragment {
background-color: #e0e0e0;
border: 0;
padding: 1em;
border-radius: 6px;
}
code {
background-color: #e0e0e0;
padding-left: .5em;
padding-right: .5em;
border-radius: 6px;
}
li {
margin-bottom: .5em;
}

View File

@@ -1,5 +1,9 @@
# Delta Chat C Interface
## Installation
see `Installing libdeltachat system wide` in [../README.md](../README.md)
## Documentation
To generate the C Interface documentation,

View File

@@ -23,11 +23,13 @@ fn main() {
version = env::var("CARGO_PKG_VERSION").unwrap(),
libs_priv = libs_priv,
prefix = env::var("PREFIX").unwrap_or_else(|_| "/usr/local".to_string()),
libdir = env::var("LIBDIR").unwrap_or_else(|_| "/usr/local/lib".to_string()),
includedir = env::var("INCLUDEDIR").unwrap_or_else(|_| "/usr/local/include".to_string()),
);
fs::create_dir_all(target_path.join("pkgconfig")).unwrap();
fs::File::create(target_path.join("pkgconfig").join("deltachat.pc"))
.unwrap()
.write_all(&pkg_config.as_bytes())
.write_all(pkg_config.as_bytes())
.unwrap();
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
prefix={prefix}
libdir=${{prefix}}/lib
includedir=${{prefix}}/include
libdir={libdir}
includedir={includedir}
Name: {name}
Description: {description}

View File

@@ -1,5 +1,5 @@
use crate::chat::ChatItem;
use crate::constants::{DC_MSG_ID_DAYMARKER, DC_MSG_ID_MARKER1};
use crate::constants::DC_MSG_ID_DAYMARKER;
use crate::location::Location;
use crate::message::MsgId;
@@ -18,7 +18,6 @@ impl dc_array_t {
Self::MsgIds(array) => array[index].to_u32(),
Self::Chat(array) => match array[index] {
ChatItem::Message { msg_id } => msg_id.to_u32(),
ChatItem::Marker1 => DC_MSG_ID_MARKER1,
ChatItem::DayMarker { .. } => DC_MSG_ID_DAYMARKER,
},
Self::Locations(array) => array[index].location_id,
@@ -31,7 +30,6 @@ impl dc_array_t {
Self::MsgIds(_) => None,
Self::Chat(array) => array.get(index).and_then(|item| match item {
ChatItem::Message { .. } => None,
ChatItem::Marker1 { .. } => None,
ChatItem::DayMarker { timestamp } => Some(*timestamp),
}),
Self::Locations(array) => array.get(index).map(|location| location.timestamp),

File diff suppressed because it is too large Load Diff

245
deltachat-ffi/src/lot.rs Normal file
View File

@@ -0,0 +1,245 @@
//! # Legacy generic return values for C API.
use crate::message::MessageState;
use crate::qr::Qr;
use crate::summary::{Summary, SummaryPrefix};
use anyhow::Error;
use std::borrow::Cow;
/// An object containing a set of values.
/// The meaning of the values is defined by the function returning the object.
/// Lot objects are created
/// eg. by chatlist.get_summary() or dc_msg_get_summary().
///
/// *Lot* is used in the meaning *heap* here.
#[derive(Debug)]
pub enum Lot {
Summary(Summary),
Qr(Qr),
Error(String),
}
#[repr(u8)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Meaning {
None = 0,
Text1Draft = 1,
Text1Username = 2,
Text1Self = 3,
}
impl Default for Meaning {
fn default() -> Self {
Meaning::None
}
}
impl Lot {
pub fn get_text1(&self) -> Option<&str> {
match self {
Self::Summary(summary) => match &summary.prefix {
None => None,
Some(SummaryPrefix::Draft(text)) => Some(text),
Some(SummaryPrefix::Username(username)) => Some(username),
Some(SummaryPrefix::Me(text)) => Some(text),
},
Self::Qr(qr) => match qr {
Qr::AskVerifyContact { .. } => None,
Qr::AskVerifyGroup { grpname, .. } => Some(grpname),
Qr::FprOk { .. } => None,
Qr::FprMismatch { .. } => None,
Qr::FprWithoutAddr { fingerprint, .. } => Some(fingerprint),
Qr::Account { domain } => Some(domain),
Qr::WebrtcInstance { domain, .. } => Some(domain),
Qr::Addr { .. } => None,
Qr::Url { url } => Some(url),
Qr::Text { text } => Some(text),
Qr::WithdrawVerifyContact { .. } => None,
Qr::WithdrawVerifyGroup { grpname, .. } => Some(grpname),
Qr::ReviveVerifyContact { .. } => None,
Qr::ReviveVerifyGroup { grpname, .. } => Some(grpname),
},
Self::Error(err) => Some(err),
}
}
pub fn get_text2(&self) -> Option<Cow<str>> {
match self {
Self::Summary(summary) => Some(summary.truncated_text(160)),
Self::Qr(_) => None,
Self::Error(_) => None,
}
}
pub fn get_text1_meaning(&self) -> Meaning {
match self {
Self::Summary(summary) => match &summary.prefix {
None => Meaning::None,
Some(SummaryPrefix::Draft(_text)) => Meaning::Text1Draft,
Some(SummaryPrefix::Username(_username)) => Meaning::Text1Username,
Some(SummaryPrefix::Me(_text)) => Meaning::Text1Self,
},
Self::Qr(_qr) => Meaning::None,
Self::Error(_err) => Meaning::None,
}
}
pub fn get_state(&self) -> LotState {
match self {
Self::Summary(summary) => summary.state.into(),
Self::Qr(qr) => match qr {
Qr::AskVerifyContact { .. } => LotState::QrAskVerifyContact,
Qr::AskVerifyGroup { .. } => LotState::QrAskVerifyGroup,
Qr::FprOk { .. } => LotState::QrFprOk,
Qr::FprMismatch { .. } => LotState::QrFprMismatch,
Qr::FprWithoutAddr { .. } => LotState::QrFprWithoutAddr,
Qr::Account { .. } => LotState::QrAccount,
Qr::WebrtcInstance { .. } => LotState::QrWebrtcInstance,
Qr::Addr { .. } => LotState::QrAddr,
Qr::Url { .. } => LotState::QrUrl,
Qr::Text { .. } => LotState::QrText,
Qr::WithdrawVerifyContact { .. } => LotState::QrWithdrawVerifyContact,
Qr::WithdrawVerifyGroup { .. } => LotState::QrWithdrawVerifyGroup,
Qr::ReviveVerifyContact { .. } => LotState::QrReviveVerifyContact,
Qr::ReviveVerifyGroup { .. } => LotState::QrReviveVerifyGroup,
},
Self::Error(_err) => LotState::QrError,
}
}
pub fn get_id(&self) -> u32 {
match self {
Self::Summary(_) => Default::default(),
Self::Qr(qr) => match qr {
Qr::AskVerifyContact { contact_id, .. } => contact_id.to_u32(),
Qr::AskVerifyGroup { .. } => Default::default(),
Qr::FprOk { contact_id } => contact_id.to_u32(),
Qr::FprMismatch { contact_id } => contact_id.unwrap_or_default().to_u32(),
Qr::FprWithoutAddr { .. } => Default::default(),
Qr::Account { .. } => Default::default(),
Qr::WebrtcInstance { .. } => Default::default(),
Qr::Addr { contact_id } => contact_id.to_u32(),
Qr::Url { .. } => Default::default(),
Qr::Text { .. } => Default::default(),
Qr::WithdrawVerifyContact { contact_id, .. } => contact_id.to_u32(),
Qr::WithdrawVerifyGroup { .. } => Default::default(),
Qr::ReviveVerifyContact { contact_id, .. } => contact_id.to_u32(),
Qr::ReviveVerifyGroup { .. } => Default::default(),
},
Self::Error(_) => Default::default(),
}
}
pub fn get_timestamp(&self) -> i64 {
match self {
Self::Summary(summary) => summary.timestamp,
Self::Qr(_) => Default::default(),
Self::Error(_) => Default::default(),
}
}
}
#[repr(u32)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum LotState {
// Default
Undefined = 0,
// Qr States
/// id=contact
QrAskVerifyContact = 200,
/// text1=groupname
QrAskVerifyGroup = 202,
/// id=contact
QrFprOk = 210,
/// id=contact
QrFprMismatch = 220,
/// text1=formatted fingerprint
QrFprWithoutAddr = 230,
/// text1=domain
QrAccount = 250,
/// text1=domain, text2=instance pattern
QrWebrtcInstance = 260,
/// id=contact
QrAddr = 320,
/// text1=text
QrText = 330,
/// text1=URL
QrUrl = 332,
/// text1=error string
QrError = 400,
QrWithdrawVerifyContact = 500,
/// text1=groupname
QrWithdrawVerifyGroup = 502,
QrReviveVerifyContact = 510,
/// text1=groupname
QrReviveVerifyGroup = 512,
// Message States
MsgInFresh = 10,
MsgInNoticed = 13,
MsgInSeen = 16,
MsgOutPreparing = 18,
MsgOutDraft = 19,
MsgOutPending = 20,
MsgOutFailed = 24,
MsgOutDelivered = 26,
MsgOutMdnRcvd = 28,
}
impl Default for LotState {
fn default() -> Self {
LotState::Undefined
}
}
impl From<MessageState> for LotState {
fn from(s: MessageState) -> Self {
use MessageState::*;
match s {
Undefined => LotState::Undefined,
InFresh => LotState::MsgInFresh,
InNoticed => LotState::MsgInNoticed,
InSeen => LotState::MsgInSeen,
OutPreparing => LotState::MsgOutPreparing,
OutDraft => LotState::MsgOutDraft,
OutPending => LotState::MsgOutPending,
OutFailed => LotState::MsgOutFailed,
OutDelivered => LotState::MsgOutDelivered,
OutMdnRcvd => LotState::MsgOutMdnRcvd,
}
}
}
impl From<Summary> for Lot {
fn from(summary: Summary) -> Self {
Lot::Summary(summary)
}
}
impl From<Qr> for Lot {
fn from(qr: Qr) -> Self {
Lot::Qr(qr)
}
}
// Make it easy to convert errors into the final `Lot`.
impl From<Error> for Lot {
fn from(error: Error) -> Self {
Lot::Error(error.to_string())
}
}

View File

@@ -17,15 +17,12 @@ use std::ptr;
/// }
/// ```
unsafe fn dc_strdup(s: *const libc::c_char) -> *mut libc::c_char {
let ret: *mut libc::c_char;
if !s.is_null() {
ret = libc::strdup(s);
assert!(!ret.is_null());
let ret: *mut libc::c_char = if !s.is_null() {
libc::strdup(s)
} else {
ret = libc::calloc(1, 1) as *mut libc::c_char;
assert!(!ret.is_null());
}
libc::calloc(1, 1) as *mut libc::c_char
};
assert!(!ret.is_null());
ret
}
@@ -170,15 +167,20 @@ pub(crate) trait Strdup {
unsafe fn strdup(&self) -> *mut libc::c_char;
}
impl<T: AsRef<str>> Strdup for T {
impl Strdup for str {
unsafe fn strdup(&self) -> *mut libc::c_char {
let tmp = CString::new_lossy(self.as_ref());
let tmp = CString::new_lossy(self);
dc_strdup(tmp.as_ptr())
}
}
// We can not implement for AsRef<OsStr> because we already implement
// AsRev<str> and this conflicts. So implement for Path directly.
impl Strdup for String {
unsafe fn strdup(&self) -> *mut libc::c_char {
let s: &str = self;
s.strdup()
}
}
impl Strdup for std::path::Path {
unsafe fn strdup(&self) -> *mut libc::c_char {
let tmp = self.to_c_string().unwrap_or_else(|_| CString::default());
@@ -186,6 +188,13 @@ impl Strdup for std::path::Path {
}
}
impl Strdup for [u8] {
unsafe fn strdup(&self) -> *mut libc::c_char {
let tmp = CString::new_lossy(self);
dc_strdup(tmp.as_ptr())
}
}
/// Convenience methods to turn optional strings into C strings.
///
/// This is the same as the [Strdup] trait but a different trait name

View File

@@ -0,0 +1,13 @@
[package]
name = "deltachat_derive"
version = "2.0.0"
authors = ["Delta Chat Developers (ML) <delta@codespeak.net>"]
edition = "2018"
license = "MPL-2.0"
[lib]
proc-macro = true
[dependencies]
syn = "1"
quote = "1"

View File

@@ -0,0 +1,47 @@
#![recursion_limit = "128"]
extern crate proc_macro;
use crate::proc_macro::TokenStream;
use quote::quote;
// For now, assume (not check) that these macroses are applied to enum without
// data. If this assumption is violated, compiler error will point to
// generated code, which is not very user-friendly.
#[proc_macro_derive(ToSql)]
pub fn to_sql_derive(input: TokenStream) -> TokenStream {
let ast: syn::DeriveInput = syn::parse(input).unwrap();
let name = &ast.ident;
let gen = quote! {
impl rusqlite::types::ToSql for #name {
fn to_sql(&self) -> rusqlite::Result<rusqlite::types::ToSqlOutput> {
let num = *self as i64;
let value = rusqlite::types::Value::Integer(num);
let output = rusqlite::types::ToSqlOutput::Owned(value);
std::result::Result::Ok(output)
}
}
};
gen.into()
}
#[proc_macro_derive(FromSql)]
pub fn from_sql_derive(input: TokenStream) -> TokenStream {
let ast: syn::DeriveInput = syn::parse(input).unwrap();
let name = &ast.ident;
let gen = quote! {
impl rusqlite::types::FromSql for #name {
fn column_result(col: rusqlite::types::ValueRef) -> rusqlite::types::FromSqlResult<Self> {
let inner = rusqlite::types::FromSql::column_result(col)?;
if let Some(value) = num_traits::FromPrimitive::from_i64(inner) {
Ok(value)
} else {
Err(rusqlite::types::FromSqlError::OutOfRange(inner))
}
}
}
};
gen.into()
}

99
draft/aeap-mvp.md Normal file
View File

@@ -0,0 +1,99 @@
AEAP MVP
========
Changes to the UIs
------------------
- The secondary self addresses (see below) are shown in the UI, but not editable.
- When the user changed the email address in the configure screen, show a dialog to the user, either directly explaining things or with a link to the FAQ (see "Other" below)
Changes in the core
-------------------
- DONE: We have one primary self address and any number of secondary self addresses. `is_self_addr()` checks all of them.
- DONE: If the user does a reconfigure and changes the email address, the previous address is added as a secondary self address.
- don't forget to deduplicate secondary self addresses in case the user switches back and forth between addresses).
- The key stays the same.
- No changes for 1:1 chats, there simply is a new one. (This works since, contrary to group messages, messages sent to a 1:1 chat are not assigned to the group chat but always to the 1:1 chat with the sender. So it's not a problem that the new messages might be put into the old chat if they are a reply to a message there.)
- When sending a message: If any of the secondary self addrs is in the chat's member list, remove it locally (because we just transitioned away from it). We add a log message for this (alternatively, a system message in the chat would be more visible).
- When receiving a message: If the key exists, but belongs to another address (we may want to benchmark this)
AND there is a `Chat-Version` header\
AND the message timestamp is newer than the contact's `lastseen` (to prevent changing the address back when messages arrive out of order) (this condition is not that important since we will have eventual consistency even without it):
Replace the contact in _all_ groups, possibly deduplicate the members list, and add a system message to all of these chats.
- Note that we can't simply compare the keys byte-by-byte, since the UID may have changed, or the sender may have rotated the key and signed the new key with the old one.
### Notes:
- We treat protected and non-protected chats the same
- We leave the aeap transition statement away since it seems not to be needed, makes things harder on the sending side, wastes some network traffic, and is worse for privacy (since more pepole know what old addresses you had).
- As soon as we encrypt read receipts, sending a read receipt will be enough to tell a lot of people that you transitioned
- AEAP will make the problem of inconsistent group state worse, both because it doesn't work if the message is unencrypted (even if the design allowed it, it would be problematic security-wise) and because some chat partners may have gotten the transition and some not. We should do something against this at some point in the future, like asking the user whether they want to add/remove the members to restore consistent group state.
#### Downsides of this design:
- Inconsistent group state: Suppose Alice does an AEAP transition and sends a 1:1 message to Bob, so Bob rewrites Alice's contact. Alice, Bob and Charlie are together in a group. Before Alice writes to this group, Bob and Charlie will have different membership lists, and Bob will send messages to Alice's new address, while Charlie will send them to her old address.
#### Upsides:
- With this approach, it's easy to switch to a model where the info about the transition is encoded in the PGP key. Since the key is gossiped, the information about the transition will spread virally.
- Faster transation: If you send a message to e.g. "Delta Chat Dev", all members of the "sub-group" "delta android" will know of your transition.
### Alternatives and old discussions/plans:
- Change the contact instead of rewriting the group member lists. This seems to call for more trouble since we will end up with multiple contacts having the same email address.
- If needed, we could add a header a) indicating that the sender did an address transition or b) listing all the secondary (old) addresses. For now, there is no big enough benefit to warrant introducing another header and its processing on the receiver side (including all the neccessary checks and handling of error cases). Instead, we only check for the `Chat-Version` header to prevent accidental transitions when an MUA user sends a message from another email address with the same key.
- The condition for a transition temporarily was:
> When receiving a message: If we are going to assign a message to a chat, but the sender is not a member of this chat\
> AND the signing key is the same as the direct (non-gossiped) key of one of the chat members\
> AND ...
However, this would mean that in 1:1 messages can't trigger a transition, since we don't assign private messages to the parent chat, but always to the 1:1 chat with the sender.
<details>
<summary>Some previous state of the discussion, which temporarily lived in an issue description</summary>
Summarizing the discussions from https://github.com/deltachat/deltachat-core-rust/pull/2896, mostly quoting @hpk42:
1. (DONE) At the time of configure we push the current primary to become a secondary.
2. When a message is sent out to a chat, and the message is encrypted, and we have secondary addresses, then we
a) add a protected "AEAP-Replacement" header that contains all secondary addresses
b) if any of the secondary addresses is in the chat's member list, we remove it and leave a system message that we did so
3. When an encrypted message with a replacement header is received, replace the e-mail address of all secondary contacts (if they exist) with the new primary and drop a sysmessage in all chats the secondary is member off. This might (in edge cases) result in chats that have two or more contacts with the same e-mail address. We might ignore this for a first release and just log a warning. Let's maybe not get hung up on this case before everything else works.
Notes:
- for now we will send out aeap replacement headers forever, there is no termination condition other than lack of secondary addresses. I think that's fine for now. Later on we might introduce options to remove secondary addresses but i wouldn't do this for a first release/PR.
- the design is resilient against changing e-mail providers from A to B to C and then back to A, with partially updated chats and diverging views from recipients/contacts on this transition. In the end, you will have a primary and some secondaries, and when you start sending out messages everybody will eventually synchronize when they receive the current state of primaries/secondaries.
- of course on incoming message for need to check for each stated secondary address in the replacement header that it uses the same signature as the signature we verified as valid with the incoming message **--> Also we have to somehow make sure that the signing key was not just gossiped from some random other person in some group.**
- there are no extra flags/columns in the database needed (i hope)
#### Downsides of the chosen approach:
- Inconsistent group state: Suppose Alice does an AEAP transition and sends a 1:1 message to Bob, so Bob rewrites Alice's contact. Alice, Bob and Charlie are together in a group. Before Alice writes to this group, Bob and Charlie will have different membership lists, and Bob will send messages to Alice's new address, while Charlie will send them to her old address.
- There will be multiple contacts with the same address in the database. We will have to do something against this at some point.
The most obvious alternative would be to create a new contact with the new address and replace the old contact in the groups.
#### Upsides:
- With this approach, it's easier to switch to a model where the info about the transition is encoded in the PGP key. Since the key is gossiped, the information about the transition will spread virally.
- (Also, less important: Slightly faster transation: If you send a message to e.g. "Delta Chat Dev", all members of the "sub-group" "delta android" will know of your transition.)
- It's easier to implement (if too many problems turn up, we can still switch to another approach and didn't wast that much development time.)
[full messages](https://github.com/deltachat/deltachat-core-rust/pull/2896#discussion_r852002161)
_end of the previous state of the discussion_
</details>
Other
-----
- The user is responsible that messages to the old address arrive at the new address, for example by configuring the old provider to forward all emails to the new one.

View File

@@ -0,0 +1,199 @@
# Webxdc Developer Reference
(This document may eventually be merged with the [webxdc guidebook](https://deltachat.github.io/webxdc_docs/), where you may currently find other useful information.)
## Webxdc File Format
- a **Webxdc** is a **ZIP-file** with the extension `.xdc`
- the ZIP-file must use the default compression methods as of RFC 1950,
this is "Deflate" or "Store"
- the ZIP-file must contain at least the file `index.html`
- if the Webxdc is started, `index.html` is opened in a restricted webview
that allow accessing resources only from the ZIP-file
## Webxdc API
There are some additional APIs available once `webxdc.js` is included
(the file will be provided by the concrete implementations,
no need to add `webxdc.js` to your ZIP-file):
```html
<script src="webxdc.js"></script>
```
### sendUpdate()
```js
window.webxdc.sendUpdate(update, descr);
```
A Webxdc is usually shared in a chat and run independently on each peer.
To get a shared state, the peers use `sendUpdate()` to send updates to each other.
- `update`: an object with the following properties:
- `update.payload`: any javascript primitive, array or object.
- `update.info`: optional, short, informational message that will be added to the chat,
eg. "Alice voted" or "Bob scored 123 in MyGame".
usually only one line of text is shown
and if there are series of info messages, older ones may be dropped.
use this option sparingly to not spam the chat.
- `update.document`: optional, name of the document in edit,
must not be used eg. in games where the Webxdc does not create documents
- `update.summary`: optional, short text, shown beside Webxdc icon;
it is recommended to use some aggregated value, eg. "8 votes", "Highscore: 123"
- `descr`: short, human-readable description what this update is about.
this is shown eg. as a fallback text in an email program.
All peers, including the sending one,
will receive the update by the callback given to `setUpdateListener()`.
There are situations where the user cannot send messages to a chat,
eg. if the webxdc instance comes as a contact request or if the user has left a group.
In these cases, you can still call `sendUpdate()`,
however, the update won't be sent to other peers
and you won't get the update by `setUpdateListener()`.
### setUpdateListener()
```js
let promise = window.webxdc.setUpdateListener((update) => {}, serial);
```
With `setUpdateListener()` you define a callback that receives the updates
sent by `sendUpdate()`. The callback is called for updates sent by you or other peers.
The `serial` specifies the last serial that you know about (defaults to 0).
The returned promise resolves when the listener has processed all the update messages known at the time when `setUpdateListener` was called.
Each `update` which is passed to the callback comes with the following properties:
- `update.payload`: equals the payload given to `sendUpdate()`
- `update.serial`: the serial number of this update.
Serials are larger `0` and newer serials have higher numbers.
There may be gaps in the serials
and it is not guaranteed that the next serial is exactly incremented by one.
- `update.max_serial`: the maximum serial currently known.
If `max_serial` equals `serial` this update is the last update (until new network messages arrive).
- `update.info`: optional, short, informational message (see `sendUpdate()`)
- `update.document`: optional, document name as set by the sender, (see `sendUpdate()`),
implementations show the document name eg. beside the app icon or in the title bar
- `update.summary`: optional, short text, shown beside icon (see `sendUpdate()`)
### selfAddr
```js
window.webxdc.selfAddr
```
Property with the peer's own address.
This is esp. useful if you want to differ between different peers -
just send the address along with the payload,
and, if needed, compare the payload addresses against selfAddr() later on.
### selfName
```js
window.webxdc.selfName
```
Property with the peer's own name.
This is name chosen by the user in their settings,
if there is nothing set, that defaults to the peer's address.
## manifest.toml
If the ZIP-file contains a `manifest.toml` in its root directory,
some basic information are read and used from there.
the `manifest.toml` has the following format
```toml
name = "My Name"
source_code_url = "https://example.org/orga/repo"
```
- `name` - The name of the Webxdc.
If no name is set or if there is no manifest, the filename is used as the Webxdc name.
- `source_code_url` - Optional URL where the source code of the Webxdc and maybe other information can be found.
UI may make the url accessible via a "Help" menu in the Webxdc window.
## Webxdc Icon
If the ZIP-root contains an `icon.png` or `icon.jpg`,
these files are used as the icon for the Webxdc.
The icon should be a square at reasonable width/height;
round corners etc. will be added by the implementations as needed.
If no icon is set, a default icon will be used.
## Webxdc Examples
The following example shows an input field and every input is show on all peers.
```html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<script src="webxdc.js"></script>
</head>
<body>
<input id="input" type="text"/>
<a href="" onclick="sendMsg(); return false;">Send</a>
<p id="output"></p>
<script>
function sendMsg() {
msg = document.getElementById("input").value;
window.webxdc.sendUpdate({payload: msg}, 'Someone typed "'+msg+'".');
}
function receiveUpdate(update) {
document.getElementById('output').innerHTML += update.payload + "<br>";
}
window.webxdc.setUpdateListener(receiveUpdate, 0);
</script>
</body>
</html>
```
[Webxdc Development Tool](https://github.com/deltachat/webxdc-dev)
offers an **Webxdc Simulator** that can be used in many browsers without any installation needed.
You can also use that repository as a template for your own Webxdc -
just clone and start adapting things to your need.
### Advanced Examples
- [2048](https://github.com/adbenitez/2048.xdc)
- [Draw](https://github.com/adbenitez/draw.xdc)
- [Poll](https://github.com/r10s/webxdc-poll/)
- [Tic Tac Toe](https://github.com/Simon-Laux/tictactoe.xdc)
- Even more with [Topic #webxdc on Github](https://github.com/topics/webxdc) or in the [webxdc GitHub organization](https://github.com/webxdc)
## Closing Remarks
- older devices might not have the newest js features in their webview,
you may want to transpile your code down to an older js version eg. with https://babeljs.io
- viewport and scaling features are implementation specific,
if you want to have an explicit behavior, you can add eg.
`<meta name="viewport" content="initial-scale=1; user-scalable=no">` to your Webxdc
- the `<title>` tag should not be used and its content is usually not displayed;
instead, use the `name` property from `manifest.toml`
- there are tons of ideas for enhancements of the API and the file format,
eg. in the future, we will may define icon- and manifest-files,
allow to aggregate the state or add metadata.

View File

@@ -2,7 +2,7 @@ extern crate dirs;
use std::str::FromStr;
use anyhow::{bail, ensure, Error};
use anyhow::{bail, ensure, Result};
use async_std::path::Path;
use deltachat::chat::{
self, Chat, ChatId, ChatItem, ChatVisibility, MuteDuration, ProtectionStatus,
@@ -13,15 +13,14 @@ use deltachat::contact::*;
use deltachat::context::*;
use deltachat::dc_receive_imf::*;
use deltachat::dc_tools::*;
use deltachat::download::DownloadState;
use deltachat::imex::*;
use deltachat::location;
use deltachat::log::LogExt;
use deltachat::lot::LotState;
use deltachat::message::{self, ContactRequestDecision, Message, MessageState, MsgId};
use deltachat::message::{self, Message, MessageState, MsgId, Viewtype};
use deltachat::peerstate::*;
use deltachat::qr::*;
use deltachat::sql;
use deltachat::EventType;
use deltachat::{config, provider};
use std::fs;
use std::time::{Duration, SystemTime};
@@ -34,7 +33,7 @@ async fn reset_tables(context: &Context, bits: i32) {
if 0 != bits & 1 {
context
.sql()
.execute(sqlx::query("DELETE FROM jobs;"))
.execute("DELETE FROM jobs;", paramsv![])
.await
.unwrap();
println!("(1) Jobs reset.");
@@ -42,7 +41,7 @@ async fn reset_tables(context: &Context, bits: i32) {
if 0 != bits & 2 {
context
.sql()
.execute(sqlx::query("DELETE FROM acpeerstates;"))
.execute("DELETE FROM acpeerstates;", paramsv![])
.await
.unwrap();
println!("(2) Peerstates reset.");
@@ -50,7 +49,7 @@ async fn reset_tables(context: &Context, bits: i32) {
if 0 != bits & 4 {
context
.sql()
.execute(sqlx::query("DELETE FROM keypairs;"))
.execute("DELETE FROM keypairs;", paramsv![])
.await
.unwrap();
println!("(4) Private keypairs reset.");
@@ -58,49 +57,48 @@ async fn reset_tables(context: &Context, bits: i32) {
if 0 != bits & 8 {
context
.sql()
.execute(sqlx::query("DELETE FROM contacts WHERE id>9;"))
.execute("DELETE FROM contacts WHERE id>9;", paramsv![])
.await
.unwrap();
context
.sql()
.execute(sqlx::query("DELETE FROM chats WHERE id>9;"))
.execute("DELETE FROM chats WHERE id>9;", paramsv![])
.await
.unwrap();
context
.sql()
.execute(sqlx::query("DELETE FROM chats_contacts;"))
.execute("DELETE FROM chats_contacts;", paramsv![])
.await
.unwrap();
context
.sql()
.execute(sqlx::query("DELETE FROM msgs WHERE id>9;"))
.execute("DELETE FROM msgs WHERE id>9;", paramsv![])
.await
.unwrap();
context
.sql()
.execute(sqlx::query(
.execute(
"DELETE FROM config WHERE keyname LIKE 'imap.%' OR keyname LIKE 'configured%';",
))
paramsv![],
)
.await
.unwrap();
context.sql().config_cache().write().await.clear();
context
.sql()
.execute(sqlx::query("DELETE FROM leftgrps;"))
.execute("DELETE FROM leftgrps;", paramsv![])
.await
.unwrap();
println!("(8) Rest but server config reset.");
}
context.emit_event(EventType::MsgsChanged {
chat_id: ChatId::new(0),
msg_id: MsgId::new(0),
});
context.emit_msgs_changed_without_ids();
}
async fn poke_eml_file(context: &Context, filename: impl AsRef<Path>) -> Result<(), anyhow::Error> {
async fn poke_eml_file(context: &Context, filename: impl AsRef<Path>) -> Result<()> {
let data = dc_read_file(context, filename).await?;
if let Err(err) = dc_receive_imf(context, &data, "import", 0, false).await {
if let Err(err) = dc_receive_imf(context, &data, false).await {
println!("dc_receive_imf errored: {:?}", err);
}
Ok(())
@@ -162,10 +160,7 @@ async fn poke_spec(context: &Context, spec: Option<&str>) -> bool {
}
println!("Import: {} items read from \"{}\".", read_cnt, &real_spec);
if read_cnt > 0 {
context.emit_event(EventType::MsgsChanged {
chat_id: ChatId::new(0),
msg_id: MsgId::new(0),
});
context.emit_msgs_changed_without_ids();
}
true
}
@@ -188,10 +183,18 @@ async fn log_msg(context: &Context, prefix: impl AsRef<str>, msg: &Message) {
MessageState::OutFailed => " !!",
_ => "",
};
let downloadstate = match msg.download_state() {
DownloadState::Done => "",
DownloadState::Available => " [⬇ Download available]",
DownloadState::InProgress => " [⬇ Download in progress...]",
DownloadState::Failure => " [⬇ Download failed]",
};
let temp2 = dc_timestamp_to_str(msg.get_timestamp());
let msgtext = msg.get_text();
println!(
"{}{}{}{}: {} (Contact#{}): {} {}{}{}{}{}{} [{}]",
"{}{}{}{}: {} (Contact#{}): {} {}{}{}{}{}{}{} [{}]",
prefix.as_ref(),
msg.get_id(),
if msg.get_showpadlock() { "🔒" } else { "" },
@@ -200,7 +203,7 @@ async fn log_msg(context: &Context, prefix: impl AsRef<str>, msg: &Message) {
contact_id,
msgtext.unwrap_or_default(),
if msg.has_html() { "[HAS-HTML]" } else { "" },
if msg.get_from_id() == 1 {
if msg.get_from_id() == ContactId::SELF {
""
} else if msg.get_state() == MessageState::InSeen {
"[SEEN]"
@@ -225,11 +228,12 @@ async fn log_msg(context: &Context, prefix: impl AsRef<str>, msg: &Message) {
""
},
statestr,
downloadstate,
&temp2,
);
}
async fn log_msglist(context: &Context, msglist: &[MsgId]) -> Result<(), Error> {
async fn log_msglist(context: &Context, msglist: &[MsgId]) -> Result<()> {
let mut lines_out = 0;
for &msg_id in msglist {
if msg_id == MsgId::new(DC_MSG_ID_DAYMARKER) {
@@ -257,59 +261,54 @@ async fn log_msglist(context: &Context, msglist: &[MsgId]) -> Result<(), Error>
Ok(())
}
async fn log_contactlist(context: &Context, contacts: &[u32]) {
async fn log_contactlist(context: &Context, contacts: &[ContactId]) -> Result<()> {
for contact_id in contacts {
let line;
let mut line2 = "".to_string();
if let Ok(contact) = Contact::get_by_id(context, *contact_id).await {
let name = contact.get_display_name();
let addr = contact.get_addr();
let verified_state = contact.is_verified(context).await;
let verified_str = if VerifiedStatus::Unverified != verified_state {
if verified_state == VerifiedStatus::BidirectVerified {
" √√"
} else {
""
}
let contact = Contact::get_by_id(context, *contact_id).await?;
let name = contact.get_display_name();
let addr = contact.get_addr();
let verified_state = contact.is_verified(context).await?;
let verified_str = if VerifiedStatus::Unverified != verified_state {
if verified_state == VerifiedStatus::BidirectVerified {
" √√"
} else {
""
};
line = format!(
"{}{} <{}>",
if !name.is_empty() {
&name
} else {
"<name unset>"
},
verified_str,
if !addr.is_empty() {
&addr
} else {
"addr unset"
}
);
let peerstate = Peerstate::from_addr(context, &addr)
.await
.expect("peerstate error");
if peerstate.is_some() && *contact_id != 1 {
line2 = format!(
", prefer-encrypt={}",
peerstate.as_ref().unwrap().prefer_encrypt
);
""
}
println!("Contact#{}: {}{}", *contact_id, line, line2);
} else {
""
};
let line = format!(
"{}{} <{}>",
if !name.is_empty() {
name
} else {
"<name unset>"
},
verified_str,
if !addr.is_empty() { addr } else { "addr unset" }
);
let peerstate = Peerstate::from_addr(context, addr)
.await
.expect("peerstate error");
if peerstate.is_some() && *contact_id != ContactId::SELF {
line2 = format!(
", prefer-encrypt={}",
peerstate.as_ref().unwrap().prefer_encrypt
);
}
println!("Contact#{}: {}{}", *contact_id, line, line2);
}
Ok(())
}
fn chat_prefix(chat: &Chat) -> &'static str {
chat.typ.into()
}
pub async fn cmdline(context: Context, line: &str, chat_id: &mut ChatId) -> Result<(), Error> {
pub async fn cmdline(context: Context, line: &str, chat_id: &mut ChatId) -> Result<()> {
let mut sel_chat = if !chat_id.is_unset() {
Chat::load_from_db(&context, *chat_id).await.ok()
Some(Chat::load_from_db(&context, *chat_id).await?)
} else {
None
};
@@ -350,6 +349,7 @@ pub async fn cmdline(context: Context, line: &str, chat_id: &mut ChatId) -> Resu
configure\n\
connect\n\
disconnect\n\
connectivity\n\
maybenetwork\n\
housekeeping\n\
help imex (Import/Export)\n\
@@ -359,6 +359,7 @@ pub async fn cmdline(context: Context, line: &str, chat_id: &mut ChatId) -> Resu
chat [<chat-id>|0]\n\
createchat <contact-id>\n\
creategroup <name>\n\
createbroadcast\n\
createprotected <name>\n\
addmember <contact-id>\n\
removemember <contact-id>\n\
@@ -371,8 +372,11 @@ pub async fn cmdline(context: Context, line: &str, chat_id: &mut ChatId) -> Resu
getlocations [<contact-id>]\n\
send <text>\n\
sendimage <file> [<text>]\n\
sendsticker <file> [<text>]\n\
sendfile <file> [<text>]\n\
sendhtml <file for html-part> [<text for plain-part>]\n\
sendsyncmsg\n\
sendupdate <msg-id> <json status update>\n\
videochat\n\
draft [<text>]\n\
devicemsg <text>\n\
@@ -386,16 +390,16 @@ pub async fn cmdline(context: Context, line: &str, chat_id: &mut ChatId) -> Resu
protect <chat-id>\n\
unprotect <chat-id>\n\
delchat <chat-id>\n\
===========================Contact requests==\n\
decidestartchat <msg-id>\n\
decideblock <msg-id>\n\
decidenotnow <msg-id>\n\
accept <chat-id>\n\
decline <chat-id>\n\
===========================Message commands==\n\
listmsgs <query>\n\
msginfo <msg-id>\n\
download <msg-id>\n\
html <msg-id>\n\
listfresh\n\
forward <msg-id> <chat-id>\n\
resend <msg-id>\n\
markseen <msg-id>\n\
delmsg <msg-id>\n\
===========================Contact commands==\n\
@@ -410,11 +414,12 @@ pub async fn cmdline(context: Context, line: &str, chat_id: &mut ChatId) -> Resu
listblocked\n\
======================================Misc.==\n\
getqr [<chat-id>]\n\
getqrsvg [<chat-id>]\n\
getbadqr\n\
checkqr <qr-content>\n\
joinqr <qr-content>\n\
setqr <qr-content>\n\
providerinfo <addr>\n\
event <event-id to test>\n\
fileinfo <file>\n\
estimatedeletion <seconds>\n\
clear -- clear screen\n\
@@ -449,27 +454,39 @@ pub async fn cmdline(context: Context, line: &str, chat_id: &mut ChatId) -> Resu
!arg1.is_empty() && !arg2.is_empty(),
"Arguments <msg-id> <setup-code> expected"
);
continue_key_transfer(&context, MsgId::new(arg1.parse()?), &arg2).await?;
continue_key_transfer(&context, MsgId::new(arg1.parse()?), arg2).await?;
}
"has-backup" => {
has_backup(&context, blobdir).await?;
}
"export-backup" => {
let dir = dirs::home_dir().unwrap_or_default();
imex(&context, ImexMode::ExportBackup, &dir).await?;
imex(
&context,
ImexMode::ExportBackup,
dir.as_ref(),
Some(arg2.to_string()),
)
.await?;
println!("Exported to {}.", dir.to_string_lossy());
}
"import-backup" => {
ensure!(!arg1.is_empty(), "Argument <backup-file> missing.");
imex(&context, ImexMode::ImportBackup, arg1).await?;
imex(
&context,
ImexMode::ImportBackup,
arg1.as_ref(),
Some(arg2.to_string()),
)
.await?;
}
"export-keys" => {
let dir = dirs::home_dir().unwrap_or_default();
imex(&context, ImexMode::ExportSelfKeys, &dir).await?;
imex(&context, ImexMode::ExportSelfKeys, dir.as_ref(), None).await?;
println!("Exported to {}.", dir.to_string_lossy());
}
"import-keys" => {
imex(&context, ImexMode::ImportSelfKeys, arg1).await?;
imex(&context, ImexMode::ImportSelfKeys, arg1.as_ref(), None).await?;
}
"export-setup" => {
let setup_code = create_setup_code(&context);
@@ -496,19 +513,33 @@ pub async fn cmdline(context: Context, line: &str, chat_id: &mut ChatId) -> Resu
}
"set" => {
ensure!(!arg1.is_empty(), "Argument <key> missing.");
let key = config::Config::from_str(&arg1)?;
let key = config::Config::from_str(arg1)?;
let value = if arg2.is_empty() { None } else { Some(arg2) };
context.set_config(key, value).await?;
}
"get" => {
ensure!(!arg1.is_empty(), "Argument <key> missing.");
let key = config::Config::from_str(&arg1)?;
let key = config::Config::from_str(arg1)?;
let val = context.get_config(key).await;
println!("{}={:?}", key, val);
}
"info" => {
println!("{:#?}", context.get_info().await);
}
"connectivity" => {
let file = dirs::home_dir()
.unwrap_or_default()
.join("connectivity.html");
match context.get_connectivity_html().await {
Ok(html) => {
fs::write(&file, html)?;
println!("Report written to: {:#?}", file);
}
Err(err) => {
bail!("Failed to get connectivity html: {}", err);
}
}
}
"maybenetwork" => {
context.maybe_network().await;
}
@@ -534,9 +565,9 @@ pub async fn cmdline(context: Context, line: &str, chat_id: &mut ChatId) -> Resu
);
for i in (0..cnt).rev() {
let chat = Chat::load_from_db(&context, chatlist.get_chat_id(i)).await?;
let chat = Chat::load_from_db(&context, chatlist.get_chat_id(i)?).await?;
println!(
"{}#{}: {} [{} fresh] {}{}{}",
"{}#{}: {} [{} fresh] {}{}{}{}",
chat_prefix(&chat),
chat.get_id(),
chat.get_name(),
@@ -548,27 +579,31 @@ pub async fn cmdline(context: Context, line: &str, chat_id: &mut ChatId) -> Resu
ChatVisibility::Pinned => "📌",
},
if chat.is_protected() { "🛡️" } else { "" },
if chat.is_contact_request() {
"🆕"
} else {
""
},
);
let lot = chatlist.get_summary(&context, i, Some(&chat)).await;
let summary = chatlist.get_summary(&context, i, Some(&chat)).await?;
let statestr = if chat.visibility == ChatVisibility::Archived {
" [Archived]"
} else {
match lot.get_state() {
LotState::MsgOutPending => " o",
LotState::MsgOutDelivered => "",
LotState::MsgOutMdnRcvd => " √√",
LotState::MsgOutFailed => " !!",
match summary.state {
MessageState::OutPending => " o",
MessageState::OutDelivered => "",
MessageState::OutMdnRcvd => " √√",
MessageState::OutFailed => " !!",
_ => "",
}
};
let timestr = dc_timestamp_to_str(lot.get_timestamp());
let text1 = lot.get_text1();
let text2 = lot.get_text2();
let timestr = dc_timestamp_to_str(summary.timestamp);
println!(
"{}{}{}{} [{}]{}",
text1.unwrap_or(""),
if text1.is_some() { ": " } else { "" },
text2.unwrap_or(""),
"{}{}{} [{}]{}",
summary
.prefix
.map_or_else(String::new, |prefix| format!("{}: ", prefix)),
summary.text,
statestr,
&timestr,
if chat.is_sending_locations() {
@@ -582,7 +617,7 @@ pub async fn cmdline(context: Context, line: &str, chat_id: &mut ChatId) -> Resu
);
}
}
if location::is_sending_locations_to_chat(&context, None).await {
if location::is_sending_locations_to_chat(&context, None).await? {
println!("Location streaming enabled.");
}
println!("{} chats", cnt);
@@ -602,12 +637,15 @@ pub async fn cmdline(context: Context, line: &str, chat_id: &mut ChatId) -> Resu
ensure!(sel_chat.is_some(), "Failed to select chat");
let sel_chat = sel_chat.as_ref().unwrap();
let msglist = chat::get_chat_msgs(&context, sel_chat.get_id(), 0x1, None).await?;
let time_start = std::time::SystemTime::now();
let msglist =
chat::get_chat_msgs(&context, sel_chat.get_id(), DC_GCM_ADDDAYMARKER).await?;
let time_needed = time_start.elapsed().unwrap_or_default();
let msglist: Vec<MsgId> = msglist
.into_iter()
.map(|x| match x {
ChatItem::Message { msg_id } => msg_id,
ChatItem::Marker1 => MsgId::new(DC_MSG_ID_MARKER1),
ChatItem::DayMarker { .. } => MsgId::new(DC_MSG_ID_DAYMARKER),
})
.collect();
@@ -657,44 +695,23 @@ pub async fn cmdline(context: Context, line: &str, chat_id: &mut ChatId) -> Resu
"{} messages.",
sel_chat.get_id().get_msg_cnt(&context).await?
);
let time_noticed_start = std::time::SystemTime::now();
chat::marknoticed_chat(&context, sel_chat.get_id()).await?;
let time_noticed_needed = time_noticed_start.elapsed().unwrap_or_default();
println!(
"{:?} to create this list, {:?} to mark all messages as noticed.",
time_needed, time_noticed_needed
);
}
"createchat" => {
ensure!(!arg1.is_empty(), "Argument <contact-id> missing.");
let contact_id: u32 = arg1.parse()?;
let chat_id = chat::create_by_contact_id(&context, contact_id).await?;
let contact_id = ContactId::new(arg1.parse()?);
let chat_id = ChatId::create_for_contact(&context, contact_id).await?;
println!("Single#{} created successfully.", chat_id,);
}
"decidestartchat" | "createchatbymsg" => {
ensure!(!arg1.is_empty(), "Argument <msg-id> missing");
let msg_id = MsgId::new(arg1.parse()?);
match message::decide_on_contact_request(
&context,
msg_id,
ContactRequestDecision::StartChat,
)
.await
{
Some(chat_id) => {
let chat = Chat::load_from_db(&context, chat_id).await?;
println!("{}#{} created successfully.", chat_prefix(&chat), chat_id);
}
None => println!("Cannot crate chat."),
}
}
"decidenotnow" => {
ensure!(!arg1.is_empty(), "Argument <msg-id> missing");
let msg_id = MsgId::new(arg1.parse()?);
message::decide_on_contact_request(&context, msg_id, ContactRequestDecision::NotNow)
.await;
}
"decideblock" => {
ensure!(!arg1.is_empty(), "Argument <msg-id> missing");
let msg_id = MsgId::new(arg1.parse()?);
message::decide_on_contact_request(&context, msg_id, ContactRequestDecision::Block)
.await;
}
"creategroup" => {
ensure!(!arg1.is_empty(), "Argument <name> missing.");
let chat_id =
@@ -702,6 +719,11 @@ pub async fn cmdline(context: Context, line: &str, chat_id: &mut ChatId) -> Resu
println!("Group#{} created successfully.", chat_id);
}
"createbroadcast" => {
let chat_id = chat::create_broadcast_list(&context).await?;
println!("Broadcast#{} created successfully.", chat_id);
}
"createprotected" => {
ensure!(!arg1.is_empty(), "Argument <name> missing.");
let chat_id =
@@ -713,23 +735,15 @@ pub async fn cmdline(context: Context, line: &str, chat_id: &mut ChatId) -> Resu
ensure!(sel_chat.is_some(), "No chat selected");
ensure!(!arg1.is_empty(), "Argument <contact-id> missing.");
let contact_id_0: u32 = arg1.parse()?;
if chat::add_contact_to_chat(
&context,
sel_chat.as_ref().unwrap().get_id(),
contact_id_0,
)
.await
{
println!("Contact added to chat.");
} else {
bail!("Cannot add contact to chat.");
}
let contact_id_0 = ContactId::new(arg1.parse()?);
chat::add_contact_to_chat(&context, sel_chat.as_ref().unwrap().get_id(), contact_id_0)
.await?;
println!("Contact added to chat.");
}
"removemember" => {
ensure!(sel_chat.is_some(), "No chat selected.");
ensure!(!arg1.is_empty(), "Argument <contact-id> missing.");
let contact_id_1: u32 = arg1.parse()?;
let contact_id_1 = ContactId::new(arg1.parse()?);
chat::remove_contact_from_chat(
&context,
sel_chat.as_ref().unwrap().get_id(),
@@ -742,7 +756,12 @@ pub async fn cmdline(context: Context, line: &str, chat_id: &mut ChatId) -> Resu
"groupname" => {
ensure!(sel_chat.is_some(), "No chat selected.");
ensure!(!arg1.is_empty(), "Argument <name> missing.");
chat::set_chat_name(&context, sel_chat.as_ref().unwrap().get_id(), arg1).await?;
chat::set_chat_name(
&context,
sel_chat.as_ref().unwrap().get_id(),
format!("{} {}", arg1, arg2).trim(),
)
.await?;
println!("Chat name set");
}
@@ -762,7 +781,7 @@ pub async fn cmdline(context: Context, line: &str, chat_id: &mut ChatId) -> Resu
chat::get_chat_contacts(&context, sel_chat.as_ref().unwrap().get_id()).await?;
println!("Memberlist:");
log_contactlist(&context, &contacts).await;
log_contactlist(&context, &contacts).await?;
println!(
"{} contacts\nLocation streaming: {}",
contacts.len(),
@@ -770,7 +789,7 @@ pub async fn cmdline(context: Context, line: &str, chat_id: &mut ChatId) -> Resu
&context,
Some(sel_chat.as_ref().unwrap().get_id())
)
.await,
.await?,
);
}
"getlocations" => {
@@ -815,7 +834,7 @@ pub async fn cmdline(context: Context, line: &str, chat_id: &mut ChatId) -> Resu
sel_chat.as_ref().unwrap().get_id(),
seconds,
)
.await;
.await?;
println!(
"Locations will be sent to Chat#{} for {} seconds. Use 'setlocation <lat> <lng>' to play around.",
sel_chat.as_ref().unwrap().get_id(),
@@ -852,12 +871,14 @@ pub async fn cmdline(context: Context, line: &str, chat_id: &mut ChatId) -> Resu
ensure!(sel_chat.is_some(), "No chat selected.");
chat::send_text_msg(&context, sel_chat.as_ref().unwrap().get_id(), "".into()).await?;
}
"sendimage" | "sendfile" => {
"sendimage" | "sendsticker" | "sendfile" => {
ensure!(sel_chat.is_some(), "No chat selected.");
ensure!(!arg1.is_empty(), "No file given.");
let mut msg = Message::new(if arg0 == "sendimage" {
Viewtype::Image
} else if arg0 == "sendsticker" {
Viewtype::Sticker
} else {
Viewtype::File
});
@@ -883,6 +904,20 @@ pub async fn cmdline(context: Context, line: &str, chat_id: &mut ChatId) -> Resu
}));
chat::send_msg(&context, sel_chat.as_ref().unwrap().get_id(), &mut msg).await?;
}
"sendsyncmsg" => match context.send_sync_msg().await? {
Some(msg_id) => println!("sync message sent as {}.", msg_id),
None => println!("sync message not needed."),
},
"sendupdate" => {
ensure!(
!arg1.is_empty() && !arg2.is_empty(),
"Arguments <msg-id> <json status update> expected"
);
let msg_id = MsgId::new(arg1.parse()?);
context
.send_webxdc_status_update(msg_id, arg2, "this is a webxdc status update")
.await?;
}
"videochat" => {
ensure!(sel_chat.is_some(), "No chat selected.");
chat::send_videochat_invitation(&context, sel_chat.as_ref().unwrap().get_id()).await?;
@@ -890,18 +925,24 @@ pub async fn cmdline(context: Context, line: &str, chat_id: &mut ChatId) -> Resu
"listmsgs" => {
ensure!(!arg1.is_empty(), "Argument <query> missing.");
let chat = if let Some(ref sel_chat) = sel_chat {
Some(sel_chat.get_id())
} else {
None
};
let query = format!("{} {}", arg1, arg2).trim().to_string();
let chat = sel_chat.as_ref().map(|sel_chat| sel_chat.get_id());
let time_start = std::time::SystemTime::now();
let msglist = context.search_msgs(chat, arg1).await?;
let msglist = context.search_msgs(chat, &query).await?;
let time_needed = time_start.elapsed().unwrap_or_default();
log_msglist(&context, &msglist).await?;
println!("{} messages.", msglist.len());
println!(
"{}{} messages for {}search of \"{}\"",
msglist.len(),
if msglist.len() == 1000 { "+" } else { "" },
if chat.is_none() {
"global "
} else {
"in-chat-"
},
query,
);
println!("{:?} to create this list", time_needed);
}
"draft" => {
@@ -1009,12 +1050,28 @@ pub async fn cmdline(context: Context, line: &str, chat_id: &mut ChatId) -> Resu
let chat_id = ChatId::new(arg1.parse()?);
chat_id.delete(&context).await?;
}
"accept" => {
ensure!(!arg1.is_empty(), "Argument <chat-id> missing.");
let chat_id = ChatId::new(arg1.parse()?);
chat_id.accept(&context).await?;
}
"blockchat" => {
ensure!(!arg1.is_empty(), "Argument <chat-id> missing.");
let chat_id = ChatId::new(arg1.parse()?);
chat_id.block(&context).await?;
}
"msginfo" => {
ensure!(!arg1.is_empty(), "Argument <msg-id> missing.");
let id = MsgId::new(arg1.parse()?);
let res = message::get_msg_info(&context, id).await?;
println!("{}", res);
}
"download" => {
ensure!(!arg1.is_empty(), "Argument <msg-id> missing.");
let id = MsgId::new(arg1.parse()?);
println!("Scheduling download for {:?}", id);
id.download_full(&context).await?;
}
"html" => {
ensure!(!arg1.is_empty(), "Argument <msg-id> missing.");
let id = MsgId::new(arg1.parse()?);
@@ -1042,17 +1099,24 @@ pub async fn cmdline(context: Context, line: &str, chat_id: &mut ChatId) -> Resu
msg_ids[0] = MsgId::new(arg1.parse()?);
chat::forward_msgs(&context, &msg_ids, chat_id).await?;
}
"resend" => {
ensure!(!arg1.is_empty(), "Arguments <msg-id> expected");
let mut msg_ids = [MsgId::new(0); 1];
msg_ids[0] = MsgId::new(arg1.parse()?);
chat::resend_msgs(&context, &msg_ids).await?;
}
"markseen" => {
ensure!(!arg1.is_empty(), "Argument <msg-id> missing.");
let mut msg_ids = vec![MsgId::new(0)];
msg_ids[0] = MsgId::new(arg1.parse()?);
message::markseen_msgs(&context, msg_ids).await;
message::markseen_msgs(&context, msg_ids).await?;
}
"delmsg" => {
ensure!(!arg1.is_empty(), "Argument <msg-id> missing.");
let mut ids = [MsgId::new(0); 1];
ids[0] = MsgId::new(arg1.parse()?);
message::delete_msgs(&context, &ids).await;
message::delete_msgs(&context, &ids).await?;
}
"listcontacts" | "contacts" | "listverified" => {
let contacts = Contact::get_all(
@@ -1065,7 +1129,7 @@ pub async fn cmdline(context: Context, line: &str, chat_id: &mut ChatId) -> Resu
Some(arg1),
)
.await?;
log_contactlist(&context, &contacts).await;
log_contactlist(&context, &contacts).await?;
println!("{} contacts.", contacts.len());
}
"addcontact" => {
@@ -1073,7 +1137,7 @@ pub async fn cmdline(context: Context, line: &str, chat_id: &mut ChatId) -> Resu
if !arg2.is_empty() {
let book = format!("{}\n{}", arg1, arg2);
Contact::add_address_book(&context, book).await?;
Contact::add_address_book(&context, &book).await?;
} else {
Contact::create(&context, "", arg1).await?;
}
@@ -1081,7 +1145,7 @@ pub async fn cmdline(context: Context, line: &str, chat_id: &mut ChatId) -> Resu
"contactinfo" => {
ensure!(!arg1.is_empty(), "Argument <contact-id> missing.");
let contact_id: u32 = arg1.parse()?;
let contact_id = ContactId::new(arg1.parse()?);
let contact = Contact::get_by_id(&context, contact_id).await?;
let name_n_addr = contact.get_name_n_addr();
@@ -1107,7 +1171,7 @@ pub async fn cmdline(context: Context, line: &str, chat_id: &mut ChatId) -> Resu
if 0 != i {
res += ", ";
}
let chat = Chat::load_from_db(&context, chatlist.get_chat_id(i)).await?;
let chat = Chat::load_from_db(&context, chatlist.get_chat_id(i)?).await?;
res += &format!("{}#{}", chat_prefix(&chat), chat.get_id());
}
}
@@ -1116,33 +1180,27 @@ pub async fn cmdline(context: Context, line: &str, chat_id: &mut ChatId) -> Resu
}
"delcontact" => {
ensure!(!arg1.is_empty(), "Argument <contact-id> missing.");
Contact::delete(&context, arg1.parse()?).await?;
Contact::delete(&context, ContactId::new(arg1.parse()?)).await?;
}
"block" => {
ensure!(!arg1.is_empty(), "Argument <contact-id> missing.");
let contact_id = arg1.parse()?;
Contact::block(&context, contact_id).await;
let contact_id = ContactId::new(arg1.parse()?);
Contact::block(&context, contact_id).await?;
}
"unblock" => {
ensure!(!arg1.is_empty(), "Argument <contact-id> missing.");
let contact_id = arg1.parse()?;
Contact::unblock(&context, contact_id).await;
let contact_id = ContactId::new(arg1.parse()?);
Contact::unblock(&context, contact_id).await?;
}
"listblocked" => {
let contacts = Contact::get_all_blocked(&context).await?;
log_contactlist(&context, &contacts).await;
log_contactlist(&context, &contacts).await?;
println!("{} blocked contacts.", contacts.len());
}
"checkqr" => {
ensure!(!arg1.is_empty(), "Argument <qr-content> missing.");
let res = check_qr(&context, arg1).await;
println!(
"state={}, id={}, text1={:?}, text2={:?}",
res.get_state(),
res.get_id(),
res.get_text1(),
res.get_text2()
);
let qr = check_qr(&context, arg1).await?;
println!("qr={:?}", qr);
}
"setqr" => {
ensure!(!arg1.is_empty(), "Argument <qr-content> missing.");
@@ -1153,7 +1211,10 @@ pub async fn cmdline(context: Context, line: &str, chat_id: &mut ChatId) -> Resu
}
"providerinfo" => {
ensure!(!arg1.is_empty(), "Argument <addr> missing.");
match provider::get_provider_info(arg1).await {
let socks5_enabled = context
.get_config_bool(config::Config::Socks5Enabled)
.await?;
match provider::get_provider_info(&context, arg1, socks5_enabled).await {
Some(info) => {
println!("Information for provider belonging to {}:", arg1);
println!("status: {}", info.status as u32);
@@ -1169,17 +1230,6 @@ pub async fn cmdline(context: Context, line: &str, chat_id: &mut ChatId) -> Resu
}
}
}
// TODO: implement this again, unclear how to match this through though, without writing a parser.
// "event" => {
// ensure!(!arg1.is_empty(), "Argument <id> missing.");
// let event = arg1.parse()?;
// let event = EventType::from_u32(event).ok_or(format_err!("EventType::from_u32({})", event))?;
// let r = context.emit_event(event, 0 as libc::uintptr_t, 0 as libc::uintptr_t);
// println!(
// "Sending event {:?}({}), received value {}.",
// event, event as usize, r,
// );
// }
"fileinfo" => {
ensure!(!arg1.is_empty(), "Argument <file> missing.");

View File

@@ -26,12 +26,15 @@ use rustyline::config::OutputStreamType;
use rustyline::error::ReadlineError;
use rustyline::highlight::{Highlighter, MatchingBracketHighlighter};
use rustyline::hint::{Hinter, HistoryHinter};
use rustyline::validate::Validator;
use rustyline::{
Cmd, CompletionType, Config, Context as RustyContext, EditMode, Editor, Helper, KeyPress,
Cmd, CompletionType, Config, Context as RustyContext, EditMode, Editor, Helper, KeyEvent,
};
mod cmdline;
use self::cmdline::*;
use deltachat::qr_code_generator::get_securejoin_qr_svg;
use std::fs;
/// Event Handler
fn receive_event(event: EventType) {
@@ -56,9 +59,6 @@ fn receive_event(event: EventType) {
EventType::Error(msg) => {
error!("{}", msg);
}
EventType::ErrorNetwork(msg) => {
error!("[NETWORK] msg={}", msg);
}
EventType::ErrorSelfNotInGroup(msg) => {
error!("[SELF_NOT_IN_GROUP] {}", msg);
}
@@ -156,7 +156,7 @@ const IMEX_COMMANDS: [&str; 12] = [
"stop",
];
const DB_COMMANDS: [&str; 9] = [
const DB_COMMANDS: [&str; 10] = [
"info",
"set",
"get",
@@ -164,20 +164,19 @@ const DB_COMMANDS: [&str; 9] = [
"configure",
"connect",
"disconnect",
"connectivity",
"maybenetwork",
"housekeeping",
];
const CHAT_COMMANDS: [&str; 34] = [
const CHAT_COMMANDS: [&str; 36] = [
"listchats",
"listarchived",
"chat",
"createchat",
"decidestartchat",
"decideblock",
"decidenotnow",
"creategroup",
"createverified",
"createbroadcast",
"createprotected",
"addmember",
"removemember",
"groupname",
@@ -191,6 +190,8 @@ const CHAT_COMMANDS: [&str; 34] = [
"sendimage",
"sendfile",
"sendhtml",
"sendsyncmsg",
"sendupdate",
"videochat",
"draft",
"listmedia",
@@ -203,14 +204,18 @@ const CHAT_COMMANDS: [&str; 34] = [
"protect",
"unprotect",
"delchat",
"accept",
"blockchat",
];
const MESSAGE_COMMANDS: [&str; 6] = [
const MESSAGE_COMMANDS: [&str; 8] = [
"listmsgs",
"msginfo",
"listfresh",
"forward",
"resend",
"markseen",
"delmsg",
"download",
];
const CONTACT_COMMANDS: [&str; 9] = [
"listcontacts",
@@ -223,11 +228,12 @@ const CONTACT_COMMANDS: [&str; 9] = [
"unblock",
"listblocked",
];
const MISC_COMMANDS: [&str; 10] = [
const MISC_COMMANDS: [&str; 11] = [
"getqr",
"getqrsvg",
"getbadqr",
"checkqr",
"event",
"joinqr",
"fileinfo",
"clear",
"exit",
@@ -237,7 +243,9 @@ const MISC_COMMANDS: [&str; 10] = [
];
impl Hinter for DcHelper {
fn hint(&self, line: &str, pos: usize, ctx: &RustyContext<'_>) -> Option<String> {
type Hint = String;
fn hint(&self, line: &str, pos: usize, ctx: &RustyContext<'_>) -> Option<Self::Hint> {
if !line.is_empty() {
for &cmds in &[
&IMEX_COMMANDS[..],
@@ -259,11 +267,10 @@ impl Hinter for DcHelper {
}
static COLORED_PROMPT: &str = "\x1b[1;32m> \x1b[0m";
static PROMPT: &str = "> ";
impl Highlighter for DcHelper {
fn highlight_prompt<'p>(&self, prompt: &'p str) -> Cow<'p, str> {
if prompt == PROMPT {
fn highlight_prompt<'b, 's: 'b, 'p: 'b>(&self, prompt: &'p str, default: bool) -> Cow<'b, str> {
if default {
Borrowed(COLORED_PROMPT)
} else {
Borrowed(prompt)
@@ -284,13 +291,14 @@ impl Highlighter for DcHelper {
}
impl Helper for DcHelper {}
impl Validator for DcHelper {}
async fn start(args: Vec<String>) -> Result<(), Error> {
if args.len() < 2 {
println!("Error: Bad arguments, expected [db-name].");
bail!("No db-name specified");
}
let context = Context::new("CLI".into(), Path::new(&args[1]).to_path_buf(), 0).await?;
let context = Context::new(Path::new(&args[1]).to_path_buf(), 0).await?;
let events = context.get_event_emitter();
async_std::task::spawn(async move {
@@ -317,15 +325,15 @@ async fn start(args: Vec<String>) -> Result<(), Error> {
};
let mut rl = Editor::with_config(config);
rl.set_helper(Some(h));
rl.bind_sequence(KeyPress::Meta('N'), Cmd::HistorySearchForward);
rl.bind_sequence(KeyPress::Meta('P'), Cmd::HistorySearchBackward);
rl.bind_sequence(KeyEvent::alt('N'), Cmd::HistorySearchForward);
rl.bind_sequence(KeyEvent::alt('P'), Cmd::HistorySearchBackward);
if rl.load_history(".dc-history.txt").is_err() {
println!("No previous history.");
}
loop {
let p = "> ";
let readline = rl.readline(&p);
let readline = rl.readline(p);
match readline {
Ok(line) => {
@@ -392,7 +400,7 @@ async fn handle_cmd(
"oauth2" => {
if let Some(addr) = ctx.get_config(config::Config::Addr).await? {
let oauth2_url =
dc_get_oauth2_url(&ctx, &addr, "chat.delta:/com.b44t.messenger").await;
dc_get_oauth2_url(&ctx, &addr, "chat.delta:/com.b44t.messenger").await?;
if oauth2_url.is_none() {
println!("OAuth2 not available for {}.", &addr);
} else {
@@ -408,19 +416,32 @@ async fn handle_cmd(
}
"getqr" | "getbadqr" => {
ctx.start_io().await;
let group = arg1.parse::<u32>().ok().map(|id| ChatId::new(id));
if let Some(mut qr) = dc_get_securejoin_qr(&ctx, group).await {
if !qr.is_empty() {
if arg0 == "getbadqr" && qr.len() > 40 {
qr.replace_range(12..22, "0000000000")
}
println!("{}", qr);
let output = Command::new("qrencode")
.args(&["-t", "ansiutf8", qr.as_str(), "-o", "-"])
.output()
.expect("failed to execute process");
io::stdout().write_all(&output.stdout).unwrap();
io::stderr().write_all(&output.stderr).unwrap();
let group = arg1.parse::<u32>().ok().map(ChatId::new);
let mut qr = dc_get_securejoin_qr(&ctx, group).await?;
if !qr.is_empty() {
if arg0 == "getbadqr" && qr.len() > 40 {
qr.replace_range(12..22, "0000000000")
}
println!("{}", qr);
let output = Command::new("qrencode")
.args(&["-t", "ansiutf8", qr.as_str(), "-o", "-"])
.output()
.expect("failed to execute process");
io::stdout().write_all(&output.stdout).unwrap();
io::stderr().write_all(&output.stderr).unwrap();
}
}
"getqrsvg" => {
ctx.start_io().await;
let group = arg1.parse::<u32>().ok().map(ChatId::new);
let file = dirs::home_dir().unwrap_or_default().join("qr.svg");
match get_securejoin_qr_svg(&ctx, group).await {
Ok(svg) => {
fs::write(&file, svg)?;
println!("QR code svg written to: {:#?}", file);
}
Err(err) => {
bail!("Failed to get QR code svg: {}", err);
}
}
}

View File

@@ -1,6 +1,6 @@
use tempfile::tempdir;
use deltachat::chat;
use deltachat::chat::{self, ChatId};
use deltachat::chatlist::*;
use deltachat::config;
use deltachat::contact::*;
@@ -19,7 +19,7 @@ fn cb(event: EventType) {
EventType::Warning(msg) => {
log::warn!("{}", msg);
}
EventType::Error(msg) | EventType::ErrorNetwork(msg) => {
EventType::Error(msg) => {
log::error!("{}", msg);
}
event => {
@@ -36,7 +36,7 @@ async fn main() {
let dir = tempdir().unwrap();
let dbfile = dir.path().join("db.sqlite");
log::info!("creating database {:?}", dbfile);
let ctx = Context::new("FakeOs".into(), dbfile.into(), 0)
let ctx = Context::new(dbfile.into(), 0)
.await
.expect("Failed to create context");
let info = ctx.get_info().await;
@@ -70,7 +70,7 @@ async fn main() {
let contact_id = Contact::create(&ctx, "dignifiedquire", "dignifiedquire@gmail.com")
.await
.unwrap();
let chat_id = chat::create_by_contact_id(&ctx, contact_id).await.unwrap();
let chat_id = ChatId::create_for_contact(&ctx, contact_id).await.unwrap();
for i in 0..1 {
log::info!("sending message {}", i);
@@ -86,7 +86,7 @@ async fn main() {
let chats = Chatlist::try_load(&ctx, 0, None, None).await.unwrap();
for i in 0..chats.len() {
let msg = Message::load_from_db(&ctx, chats.get_msg_id(i).unwrap())
let msg = Message::load_from_db(&ctx, chats.get_msg_id(i).unwrap().unwrap())
.await
.unwrap();
log::info!("[{}] msg: {:?}", i, msg);

6
node/.prettierrc.yml Normal file
View File

@@ -0,0 +1,6 @@
# .prettierrc
trailingComma: es5
tabWidth: 2
semi: false
singleQuote: true
jsxSingleQuote: true

21
node/CONTRIBUTORS.md Normal file
View File

@@ -0,0 +1,21 @@
# Contributors
| Name | GitHub |
| :-------------------- | :----------------------------------------------- |
| **Lars-Magnus Skog** | |
| **jikstra** | |
| **Simon Laux** | [**@Simon-Laux**](https://github.com/Simon-Laux) |
| **Jikstra** | [**@Jikstra**](https://github.com/Jikstra) |
| **Nico de Haen** | |
| **B. Petersen** | |
| **Karissa McKelvey** | [**@karissa**](https://github.com/karissa) |
| **developer** | |
| **Alexander Krotov** | |
| **Floris Bruynooghe** | |
| **lefherz** | |
| **Pablo** | [**@pabzm**](https://github.com/pabzm) |
| **pabzm** | |
| **holger krekel** | |
| **Robert Schütz** | |
| **bb** | |
| **Charles Paul** | |

674
node/LICENSE Normal file
View File

@@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

247
node/README.md Normal file
View File

@@ -0,0 +1,247 @@
# deltachat-node
> node.js bindings for [`deltachat-core-rust`](..)
[![npm](https://img.shields.io/npm/v/deltachat-node.svg)](https://www.npmjs.com/package/deltachat-node)
![Node version](https://img.shields.io/node/v/deltachat-node.svg)
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-prettier-brightgreen.svg)](https://prettier.io)
`deltachat-node` primarily aims to offer two things:
- A high level JavaScript api with syntactic sugar
- A low level c binding api around [`deltachat-core-rust`](..)
This code used to live at [`deltachat-node`](https://github.com/deltachat/deltachat-node)
## Table of Contents
<details><summary>Click to expand</summary>
- [Install](#install)
- [Dependencies](#dependencies)
- [Build from source](#build-from-source)
- [Usage](#usage)
- [Developing](#developing)
- [License](#license)
</details>
## Install
By default the installation will build try to use the bundled prebuilds in the
npm package. If this fails it falls back to compile `../deltachat-core-rust` from
this repository, using `scripts/rebuild-core.js`.
To install from npm use:
```
npm install deltachat-node
```
## Dependencies
- Nodejs >= `v16.0.0`
- rustup (optional if you can't use the prebuilds)
> On Windows, you may need to also install **Perl** to be able to compile deltachat-core.
## Build from source
If you want to build from source, make sure that you have `rustup` installed.
You can either use `npm install deltachat-node --build-from-source` to force
building from source or clone this repository and follow this steps:
1. `git clone https://github.com/deltachat/deltachat-core-rust.git`
2. `cd deltachat-core-rust`
3. `npm i`
4. `npm run build`
> Our `package.json` file is located in the root directory of this repository,
> not inside this folder. (We need this in order to include the rust source
> code in the npm package.)
### Use build-from-source in deltachat-desktop
If you want to use the manually built node bindings in the desktop client (for
example), you can follow these instructions:
First clone the
[deltachat-desktop](https://github.com/deltachat/deltachat-desktop) repository,
e.g. with `git clone https://github.com/deltachat/deltachat-desktop`.
Then you need to make sure that this directory is referenced correctly in
deltachat-desktop's package.json. You need to change
`deltachat-desktop/package.json` like this:
```
diff --git i/package.json w/package.json
index 45893894..5154512c 100644
--- i/package.json
+++ w/package.json
@@ -83,7 +83,7 @@
"application-config": "^1.0.1",
"classnames": "^2.3.1",
"debounce": "^1.2.0",
- "deltachat-node": "1.79.3",
+ "deltachat-node": "file:../deltachat-core-rust/",
"emoji-js-clean": "^4.0.0",
"emoji-mart": "^3.0.1",
"emoji-regex": "^9.2.2",
```
Then, in the `deltachat-desktop` repository, run:
1. `npm i`
2. `npm run build`
3. And `npm run start` to start the newly built client.
### Workaround to build for x86_64 on Apple's M1
deltachat doesn't support universal (fat) binaries (that contain builds for both cpu architectures) yet, until it does you can use the following workaround to get x86_64 builds:
```
$ fnm install 17 --arch x64
$ fnm use 17
$ node -p process.arch
# result should be x64
$ cd deltachat-core-rust && rustup target add x86_64-apple-darwin && cd -
$ git apply patches/m1_build_use_x86_64.patch
$ CARGO_BUILD_TARGET=x86_64-apple-darwin npm run build
$ npm run test
```
(when using [fnm](https://github.com/Schniz/fnm) instead of nvm, you can select the architecture)
If your node and electron are already build for arm64 you can also try bulding for arm:
```
$ fnm install 16 --arch arm64
$ fnm use 16
$ node -p process.arch
# result should be arm64
$ npm_config_arch=arm64 npm run build
$ npm run test
```
## Usage
```js
const { Context } = require('deltachat-node')
const opts = {
addr: '[email]',
mail_pw: '[password]',
}
const contact = '[email]'
async function main() {
const dc = Context.open('./')
dc.on('ALL', console.log.bind(null, 'core |'))
try {
await dc.configure(opts)
} catch (err) {
console.error('Failed to configure because of: ', err)
dc.unref()
return
}
dc.startIO()
console.log('fully configured')
const contactId = dc.createContact('Test', contact)
const chatId = dc.createChatByContactId(contactId)
dc.sendMessage(chatId, 'Hi!')
console.log('sent message')
dc.once('DC_EVENT_SMTP_MESSAGE_SENT', async () => {
console.log('Message sent, shutting down...')
dc.stopIO()
console.log('stopped io')
dc.unref()
})
}
main()
```
this example can also be found in the examples folder [examples/send_message.js](./examples/send_message.js)
### Generating Docs
We are curently migrating to automaticaly generated documentation.
You can find the old documentation at [old_docs](./old_docs).
to generate the documentation, run:
```
npx typedoc
```
The resulting documentation can be found in the `docs/` folder.
An online version can be found under [js.delta.chat](https://js.delta.chat).
## Developing
### Tests and Coverage
Running `npm test` ends with showing a code coverage report, which is produced by [`nyc`](https://github.com/istanbuljs/nyc#readme).
![test output](images/tests.png)
The coverage report from `nyc` in the console is rather limited. To get a more detailed coverage report you can run `npm run coverage-html-report`. This will produce a html report from the `nyc` data and display it in a browser on your local machine.
To run the integration tests you need to set the `DCC_NEW_TMP_EMAIL` environment variables. E.g.:
```
$ export DCC_NEW_TMP_EMAIL=https://testrun.org/new_email?t=[token]
$ npm run test
```
### Scripts
We have the following scripts for building, testing and coverage:
- `npm run coverage` Creates a coverage report and passes it to `coveralls`. Only done by `Travis`.
- `npm run coverage-html-report` Generates a html report from the coverage data and opens it in a browser on the local machine.
- `npm run generate-constants` Generates `constants.js` and `events.js` based on the `deltachat-core-rust/deltachat-ffi/deltachat.h` header file.
- `npm install` After dependencies are installed, runs `node-gyp-build` to see if the native code needs to be rebuilt.
- `npm run build` Rebuilds all code.
- `npm run build:core` Rebuilds code in `deltachat-core-rust`.
- `npm run build:bindings` Rebuilds the bindings and links with `deltachat-core-rust`.
- `ǹpm run clean` Removes all built code
- `npm run prebuildify` Builds prebuilt binary to `prebuilds/$PLATFORM-$ARCH`. Copies `deltachat.dll` from `deltachat-core-rust` for windows.
- `npm run download-prebuilds` Downloads all prebuilt binaries from github before `npm publish`.
- `npm test` Runs `standard` and then the tests in `test/index.js`.
- `npm run test-integration` Runs the integration tests.
- `npm run hallmark` Runs `hallmark` on all markdown files.
### Releases
The following steps are needed to make a release:
1. Wait until `pack-module` github action is completed
2. Run `npm publish https://download.delta.chat/node/deltachat-node-v1.x.x.tar.gz` to publish it to npm. You probably need write rights to npm.
## License
Licensed under `GPL-3.0-or-later`, see [LICENSE](./LICENSE) file for details.
> Copyright © 2018 `DeltaChat` contributors.
>
> This program is free software: you can redistribute it and/or modify
> it under the terms of the GNU General Public License as published by
> the Free Software Foundation, either version 3 of the License, or
> (at your option) any later version.
>
> This program is distributed in the hope that it will be useful,
> but WITHOUT ANY WARRANTY; without even the implied warranty of
> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> GNU General Public License for more details.
>
> You should have received a copy of the GNU General Public License
> along with this program. If not, see <http://www.gnu.org/licenses/>.
[appveyor-shield]: https://ci.appveyor.com/api/projects/status/t0narp672wpbl6pd?svg=true
[appveyor]: https://ci.appveyor.com/project/ralphtheninja/deltachat-node-d4bf8

78
node/binding.gyp Normal file
View File

@@ -0,0 +1,78 @@
{
# documentation about the format of this file can be found under https://gyp.gsrc.io/docs/InputFormatReference.md
# Variables can be specified when calling node-gyp as so:
# node-gyp configure -- -Dvarname=value
"variables": {
# Whether to use a system-wide installation of deltachat-core
# using pkg-config. Set to either "true" or "false".
"USE_SYSTEM_LIBDELTACHAT%": "<!(echo $USE_SYSTEM_LIBDELTACHAT)",
},
"targets": [
{
"target_name": "deltachat",
"sources": ["./src/module.c"],
"include_dirs": ["<!(node -e \"require('napi-macros')\")"],
"conditions": [
[
"OS == 'win'",
{
"include_dirs": ["../deltachat-ffi"],
"libraries": [
"../../target/release/deltachat.dll.lib",
],
"conditions": [
[
"USE_SYSTEM_LIBDELTACHAT == 'true'",
{
"cflags": ["<!(pkg-config --cflags deltachat)"],
"libraries": ["<!(pkg-config --libs deltachat)"],
},
],
],
},
],
[
"OS == 'linux' or OS == 'mac'",
{
"libraries": ["-lpthread"],
"cflags": ["-std=gnu99"],
"conditions": [
[
"USE_SYSTEM_LIBDELTACHAT != 'true'",
{
"include_dirs": ["../deltachat-ffi"],
"ldflags": ["-Wl,-Bsymbolic"], # Prevent sqlite3 from electron from overriding sqlcipher
"libraries": [
"../../target/release/libdeltachat.a",
"-ldl",
],
"conditions": [],
},
{
# USE_SYSTEM_LIBDELTACHAT == 'true'
"cflags": ["<!(pkg-config --cflags deltachat)"],
"libraries": ["<!(pkg-config --libs deltachat)"],
},
],
[
"OS == 'mac'",
{
"libraries": [
"-framework CoreFoundation",
"-framework CoreServices",
"-framework Security",
"-lresolv",
],
},
{
# OS == 'linux'
"libraries": ["-lm", "-lrt"],
},
],
],
},
],
],
},
],
}

1
node/binding.js Normal file
View File

@@ -0,0 +1 @@
module.exports = require('node-gyp-build')(__dirname)

226
node/constants.js Normal file
View File

@@ -0,0 +1,226 @@
// Generated!
module.exports = {
DC_CERTCK_ACCEPT_INVALID_CERTIFICATES: 3,
DC_CERTCK_AUTO: 0,
DC_CERTCK_STRICT: 1,
DC_CHAT_ID_ALLDONE_HINT: 7,
DC_CHAT_ID_ARCHIVED_LINK: 6,
DC_CHAT_ID_LAST_SPECIAL: 9,
DC_CHAT_ID_TRASH: 3,
DC_CHAT_TYPE_BROADCAST: 160,
DC_CHAT_TYPE_GROUP: 120,
DC_CHAT_TYPE_MAILINGLIST: 140,
DC_CHAT_TYPE_SINGLE: 100,
DC_CHAT_TYPE_UNDEFINED: 0,
DC_CHAT_VISIBILITY_ARCHIVED: 1,
DC_CHAT_VISIBILITY_NORMAL: 0,
DC_CHAT_VISIBILITY_PINNED: 2,
DC_CONNECTIVITY_CONNECTED: 4000,
DC_CONNECTIVITY_CONNECTING: 2000,
DC_CONNECTIVITY_NOT_CONNECTED: 1000,
DC_CONNECTIVITY_WORKING: 3000,
DC_CONTACT_ID_DEVICE: 5,
DC_CONTACT_ID_INFO: 2,
DC_CONTACT_ID_LAST_SPECIAL: 9,
DC_CONTACT_ID_SELF: 1,
DC_DOWNLOAD_AVAILABLE: 10,
DC_DOWNLOAD_DONE: 0,
DC_DOWNLOAD_FAILURE: 20,
DC_DOWNLOAD_IN_PROGRESS: 1000,
DC_EVENT_CHAT_EPHEMERAL_TIMER_MODIFIED: 2021,
DC_EVENT_CHAT_MODIFIED: 2020,
DC_EVENT_CONFIGURE_PROGRESS: 2041,
DC_EVENT_CONNECTIVITY_CHANGED: 2100,
DC_EVENT_CONTACTS_CHANGED: 2030,
DC_EVENT_DELETED_BLOB_FILE: 151,
DC_EVENT_ERROR: 400,
DC_EVENT_ERROR_SELF_NOT_IN_GROUP: 410,
DC_EVENT_IMAP_CONNECTED: 102,
DC_EVENT_IMAP_MESSAGE_DELETED: 104,
DC_EVENT_IMAP_MESSAGE_MOVED: 105,
DC_EVENT_IMEX_FILE_WRITTEN: 2052,
DC_EVENT_IMEX_PROGRESS: 2051,
DC_EVENT_INCOMING_MSG: 2005,
DC_EVENT_INFO: 100,
DC_EVENT_LOCATION_CHANGED: 2035,
DC_EVENT_MSGS_CHANGED: 2000,
DC_EVENT_MSGS_NOTICED: 2008,
DC_EVENT_MSG_DELIVERED: 2010,
DC_EVENT_MSG_FAILED: 2012,
DC_EVENT_MSG_READ: 2015,
DC_EVENT_NEW_BLOB_FILE: 150,
DC_EVENT_SECUREJOIN_INVITER_PROGRESS: 2060,
DC_EVENT_SECUREJOIN_JOINER_PROGRESS: 2061,
DC_EVENT_SELFAVATAR_CHANGED: 2110,
DC_EVENT_SMTP_CONNECTED: 101,
DC_EVENT_SMTP_MESSAGE_SENT: 103,
DC_EVENT_WARNING: 300,
DC_EVENT_WEBXDC_STATUS_UPDATE: 2120,
DC_GCL_ADD_ALLDONE_HINT: 4,
DC_GCL_ADD_SELF: 2,
DC_GCL_ARCHIVED_ONLY: 1,
DC_GCL_FOR_FORWARDING: 8,
DC_GCL_NO_SPECIALS: 2,
DC_GCL_VERIFIED_ONLY: 1,
DC_GCM_ADDDAYMARKER: 1,
DC_GCM_INFO_ONLY: 2,
DC_IMEX_EXPORT_BACKUP: 11,
DC_IMEX_EXPORT_SELF_KEYS: 1,
DC_IMEX_IMPORT_BACKUP: 12,
DC_IMEX_IMPORT_SELF_KEYS: 2,
DC_INFO_PROTECTION_DISABLED: 12,
DC_INFO_PROTECTION_ENABLED: 11,
DC_KEY_GEN_DEFAULT: 0,
DC_KEY_GEN_ED25519: 2,
DC_KEY_GEN_RSA2048: 1,
DC_LP_AUTH_NORMAL: 4,
DC_LP_AUTH_OAUTH2: 2,
DC_MEDIA_QUALITY_BALANCED: 0,
DC_MEDIA_QUALITY_WORSE: 1,
DC_MSG_AUDIO: 40,
DC_MSG_FILE: 60,
DC_MSG_GIF: 21,
DC_MSG_ID_DAYMARKER: 9,
DC_MSG_ID_LAST_SPECIAL: 9,
DC_MSG_ID_MARKER1: 1,
DC_MSG_IMAGE: 20,
DC_MSG_STICKER: 23,
DC_MSG_TEXT: 10,
DC_MSG_VIDEO: 50,
DC_MSG_VIDEOCHAT_INVITATION: 70,
DC_MSG_VOICE: 41,
DC_MSG_WEBXDC: 80,
DC_PROVIDER_STATUS_BROKEN: 3,
DC_PROVIDER_STATUS_OK: 1,
DC_PROVIDER_STATUS_PREPARATION: 2,
DC_QR_ACCOUNT: 250,
DC_QR_ADDR: 320,
DC_QR_ASK_VERIFYCONTACT: 200,
DC_QR_ASK_VERIFYGROUP: 202,
DC_QR_ERROR: 400,
DC_QR_FPR_MISMATCH: 220,
DC_QR_FPR_OK: 210,
DC_QR_FPR_WITHOUT_ADDR: 230,
DC_QR_REVIVE_VERIFYCONTACT: 510,
DC_QR_REVIVE_VERIFYGROUP: 512,
DC_QR_TEXT: 330,
DC_QR_URL: 332,
DC_QR_WEBRTC_INSTANCE: 260,
DC_QR_WITHDRAW_VERIFYCONTACT: 500,
DC_QR_WITHDRAW_VERIFYGROUP: 502,
DC_SHOW_EMAILS_ACCEPTED_CONTACTS: 1,
DC_SHOW_EMAILS_ALL: 2,
DC_SHOW_EMAILS_OFF: 0,
DC_SOCKET_AUTO: 0,
DC_SOCKET_PLAIN: 3,
DC_SOCKET_SSL: 1,
DC_SOCKET_STARTTLS: 2,
DC_STATE_IN_FRESH: 10,
DC_STATE_IN_NOTICED: 13,
DC_STATE_IN_SEEN: 16,
DC_STATE_OUT_DELIVERED: 26,
DC_STATE_OUT_DRAFT: 19,
DC_STATE_OUT_FAILED: 24,
DC_STATE_OUT_MDN_RCVD: 28,
DC_STATE_OUT_PENDING: 20,
DC_STATE_OUT_PREPARING: 18,
DC_STATE_UNDEFINED: 0,
DC_STR_AC_SETUP_MSG_BODY: 43,
DC_STR_AC_SETUP_MSG_SUBJECT: 42,
DC_STR_ARCHIVEDCHATS: 40,
DC_STR_AUDIO: 11,
DC_STR_BAD_TIME_MSG_BODY: 85,
DC_STR_BROADCAST_LIST: 115,
DC_STR_CANNOT_LOGIN: 60,
DC_STR_CANTDECRYPT_MSG_BODY: 29,
DC_STR_CONFIGURATION_FAILED: 84,
DC_STR_CONNECTED: 107,
DC_STR_CONNTECTING: 108,
DC_STR_CONTACT_NOT_VERIFIED: 36,
DC_STR_CONTACT_SETUP_CHANGED: 37,
DC_STR_CONTACT_VERIFIED: 35,
DC_STR_DEVICE_MESSAGES: 68,
DC_STR_DEVICE_MESSAGES_HINT: 70,
DC_STR_DOWNLOAD_AVAILABILITY: 100,
DC_STR_DRAFT: 3,
DC_STR_E2E_AVAILABLE: 25,
DC_STR_E2E_PREFERRED: 34,
DC_STR_ENCRYPTEDMSG: 24,
DC_STR_ENCR_NONE: 28,
DC_STR_ENCR_TRANSP: 27,
DC_STR_EPHEMERAL_DAY: 79,
DC_STR_EPHEMERAL_DAYS: 95,
DC_STR_EPHEMERAL_DISABLED: 75,
DC_STR_EPHEMERAL_FOUR_WEEKS: 81,
DC_STR_EPHEMERAL_HOUR: 78,
DC_STR_EPHEMERAL_HOURS: 94,
DC_STR_EPHEMERAL_MINUTE: 77,
DC_STR_EPHEMERAL_MINUTES: 93,
DC_STR_EPHEMERAL_SECONDS: 76,
DC_STR_EPHEMERAL_WEEK: 80,
DC_STR_EPHEMERAL_WEEKS: 96,
DC_STR_ERROR: 112,
DC_STR_ERROR_NO_NETWORK: 87,
DC_STR_FAILED_SENDING_TO: 74,
DC_STR_FILE: 12,
DC_STR_FINGERPRINTS: 30,
DC_STR_FORWARDED: 97,
DC_STR_GIF: 23,
DC_STR_IMAGE: 9,
DC_STR_INCOMING_MESSAGES: 103,
DC_STR_LAST_MSG_SENT_SUCCESSFULLY: 111,
DC_STR_LOCATION: 66,
DC_STR_MESSAGES: 114,
DC_STR_MSGACTIONBYME: 63,
DC_STR_MSGACTIONBYUSER: 62,
DC_STR_MSGADDMEMBER: 17,
DC_STR_MSGDELMEMBER: 18,
DC_STR_MSGGROUPLEFT: 19,
DC_STR_MSGGRPIMGCHANGED: 16,
DC_STR_MSGGRPIMGDELETED: 33,
DC_STR_MSGGRPNAME: 15,
DC_STR_MSGLOCATIONDISABLED: 65,
DC_STR_MSGLOCATIONENABLED: 64,
DC_STR_NOMESSAGES: 1,
DC_STR_NOT_CONNECTED: 121,
DC_STR_NOT_SUPPORTED_BY_PROVIDER: 113,
DC_STR_ONE_MOMENT: 106,
DC_STR_OUTGOING_MESSAGES: 104,
DC_STR_PARTIAL_DOWNLOAD_MSG_BODY: 99,
DC_STR_PART_OF_TOTAL_USED: 116,
DC_STR_PROTECTION_DISABLED: 89,
DC_STR_PROTECTION_ENABLED: 88,
DC_STR_QUOTA_EXCEEDING_MSG_BODY: 98,
DC_STR_READRCPT: 31,
DC_STR_READRCPT_MAILBODY: 32,
DC_STR_REPLY_NOUN: 90,
DC_STR_SAVED_MESSAGES: 69,
DC_STR_SECURE_JOIN_GROUP_QR_DESC: 120,
DC_STR_SECURE_JOIN_REPLIES: 118,
DC_STR_SECURE_JOIN_STARTED: 117,
DC_STR_SELF: 2,
DC_STR_SELF_DELETED_MSG_BODY: 91,
DC_STR_SENDING: 110,
DC_STR_SERVER_TURNED_OFF: 92,
DC_STR_SETUP_CONTACT_QR_DESC: 119,
DC_STR_STICKER: 67,
DC_STR_STORAGE_ON_DOMAIN: 105,
DC_STR_SUBJECT_FOR_NEW_CONTACT: 73,
DC_STR_SYNC_MSG_BODY: 102,
DC_STR_SYNC_MSG_SUBJECT: 101,
DC_STR_UNKNOWN_SENDER_FOR_CHAT: 72,
DC_STR_UPDATE_REMINDER_MSG_BODY: 86,
DC_STR_UPDATING: 109,
DC_STR_VIDEO: 10,
DC_STR_VIDEOCHAT_INVITATION: 82,
DC_STR_VIDEOCHAT_INVITE_MSG_BODY: 83,
DC_STR_VOICEMESSAGE: 7,
DC_STR_WELCOME_MESSAGE: 71,
DC_TEXT1_DRAFT: 1,
DC_TEXT1_SELF: 3,
DC_TEXT1_USERNAME: 2,
DC_VIDEOCHATTYPE_BASICWEBRTC: 1,
DC_VIDEOCHATTYPE_JITSI: 2,
DC_VIDEOCHATTYPE_UNKNOWN: 0
}

34
node/events.js Normal file
View File

@@ -0,0 +1,34 @@
/* eslint-disable quotes */
// Generated!
module.exports = {
100: 'DC_EVENT_INFO',
101: 'DC_EVENT_SMTP_CONNECTED',
102: 'DC_EVENT_IMAP_CONNECTED',
103: 'DC_EVENT_SMTP_MESSAGE_SENT',
104: 'DC_EVENT_IMAP_MESSAGE_DELETED',
105: 'DC_EVENT_IMAP_MESSAGE_MOVED',
150: 'DC_EVENT_NEW_BLOB_FILE',
151: 'DC_EVENT_DELETED_BLOB_FILE',
300: 'DC_EVENT_WARNING',
400: 'DC_EVENT_ERROR',
410: 'DC_EVENT_ERROR_SELF_NOT_IN_GROUP',
2000: 'DC_EVENT_MSGS_CHANGED',
2005: 'DC_EVENT_INCOMING_MSG',
2008: 'DC_EVENT_MSGS_NOTICED',
2010: 'DC_EVENT_MSG_DELIVERED',
2012: 'DC_EVENT_MSG_FAILED',
2015: 'DC_EVENT_MSG_READ',
2020: 'DC_EVENT_CHAT_MODIFIED',
2021: 'DC_EVENT_CHAT_EPHEMERAL_TIMER_MODIFIED',
2030: 'DC_EVENT_CONTACTS_CHANGED',
2035: 'DC_EVENT_LOCATION_CHANGED',
2041: 'DC_EVENT_CONFIGURE_PROGRESS',
2051: 'DC_EVENT_IMEX_PROGRESS',
2052: 'DC_EVENT_IMEX_FILE_WRITTEN',
2060: 'DC_EVENT_SECUREJOIN_INVITER_PROGRESS',
2061: 'DC_EVENT_SECUREJOIN_JOINER_PROGRESS',
2100: 'DC_EVENT_CONNECTIVITY_CHANGED',
2110: 'DC_EVENT_SELFAVATAR_CHANGED',
2120: 'DC_EVENT_WEBXDC_STATUS_UPDATE'
}

View File

@@ -0,0 +1,40 @@
//@ts-check
const { Context } = require('../dist')
const opts = {
addr: '[email]',
mail_pw: '[password]',
}
const contact = '[email]'
async function main() {
const dc = Context.open('./')
dc.on('ALL', console.log.bind(null, 'core |'))
try {
await dc.configure(opts)
} catch (err) {
console.error('Failed to configure because of: ', err)
dc.unref()
return
}
dc.startIO()
console.log('fully configured')
const contactId = dc.createContact('Test', contact)
const chatId = dc.createChatByContactId(contactId)
dc.sendMessage(chatId, 'Hi!')
console.log('sent message')
dc.once('DC_EVENT_SMTP_MESSAGE_SENT', async () => {
console.log('Message sent, shutting down...')
dc.stopIO()
console.log('stopped io')
dc.unref()
})
}
main()

BIN
node/images/tests.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

9
node/lib/binding.ts Normal file
View File

@@ -0,0 +1,9 @@
import { join } from 'path'
/**
* bindings are not typed yet.
* if the availible function names are required they can be found inside of `../src/module.c`
*/
export const bindings: any = require('node-gyp-build')(join(__dirname, '../'))
export default bindings

106
node/lib/chat.ts Normal file
View File

@@ -0,0 +1,106 @@
/* eslint-disable camelcase */
import binding from './binding'
import rawDebug from 'debug'
const debug = rawDebug('deltachat:node:chat')
import { C } from './constants'
import { integerToHexColor } from './util'
import { ChatJSON } from './types'
interface NativeChat {}
/**
* Wrapper around dc_chat_t*
*/
export class Chat {
constructor(public dc_chat: NativeChat) {
debug('Chat constructor')
if (dc_chat === null) {
throw new Error('native chat can not be null')
}
}
getVisibility():
| C.DC_CHAT_VISIBILITY_NORMAL
| C.DC_CHAT_VISIBILITY_ARCHIVED
| C.DC_CHAT_VISIBILITY_PINNED {
return binding.dcn_chat_get_visibility(this.dc_chat)
}
get color(): string {
return integerToHexColor(binding.dcn_chat_get_color(this.dc_chat))
}
getId(): number {
return binding.dcn_chat_get_id(this.dc_chat)
}
getName(): string {
return binding.dcn_chat_get_name(this.dc_chat)
}
getProfileImage(): string {
return binding.dcn_chat_get_profile_image(this.dc_chat)
}
getType(): number {
return binding.dcn_chat_get_type(this.dc_chat)
}
isSelfTalk(): boolean {
return Boolean(binding.dcn_chat_is_self_talk(this.dc_chat))
}
isContactRequest(): boolean {
return Boolean(binding.dcn_chat_is_contact_request(this.dc_chat))
}
isUnpromoted(): boolean {
return Boolean(binding.dcn_chat_is_unpromoted(this.dc_chat))
}
isProtected(): boolean {
return Boolean(binding.dcn_chat_is_protected(this.dc_chat))
}
get canSend(): boolean {
return Boolean(binding.dcn_chat_can_send(this.dc_chat))
}
isDeviceTalk(): boolean {
return Boolean(binding.dcn_chat_is_device_talk(this.dc_chat))
}
isSingle(): boolean {
return this.getType() === C.DC_CHAT_TYPE_SINGLE
}
isGroup(): boolean {
return this.getType() === C.DC_CHAT_TYPE_GROUP
}
isMuted(): boolean {
return Boolean(binding.dcn_chat_is_muted(this.dc_chat))
}
toJson(): ChatJSON {
debug('toJson')
const visibility = this.getVisibility()
return {
archived: visibility === C.DC_CHAT_VISIBILITY_ARCHIVED,
pinned: visibility === C.DC_CHAT_VISIBILITY_PINNED,
color: this.color,
id: this.getId(),
name: this.getName(),
profileImage: this.getProfileImage(),
type: this.getType(),
isSelfTalk: this.isSelfTalk(),
isUnpromoted: this.isUnpromoted(),
isProtected: this.isProtected(),
canSend: this.canSend,
isDeviceTalk: this.isDeviceTalk(),
isContactRequest: this.isContactRequest(),
muted: this.isMuted(),
}
}
}

42
node/lib/chatlist.ts Normal file
View File

@@ -0,0 +1,42 @@
/* eslint-disable camelcase */
import binding from './binding'
import { Lot } from './lot'
import { Chat } from './chat'
const debug = require('debug')('deltachat:node:chatlist')
interface NativeChatList {}
/**
* Wrapper around dc_chatlist_t*
*/
export class ChatList {
constructor(private dc_chatlist: NativeChatList) {
debug('ChatList constructor')
if (dc_chatlist === null) {
throw new Error('native chat list can not be null')
}
}
getChatId(index: number): number {
debug(`getChatId ${index}`)
return binding.dcn_chatlist_get_chat_id(this.dc_chatlist, index)
}
getCount(): number {
debug('getCount')
return binding.dcn_chatlist_get_cnt(this.dc_chatlist)
}
getMessageId(index: number): number {
debug(`getMessageId ${index}`)
return binding.dcn_chatlist_get_msg_id(this.dc_chatlist, index)
}
getSummary(index: number, chat?: Chat): Lot {
debug(`getSummary ${index}`)
const dc_chat = (chat && chat.dc_chat) || null
return new Lot(
binding.dcn_chatlist_get_summary(this.dc_chatlist, index, dc_chat)
)
}
}

260
node/lib/constants.ts Normal file
View File

@@ -0,0 +1,260 @@
// Generated!
export enum C {
DC_CERTCK_ACCEPT_INVALID_CERTIFICATES = 3,
DC_CERTCK_AUTO = 0,
DC_CERTCK_STRICT = 1,
DC_CHAT_ID_ALLDONE_HINT = 7,
DC_CHAT_ID_ARCHIVED_LINK = 6,
DC_CHAT_ID_LAST_SPECIAL = 9,
DC_CHAT_ID_TRASH = 3,
DC_CHAT_TYPE_BROADCAST = 160,
DC_CHAT_TYPE_GROUP = 120,
DC_CHAT_TYPE_MAILINGLIST = 140,
DC_CHAT_TYPE_SINGLE = 100,
DC_CHAT_TYPE_UNDEFINED = 0,
DC_CHAT_VISIBILITY_ARCHIVED = 1,
DC_CHAT_VISIBILITY_NORMAL = 0,
DC_CHAT_VISIBILITY_PINNED = 2,
DC_CONNECTIVITY_CONNECTED = 4000,
DC_CONNECTIVITY_CONNECTING = 2000,
DC_CONNECTIVITY_NOT_CONNECTED = 1000,
DC_CONNECTIVITY_WORKING = 3000,
DC_CONTACT_ID_DEVICE = 5,
DC_CONTACT_ID_INFO = 2,
DC_CONTACT_ID_LAST_SPECIAL = 9,
DC_CONTACT_ID_SELF = 1,
DC_DOWNLOAD_AVAILABLE = 10,
DC_DOWNLOAD_DONE = 0,
DC_DOWNLOAD_FAILURE = 20,
DC_DOWNLOAD_IN_PROGRESS = 1000,
DC_EVENT_CHAT_EPHEMERAL_TIMER_MODIFIED = 2021,
DC_EVENT_CHAT_MODIFIED = 2020,
DC_EVENT_CONFIGURE_PROGRESS = 2041,
DC_EVENT_CONNECTIVITY_CHANGED = 2100,
DC_EVENT_CONTACTS_CHANGED = 2030,
DC_EVENT_DELETED_BLOB_FILE = 151,
DC_EVENT_ERROR = 400,
DC_EVENT_ERROR_SELF_NOT_IN_GROUP = 410,
DC_EVENT_IMAP_CONNECTED = 102,
DC_EVENT_IMAP_MESSAGE_DELETED = 104,
DC_EVENT_IMAP_MESSAGE_MOVED = 105,
DC_EVENT_IMEX_FILE_WRITTEN = 2052,
DC_EVENT_IMEX_PROGRESS = 2051,
DC_EVENT_INCOMING_MSG = 2005,
DC_EVENT_INFO = 100,
DC_EVENT_LOCATION_CHANGED = 2035,
DC_EVENT_MSGS_CHANGED = 2000,
DC_EVENT_MSGS_NOTICED = 2008,
DC_EVENT_MSG_DELIVERED = 2010,
DC_EVENT_MSG_FAILED = 2012,
DC_EVENT_MSG_READ = 2015,
DC_EVENT_NEW_BLOB_FILE = 150,
DC_EVENT_SECUREJOIN_INVITER_PROGRESS = 2060,
DC_EVENT_SECUREJOIN_JOINER_PROGRESS = 2061,
DC_EVENT_SELFAVATAR_CHANGED = 2110,
DC_EVENT_SMTP_CONNECTED = 101,
DC_EVENT_SMTP_MESSAGE_SENT = 103,
DC_EVENT_WARNING = 300,
DC_EVENT_WEBXDC_STATUS_UPDATE = 2120,
DC_GCL_ADD_ALLDONE_HINT = 4,
DC_GCL_ADD_SELF = 2,
DC_GCL_ARCHIVED_ONLY = 1,
DC_GCL_FOR_FORWARDING = 8,
DC_GCL_NO_SPECIALS = 2,
DC_GCL_VERIFIED_ONLY = 1,
DC_GCM_ADDDAYMARKER = 1,
DC_GCM_INFO_ONLY = 2,
DC_IMEX_EXPORT_BACKUP = 11,
DC_IMEX_EXPORT_SELF_KEYS = 1,
DC_IMEX_IMPORT_BACKUP = 12,
DC_IMEX_IMPORT_SELF_KEYS = 2,
DC_INFO_PROTECTION_DISABLED = 12,
DC_INFO_PROTECTION_ENABLED = 11,
DC_KEY_GEN_DEFAULT = 0,
DC_KEY_GEN_ED25519 = 2,
DC_KEY_GEN_RSA2048 = 1,
DC_LP_AUTH_NORMAL = 4,
DC_LP_AUTH_OAUTH2 = 2,
DC_MEDIA_QUALITY_BALANCED = 0,
DC_MEDIA_QUALITY_WORSE = 1,
DC_MSG_AUDIO = 40,
DC_MSG_FILE = 60,
DC_MSG_GIF = 21,
DC_MSG_ID_DAYMARKER = 9,
DC_MSG_ID_LAST_SPECIAL = 9,
DC_MSG_ID_MARKER1 = 1,
DC_MSG_IMAGE = 20,
DC_MSG_STICKER = 23,
DC_MSG_TEXT = 10,
DC_MSG_VIDEO = 50,
DC_MSG_VIDEOCHAT_INVITATION = 70,
DC_MSG_VOICE = 41,
DC_MSG_WEBXDC = 80,
DC_PROVIDER_STATUS_BROKEN = 3,
DC_PROVIDER_STATUS_OK = 1,
DC_PROVIDER_STATUS_PREPARATION = 2,
DC_QR_ACCOUNT = 250,
DC_QR_ADDR = 320,
DC_QR_ASK_VERIFYCONTACT = 200,
DC_QR_ASK_VERIFYGROUP = 202,
DC_QR_ERROR = 400,
DC_QR_FPR_MISMATCH = 220,
DC_QR_FPR_OK = 210,
DC_QR_FPR_WITHOUT_ADDR = 230,
DC_QR_REVIVE_VERIFYCONTACT = 510,
DC_QR_REVIVE_VERIFYGROUP = 512,
DC_QR_TEXT = 330,
DC_QR_URL = 332,
DC_QR_WEBRTC_INSTANCE = 260,
DC_QR_WITHDRAW_VERIFYCONTACT = 500,
DC_QR_WITHDRAW_VERIFYGROUP = 502,
DC_SHOW_EMAILS_ACCEPTED_CONTACTS = 1,
DC_SHOW_EMAILS_ALL = 2,
DC_SHOW_EMAILS_OFF = 0,
DC_SOCKET_AUTO = 0,
DC_SOCKET_PLAIN = 3,
DC_SOCKET_SSL = 1,
DC_SOCKET_STARTTLS = 2,
DC_STATE_IN_FRESH = 10,
DC_STATE_IN_NOTICED = 13,
DC_STATE_IN_SEEN = 16,
DC_STATE_OUT_DELIVERED = 26,
DC_STATE_OUT_DRAFT = 19,
DC_STATE_OUT_FAILED = 24,
DC_STATE_OUT_MDN_RCVD = 28,
DC_STATE_OUT_PENDING = 20,
DC_STATE_OUT_PREPARING = 18,
DC_STATE_UNDEFINED = 0,
DC_STR_AC_SETUP_MSG_BODY = 43,
DC_STR_AC_SETUP_MSG_SUBJECT = 42,
DC_STR_ARCHIVEDCHATS = 40,
DC_STR_AUDIO = 11,
DC_STR_BAD_TIME_MSG_BODY = 85,
DC_STR_BROADCAST_LIST = 115,
DC_STR_CANNOT_LOGIN = 60,
DC_STR_CANTDECRYPT_MSG_BODY = 29,
DC_STR_CONFIGURATION_FAILED = 84,
DC_STR_CONNECTED = 107,
DC_STR_CONNTECTING = 108,
DC_STR_CONTACT_NOT_VERIFIED = 36,
DC_STR_CONTACT_SETUP_CHANGED = 37,
DC_STR_CONTACT_VERIFIED = 35,
DC_STR_DEVICE_MESSAGES = 68,
DC_STR_DEVICE_MESSAGES_HINT = 70,
DC_STR_DOWNLOAD_AVAILABILITY = 100,
DC_STR_DRAFT = 3,
DC_STR_E2E_AVAILABLE = 25,
DC_STR_E2E_PREFERRED = 34,
DC_STR_ENCRYPTEDMSG = 24,
DC_STR_ENCR_NONE = 28,
DC_STR_ENCR_TRANSP = 27,
DC_STR_EPHEMERAL_DAY = 79,
DC_STR_EPHEMERAL_DAYS = 95,
DC_STR_EPHEMERAL_DISABLED = 75,
DC_STR_EPHEMERAL_FOUR_WEEKS = 81,
DC_STR_EPHEMERAL_HOUR = 78,
DC_STR_EPHEMERAL_HOURS = 94,
DC_STR_EPHEMERAL_MINUTE = 77,
DC_STR_EPHEMERAL_MINUTES = 93,
DC_STR_EPHEMERAL_SECONDS = 76,
DC_STR_EPHEMERAL_WEEK = 80,
DC_STR_EPHEMERAL_WEEKS = 96,
DC_STR_ERROR = 112,
DC_STR_ERROR_NO_NETWORK = 87,
DC_STR_FAILED_SENDING_TO = 74,
DC_STR_FILE = 12,
DC_STR_FINGERPRINTS = 30,
DC_STR_FORWARDED = 97,
DC_STR_GIF = 23,
DC_STR_IMAGE = 9,
DC_STR_INCOMING_MESSAGES = 103,
DC_STR_LAST_MSG_SENT_SUCCESSFULLY = 111,
DC_STR_LOCATION = 66,
DC_STR_MESSAGES = 114,
DC_STR_MSGACTIONBYME = 63,
DC_STR_MSGACTIONBYUSER = 62,
DC_STR_MSGADDMEMBER = 17,
DC_STR_MSGDELMEMBER = 18,
DC_STR_MSGGROUPLEFT = 19,
DC_STR_MSGGRPIMGCHANGED = 16,
DC_STR_MSGGRPIMGDELETED = 33,
DC_STR_MSGGRPNAME = 15,
DC_STR_MSGLOCATIONDISABLED = 65,
DC_STR_MSGLOCATIONENABLED = 64,
DC_STR_NOMESSAGES = 1,
DC_STR_NOT_CONNECTED = 121,
DC_STR_NOT_SUPPORTED_BY_PROVIDER = 113,
DC_STR_ONE_MOMENT = 106,
DC_STR_OUTGOING_MESSAGES = 104,
DC_STR_PARTIAL_DOWNLOAD_MSG_BODY = 99,
DC_STR_PART_OF_TOTAL_USED = 116,
DC_STR_PROTECTION_DISABLED = 89,
DC_STR_PROTECTION_ENABLED = 88,
DC_STR_QUOTA_EXCEEDING_MSG_BODY = 98,
DC_STR_READRCPT = 31,
DC_STR_READRCPT_MAILBODY = 32,
DC_STR_REPLY_NOUN = 90,
DC_STR_SAVED_MESSAGES = 69,
DC_STR_SECURE_JOIN_GROUP_QR_DESC = 120,
DC_STR_SECURE_JOIN_REPLIES = 118,
DC_STR_SECURE_JOIN_STARTED = 117,
DC_STR_SELF = 2,
DC_STR_SELF_DELETED_MSG_BODY = 91,
DC_STR_SENDING = 110,
DC_STR_SERVER_TURNED_OFF = 92,
DC_STR_SETUP_CONTACT_QR_DESC = 119,
DC_STR_STICKER = 67,
DC_STR_STORAGE_ON_DOMAIN = 105,
DC_STR_SUBJECT_FOR_NEW_CONTACT = 73,
DC_STR_SYNC_MSG_BODY = 102,
DC_STR_SYNC_MSG_SUBJECT = 101,
DC_STR_UNKNOWN_SENDER_FOR_CHAT = 72,
DC_STR_UPDATE_REMINDER_MSG_BODY = 86,
DC_STR_UPDATING = 109,
DC_STR_VIDEO = 10,
DC_STR_VIDEOCHAT_INVITATION = 82,
DC_STR_VIDEOCHAT_INVITE_MSG_BODY = 83,
DC_STR_VOICEMESSAGE = 7,
DC_STR_WELCOME_MESSAGE = 71,
DC_TEXT1_DRAFT = 1,
DC_TEXT1_SELF = 3,
DC_TEXT1_USERNAME = 2,
DC_VIDEOCHATTYPE_BASICWEBRTC = 1,
DC_VIDEOCHATTYPE_JITSI = 2,
DC_VIDEOCHATTYPE_UNKNOWN = 0,
}
// Generated!
export const EventId2EventName: { [key: number]: string } = {
100: 'DC_EVENT_INFO',
101: 'DC_EVENT_SMTP_CONNECTED',
102: 'DC_EVENT_IMAP_CONNECTED',
103: 'DC_EVENT_SMTP_MESSAGE_SENT',
104: 'DC_EVENT_IMAP_MESSAGE_DELETED',
105: 'DC_EVENT_IMAP_MESSAGE_MOVED',
150: 'DC_EVENT_NEW_BLOB_FILE',
151: 'DC_EVENT_DELETED_BLOB_FILE',
300: 'DC_EVENT_WARNING',
400: 'DC_EVENT_ERROR',
410: 'DC_EVENT_ERROR_SELF_NOT_IN_GROUP',
2000: 'DC_EVENT_MSGS_CHANGED',
2005: 'DC_EVENT_INCOMING_MSG',
2008: 'DC_EVENT_MSGS_NOTICED',
2010: 'DC_EVENT_MSG_DELIVERED',
2012: 'DC_EVENT_MSG_FAILED',
2015: 'DC_EVENT_MSG_READ',
2020: 'DC_EVENT_CHAT_MODIFIED',
2021: 'DC_EVENT_CHAT_EPHEMERAL_TIMER_MODIFIED',
2030: 'DC_EVENT_CONTACTS_CHANGED',
2035: 'DC_EVENT_LOCATION_CHANGED',
2041: 'DC_EVENT_CONFIGURE_PROGRESS',
2051: 'DC_EVENT_IMEX_PROGRESS',
2052: 'DC_EVENT_IMEX_FILE_WRITTEN',
2060: 'DC_EVENT_SECUREJOIN_INVITER_PROGRESS',
2061: 'DC_EVENT_SECUREJOIN_JOINER_PROGRESS',
2100: 'DC_EVENT_CONNECTIVITY_CHANGED',
2110: 'DC_EVENT_SELFAVATAR_CHANGED',
2120: 'DC_EVENT_WEBXDC_STATUS_UPDATE',
}

94
node/lib/contact.ts Normal file
View File

@@ -0,0 +1,94 @@
import { integerToHexColor } from './util'
/* eslint-disable camelcase */
import binding from './binding'
const debug = require('debug')('deltachat:node:contact')
interface NativeContact {}
/**
* Wrapper around dc_contact_t*
*/
export class Contact {
constructor(public dc_contact: NativeContact) {
debug('Contact constructor')
if (dc_contact === null) {
throw new Error('native contact can not be null')
}
}
toJson() {
debug('toJson')
return {
address: this.getAddress(),
color: this.color,
authName: this.authName,
status: this.status,
displayName: this.getDisplayName(),
id: this.getId(),
lastSeen: this.lastSeen,
name: this.getName(),
profileImage: this.getProfileImage(),
nameAndAddr: this.getNameAndAddress(),
isBlocked: this.isBlocked(),
isVerified: this.isVerified(),
}
}
getAddress(): string {
return binding.dcn_contact_get_addr(this.dc_contact)
}
/** Get original contact name.
* This is the name of the contact as defined by the contact themself.
* If the contact themself does not define such a name,
* an empty string is returned. */
get authName(): string {
return binding.dcn_contact_get_auth_name(this.dc_contact)
}
get color(): string {
return integerToHexColor(binding.dcn_contact_get_color(this.dc_contact))
}
/**
* contact's status
*
* Status is the last signature received in a message from this contact.
*/
get status(): string {
return binding.dcn_contact_get_status(this.dc_contact)
}
getDisplayName(): string {
return binding.dcn_contact_get_display_name(this.dc_contact)
}
getId(): number {
return binding.dcn_contact_get_id(this.dc_contact)
}
get lastSeen(): number {
return binding.dcn_contact_get_last_seen(this.dc_contact)
}
getName(): string {
return binding.dcn_contact_get_name(this.dc_contact)
}
getNameAndAddress(): string {
return binding.dcn_contact_get_name_n_addr(this.dc_contact)
}
getProfileImage(): string {
return binding.dcn_contact_get_profile_image(this.dc_contact)
}
isBlocked() {
return Boolean(binding.dcn_contact_is_blocked(this.dc_contact))
}
isVerified() {
return Boolean(binding.dcn_contact_is_verified(this.dc_contact))
}
}

955
node/lib/context.ts Normal file
View File

@@ -0,0 +1,955 @@
/* eslint-disable camelcase */
import binding from './binding'
import { C, EventId2EventName } from './constants'
import { Chat } from './chat'
import { ChatList } from './chatlist'
import { Contact } from './contact'
import { Message } from './message'
import { Lot } from './lot'
import { Locations } from './locations'
import rawDebug from 'debug'
import { AccountManager } from './deltachat'
import { join } from 'path'
import { EventEmitter } from 'stream'
const debug = rawDebug('deltachat:node:index')
const noop = function () {}
interface NativeContext {}
/**
* Wrapper around dcn_context_t*
*
* only acts as event emitter when created in standalone mode (without account manager)
* with `Context.open`
*/
export class Context extends EventEmitter {
constructor(
readonly manager: AccountManager | null,
private inner_dcn_context: NativeContext,
readonly account_id: number | null
) {
super()
debug('DeltaChat constructor')
if (inner_dcn_context === null) {
throw new Error('inner_dcn_context can not be null')
}
}
/** Opens a stanalone context (without an account manager)
* automatically starts the event handler */
static open(cwd: string): Context {
const dbFile = join(cwd, 'db.sqlite')
const context = new Context(null, binding.dcn_context_new(dbFile), null)
debug('Opened context')
function handleCoreEvent(
eventId: number,
data1: number,
data2: number | string
) {
const eventString = EventId2EventName[eventId]
debug(eventString, data1, data2)
if (!context.emit) {
console.log('Received an event but EventEmitter is already destroyed.')
console.log(eventString, data1, data2)
return
}
context.emit(eventString, data1, data2)
context.emit('ALL', eventString, data1, data2)
}
binding.dcn_start_event_handler(
context.dcn_context,
handleCoreEvent.bind(this)
)
debug('Started event handler')
return context
}
get dcn_context() {
return this.inner_dcn_context
}
get is_open() {
return Boolean(binding.dcn_context_is_open())
}
open(passphrase?: string) {
return Boolean(
binding.dcn_context_open(this.dcn_context, passphrase ? passphrase : '')
)
}
unref() {
binding.dcn_context_unref(this.dcn_context)
;(this.inner_dcn_context as any) = null
}
acceptChat(chatId: number) {
binding.dcn_accept_chat(this.dcn_context, chatId)
}
blockChat(chatId: number) {
binding.dcn_block_chat(this.dcn_context, chatId)
}
addAddressBook(addressBook: string) {
debug(`addAddressBook ${addressBook}`)
return binding.dcn_add_address_book(this.dcn_context, addressBook)
}
addContactToChat(chatId: number, contactId: number) {
debug(`addContactToChat ${chatId} ${contactId}`)
return Boolean(
binding.dcn_add_contact_to_chat(
this.dcn_context,
Number(chatId),
Number(contactId)
)
)
}
addDeviceMessage(label: string, msg: Message | string) {
debug(`addDeviceMessage ${label} ${msg}`)
if (!msg) {
throw new Error('invalid msg parameter')
}
if (typeof label !== 'string') {
throw new Error('invalid label parameter, must be a string')
}
if (typeof msg === 'string') {
const msgObj = this.messageNew()
msgObj.setText(msg)
msg = msgObj
}
if (!msg.dc_msg) {
throw new Error('invalid msg object')
}
return binding.dcn_add_device_msg(this.dcn_context, label, msg.dc_msg)
}
setChatVisibility(
chatId: number,
visibility:
| C.DC_CHAT_VISIBILITY_NORMAL
| C.DC_CHAT_VISIBILITY_ARCHIVED
| C.DC_CHAT_VISIBILITY_PINNED
) {
debug(`setChatVisibility ${chatId} ${visibility}`)
binding.dcn_set_chat_visibility(
this.dcn_context,
Number(chatId),
visibility
)
}
blockContact(contactId: number, block: boolean) {
debug(`blockContact ${contactId} ${block}`)
binding.dcn_block_contact(
this.dcn_context,
Number(contactId),
block ? 1 : 0
)
}
checkQrCode(qrCode: string) {
debug(`checkQrCode ${qrCode}`)
const dc_lot = binding.dcn_check_qr(this.dcn_context, qrCode)
let result = dc_lot ? new Lot(dc_lot) : null
if (result) {
return { id: result.getId(), ...result.toJson() }
}
return result
}
configure(opts: any): Promise<void> {
return new Promise((resolve, reject) => {
debug('configure')
const onSuccess = () => {
removeListeners()
resolve()
}
const onFail = (error: string) => {
removeListeners()
reject(new Error(error))
}
let onConfigure: (...args: any[]) => void
if (this.account_id === null) {
onConfigure = (data1: number, data2: string) => {
if (data1 === 0) return onFail(data2)
else if (data1 === 1000) return onSuccess()
}
} else {
onConfigure = (accountId: number, data1: number, data2: string) => {
if (this.account_id !== accountId) {
return
}
if (data1 === 0) return onFail(data2)
else if (data1 === 1000) return onSuccess()
}
}
const removeListeners = () => {
;(this.manager || this).removeListener(
'DC_EVENT_CONFIGURE_PROGRESS',
onConfigure
)
}
const registerListeners = () => {
;(this.manager || this).on('DC_EVENT_CONFIGURE_PROGRESS', onConfigure)
}
registerListeners()
if (!opts) opts = {}
Object.keys(opts).forEach((key) => {
const value = opts[key]
this.setConfig(key, value)
})
binding.dcn_configure(this.dcn_context)
})
}
continueKeyTransfer(messageId: number, setupCode: string) {
debug(`continueKeyTransfer ${messageId}`)
return new Promise((resolve, reject) => {
binding.dcn_continue_key_transfer(
this.dcn_context,
Number(messageId),
setupCode,
(result: number) => resolve(result === 1)
)
})
}
/** @returns chatId */
createBroadcastList(): number {
debug(`createBroadcastList`)
return binding.dcn_create_broadcast_list(this.dcn_context)
}
/** @returns chatId */
createChatByContactId(contactId: number): number {
debug(`createChatByContactId ${contactId}`)
return binding.dcn_create_chat_by_contact_id(
this.dcn_context,
Number(contactId)
)
}
/** @returns contactId */
createContact(name: string, addr: string): number {
debug(`createContact ${name} ${addr}`)
return binding.dcn_create_contact(this.dcn_context, name, addr)
}
/**
*
* @param chatName The name of the chat that should be created
* @param is_protected Whether the chat should be protected at creation time
* @returns chatId
*/
createGroupChat(chatName: string, is_protected: boolean = false): number {
debug(`createGroupChat ${chatName} [protected:${is_protected}]`)
return binding.dcn_create_group_chat(
this.dcn_context,
is_protected ? 1 : 0,
chatName
)
}
deleteChat(chatId: number) {
debug(`deleteChat ${chatId}`)
binding.dcn_delete_chat(this.dcn_context, Number(chatId))
}
deleteContact(contactId: number) {
debug(`deleteContact ${contactId}`)
return Boolean(
binding.dcn_delete_contact(this.dcn_context, Number(contactId))
)
}
deleteMessages(messageIds: number[]) {
if (!Array.isArray(messageIds)) {
messageIds = [messageIds]
}
messageIds = messageIds.map((id) => Number(id))
debug('deleteMessages', messageIds)
binding.dcn_delete_msgs(this.dcn_context, messageIds)
}
forwardMessages(messageIds: number[], chatId: number) {
if (!Array.isArray(messageIds)) {
messageIds = [messageIds]
}
messageIds = messageIds.map((id) => Number(id))
debug('forwardMessages', messageIds)
binding.dcn_forward_msgs(this.dcn_context, messageIds, chatId)
}
getBlobdir(): string {
debug('getBlobdir')
return binding.dcn_get_blobdir(this.dcn_context)
}
getBlockedCount(): number {
debug('getBlockedCount')
return binding.dcn_get_blocked_cnt(this.dcn_context)
}
getBlockedContacts(): number[] {
debug('getBlockedContacts')
return binding.dcn_get_blocked_contacts(this.dcn_context)
}
getChat(chatId: number) {
debug(`getChat ${chatId}`)
const dc_chat = binding.dcn_get_chat(this.dcn_context, Number(chatId))
return dc_chat ? new Chat(dc_chat) : null
}
getChatContacts(chatId: number): number[] {
debug(`getChatContacts ${chatId}`)
return binding.dcn_get_chat_contacts(this.dcn_context, Number(chatId))
}
getChatIdByContactId(contactId: number): number {
debug(`getChatIdByContactId ${contactId}`)
return binding.dcn_get_chat_id_by_contact_id(
this.dcn_context,
Number(contactId)
)
}
getChatMedia(
chatId: number,
msgType1: number,
msgType2: number,
msgType3: number
): number[] {
debug(`getChatMedia ${chatId}`)
return binding.dcn_get_chat_media(
this.dcn_context,
Number(chatId),
msgType1,
msgType2 || 0,
msgType3 || 0
)
}
getMimeHeaders(messageId: number): string {
debug(`getMimeHeaders ${messageId}`)
return binding.dcn_get_mime_headers(this.dcn_context, Number(messageId))
}
getChatlistItemSummary(chatId: number, messageId: number) {
debug(`getChatlistItemSummary ${chatId} ${messageId}`)
return new Lot(
binding.dcn_chatlist_get_summary2(this.dcn_context, chatId, messageId)
)
}
getChatMessages(chatId: number, flags: number, marker1before: number) {
debug(`getChatMessages ${chatId} ${flags} ${marker1before}`)
return binding.dcn_get_chat_msgs(
this.dcn_context,
Number(chatId),
flags,
marker1before
)
}
/**
* Get encryption info for a chat.
* Get a multi-line encryption info, containing encryption preferences of all members.
* Can be used to find out why messages sent to group are not encrypted.
*
* @param chatId ID of the chat to get the encryption info for.
* @return Multi-line text, must be released using dc_str_unref() after usage.
*/
getChatEncrytionInfo(chatId: number): string {
return binding.dcn_get_chat_encrinfo(this.dcn_context, chatId)
}
getChats(listFlags: number, queryStr: string, queryContactId: number) {
debug('getChats')
const result = []
const list = this.getChatList(listFlags, queryStr, queryContactId)
const count = list.getCount()
for (let i = 0; i < count; i++) {
result.push(list.getChatId(i))
}
return result
}
getChatList(listFlags: number, queryStr: string, queryContactId: number) {
listFlags = listFlags || 0
queryStr = queryStr || ''
queryContactId = queryContactId || 0
debug(`getChatList ${listFlags} ${queryStr} ${queryContactId}`)
return new ChatList(
binding.dcn_get_chatlist(
this.dcn_context,
listFlags,
queryStr,
Number(queryContactId)
)
)
}
getConfig(key: string): string {
debug(`getConfig ${key}`)
return binding.dcn_get_config(this.dcn_context, key)
}
getContact(contactId: number) {
debug(`getContact ${contactId}`)
const dc_contact = binding.dcn_get_contact(
this.dcn_context,
Number(contactId)
)
return dc_contact ? new Contact(dc_contact) : null
}
getContactEncryptionInfo(contactId: number) {
debug(`getContactEncryptionInfo ${contactId}`)
return binding.dcn_get_contact_encrinfo(this.dcn_context, Number(contactId))
}
getContacts(listFlags: number, query: string) {
listFlags = listFlags || 0
query = query || ''
debug(`getContacts ${listFlags} ${query}`)
return binding.dcn_get_contacts(this.dcn_context, listFlags, query)
}
wasDeviceMessageEverAdded(label: string) {
debug(`wasDeviceMessageEverAdded ${label}`)
const added = binding.dcn_was_device_msg_ever_added(this.dcn_context, label)
return added === 1
}
getDraft(chatId: number) {
debug(`getDraft ${chatId}`)
const dc_msg = binding.dcn_get_draft(this.dcn_context, Number(chatId))
return dc_msg ? new Message(dc_msg) : null
}
getFreshMessageCount(chatId: number): number {
debug(`getFreshMessageCount ${chatId}`)
return binding.dcn_get_fresh_msg_cnt(this.dcn_context, Number(chatId))
}
getFreshMessages() {
debug('getFreshMessages')
return binding.dcn_get_fresh_msgs(this.dcn_context)
}
getInfo() {
debug('getInfo')
const info = binding.dcn_get_info(this.dcn_context)
return AccountManager.parseGetInfo(info)
}
getMessage(messageId: number) {
debug(`getMessage ${messageId}`)
const dc_msg = binding.dcn_get_msg(this.dcn_context, Number(messageId))
return dc_msg ? new Message(dc_msg) : null
}
getMessageCount(chatId: number): number {
debug(`getMessageCount ${chatId}`)
return binding.dcn_get_msg_cnt(this.dcn_context, Number(chatId))
}
getMessageInfo(messageId: number): string {
debug(`getMessageInfo ${messageId}`)
return binding.dcn_get_msg_info(this.dcn_context, Number(messageId))
}
getMessageHTML(messageId: number): string {
debug(`getMessageHTML ${messageId}`)
return binding.dcn_get_msg_html(this.dcn_context, Number(messageId))
}
getNextMediaMessage(
messageId: number,
msgType1: number,
msgType2: number,
msgType3: number
) {
debug(
`getNextMediaMessage ${messageId} ${msgType1} ${msgType2} ${msgType3}`
)
return this._getNextMedia(messageId, 1, msgType1, msgType2, msgType3)
}
getPreviousMediaMessage(
messageId: number,
msgType1: number,
msgType2: number,
msgType3: number
) {
debug(
`getPreviousMediaMessage ${messageId} ${msgType1} ${msgType2} ${msgType3}`
)
return this._getNextMedia(messageId, -1, msgType1, msgType2, msgType3)
}
_getNextMedia(
messageId: number,
dir: number,
msgType1: number,
msgType2: number,
msgType3: number
): number {
return binding.dcn_get_next_media(
this.dcn_context,
Number(messageId),
dir,
msgType1 || 0,
msgType2 || 0,
msgType3 || 0
)
}
getSecurejoinQrCode(chatId: number): string {
debug(`getSecurejoinQrCode ${chatId}`)
return binding.dcn_get_securejoin_qr(this.dcn_context, Number(chatId))
}
getSecurejoinQrCodeSVG(chatId: number): string {
debug(`getSecurejoinQrCodeSVG ${chatId}`)
return binding.dcn_get_securejoin_qr_svg(this.dcn_context, chatId)
}
startIO(): void {
debug(`startIO`)
binding.dcn_start_io(this.dcn_context)
}
stopIO(): void {
debug(`stopIO`)
binding.dcn_stop_io(this.dcn_context)
}
stopOngoingProcess(): void {
debug(`stopOngoingProcess`)
binding.dcn_stop_ongoing_process(this.dcn_context)
}
/**
*
* @deprectated please use `AccountManager.getSystemInfo()` instead
*/
static getSystemInfo() {
return AccountManager.getSystemInfo()
}
getConnectivity(): number {
return binding.dcn_get_connectivity(this.dcn_context)
}
getConnectivityHTML(): String {
return binding.dcn_get_connectivity_html(this.dcn_context)
}
importExport(what: number, param1: string, param2 = '') {
debug(`importExport ${what} ${param1} ${param2}`)
binding.dcn_imex(this.dcn_context, what, param1, param2)
}
importExportHasBackup(dir: string) {
debug(`importExportHasBackup ${dir}`)
return binding.dcn_imex_has_backup(this.dcn_context, dir)
}
initiateKeyTransfer(): Promise<string> {
return new Promise((resolve, reject) => {
debug('initiateKeyTransfer2')
binding.dcn_initiate_key_transfer(this.dcn_context, resolve)
})
}
isConfigured() {
debug('isConfigured')
return Boolean(binding.dcn_is_configured(this.dcn_context))
}
isContactInChat(chatId: number, contactId: number) {
debug(`isContactInChat ${chatId} ${contactId}`)
return Boolean(
binding.dcn_is_contact_in_chat(
this.dcn_context,
Number(chatId),
Number(contactId)
)
)
}
/**
*
* @returns resulting chat id or 0 on error
*/
joinSecurejoin(qrCode: string): number {
debug(`joinSecurejoin ${qrCode}`)
return binding.dcn_join_securejoin(this.dcn_context, qrCode)
}
lookupContactIdByAddr(addr: string): number {
debug(`lookupContactIdByAddr ${addr}`)
return binding.dcn_lookup_contact_id_by_addr(this.dcn_context, addr)
}
markNoticedChat(chatId: number) {
debug(`markNoticedChat ${chatId}`)
binding.dcn_marknoticed_chat(this.dcn_context, Number(chatId))
}
markSeenMessages(messageIds: number[]) {
if (!Array.isArray(messageIds)) {
messageIds = [messageIds]
}
messageIds = messageIds.map((id) => Number(id))
debug('markSeenMessages', messageIds)
binding.dcn_markseen_msgs(this.dcn_context, messageIds)
}
maybeNetwork() {
debug('maybeNetwork')
binding.dcn_maybe_network(this.dcn_context)
}
messageNew(viewType = C.DC_MSG_TEXT) {
debug(`messageNew ${viewType}`)
return new Message(binding.dcn_msg_new(this.dcn_context, viewType))
}
removeContactFromChat(chatId: number, contactId: number) {
debug(`removeContactFromChat ${chatId} ${contactId}`)
return Boolean(
binding.dcn_remove_contact_from_chat(
this.dcn_context,
Number(chatId),
Number(contactId)
)
)
}
/**
*
* @param chatId ID of the chat to search messages in. Set this to 0 for a global search.
* @param query The query to search for.
*/
searchMessages(chatId: number, query: string): number[] {
debug(`searchMessages ${chatId} ${query}`)
return binding.dcn_search_msgs(this.dcn_context, Number(chatId), query)
}
sendMessage(chatId: number, msg: string | Message) {
debug(`sendMessage ${chatId}`)
if (!msg) {
throw new Error('invalid msg parameter')
}
if (typeof msg === 'string') {
const msgObj = this.messageNew()
msgObj.setText(msg)
msg = msgObj
}
if (!msg.dc_msg) {
throw new Error('invalid msg object')
}
return binding.dcn_send_msg(this.dcn_context, Number(chatId), msg.dc_msg)
}
downloadFullMessage(messageId: number) {
binding.dcn_download_full_msg(this.dcn_context, messageId)
}
/**
*
* @returns {Promise<number>} Promise that resolves into the resulting message id
*/
sendVideochatInvitation(chatId: number): Promise<number> {
debug(`sendVideochatInvitation ${chatId}`)
return new Promise((resolve, reject) => {
binding.dcn_send_videochat_invitation(
this.dcn_context,
chatId,
(result: number) => {
if (result !== 0) {
resolve(result)
} else {
reject(
'Videochatinvitation failed to send, see error events for detailed info'
)
}
}
)
})
}
setChatName(chatId: number, name: string) {
debug(`setChatName ${chatId} ${name}`)
return Boolean(
binding.dcn_set_chat_name(this.dcn_context, Number(chatId), name)
)
}
/**
*
* @param chatId
* @param protect
* @returns success boolean
*/
setChatProtection(chatId: number, protect: boolean) {
debug(`setChatProtection ${chatId} ${protect}`)
return Boolean(
binding.dcn_set_chat_protection(
this.dcn_context,
Number(chatId),
protect ? 1 : 0
)
)
}
getChatEphemeralTimer(chatId: number): number {
debug(`getChatEphemeralTimer ${chatId}`)
return binding.dcn_get_chat_ephemeral_timer(
this.dcn_context,
Number(chatId)
)
}
setChatEphemeralTimer(chatId: number, timer: number) {
debug(`setChatEphemeralTimer ${chatId} ${timer}`)
return Boolean(
binding.dcn_set_chat_ephemeral_timer(
this.dcn_context,
Number(chatId),
Number(timer)
)
)
}
setChatProfileImage(chatId: number, image: string) {
debug(`setChatProfileImage ${chatId} ${image}`)
return Boolean(
binding.dcn_set_chat_profile_image(
this.dcn_context,
Number(chatId),
image || ''
)
)
}
setConfig(key: string, value: string | boolean | number): number {
debug(`setConfig (string) ${key} ${value}`)
if (value === null) {
return binding.dcn_set_config_null(this.dcn_context, key)
} else {
if (typeof value === 'boolean') {
value = value === true ? '1' : '0'
} else if (typeof value === 'number') {
value = String(value)
}
return binding.dcn_set_config(this.dcn_context, key, value)
}
}
setConfigFromQr(qrcodeContent: string): boolean {
return Boolean(
binding.dcn_set_config_from_qr(this.dcn_context, qrcodeContent)
)
}
estimateDeletionCount(fromServer: boolean, seconds: number): number {
debug(`estimateDeletionCount fromServer: ${fromServer} seconds: ${seconds}`)
return binding.dcn_estimate_deletion_cnt(
this.dcn_context,
fromServer === true ? 1 : 0,
seconds
)
}
setStockTranslation(stockId: number, stockMsg: string) {
debug(`setStockTranslation ${stockId} ${stockMsg}`)
return Boolean(
binding.dcn_set_stock_translation(
this.dcn_context,
Number(stockId),
stockMsg
)
)
}
setDraft(chatId: number, msg: Message | null) {
debug(`setDraft ${chatId}`)
binding.dcn_set_draft(
this.dcn_context,
Number(chatId),
msg ? msg.dc_msg : null
)
}
setLocation(latitude: number, longitude: number, accuracy: number) {
debug(`setLocation ${latitude}`)
binding.dcn_set_location(
this.dcn_context,
Number(latitude),
Number(longitude),
Number(accuracy)
)
}
/*
* @param chatId Chat-id to get location information for.
* 0 to get locations independently of the chat.
* @param contactId Contact id to get location information for.
* If also a chat-id is given, this should be a member of the given chat.
* 0 to get locations independently of the contact.
* @param timestampFrom Start of timespan to return.
* Must be given in number of seconds since 00:00 hours, Jan 1, 1970 UTC.
* 0 for "start from the beginning".
* @param timestampTo End of timespan to return.
* Must be given in number of seconds since 00:00 hours, Jan 1, 1970 UTC.
* 0 for "all up to now".
* @return Array of locations, NULL is never returned.
* The array is sorted decending;
* the first entry in the array is the location with the newest timestamp.
*
* Examples:
* // get locations from the last hour for a global map
* getLocations(0, 0, time(NULL)-60*60, 0);
*
* // get locations from a contact for a global map
* getLocations(0, contact_id, 0, 0);
*
* // get all locations known for a given chat
* getLocations(chat_id, 0, 0, 0);
*
* // get locations from a single contact for a given chat
* getLocations(chat_id, contact_id, 0, 0);
*/
getLocations(
chatId: number,
contactId: number,
timestampFrom = 0,
timestampTo = 0
) {
const locations = new Locations(
binding.dcn_get_locations(
this.dcn_context,
Number(chatId),
Number(contactId),
timestampFrom,
timestampTo
)
)
return locations.toJson()
}
/**
*
* @param duration The duration (0 for no mute, -1 for forever mute, everything else is is the relative mute duration from now in seconds)
*/
setChatMuteDuration(chatId: number, duration: number) {
return Boolean(
binding.dcn_set_chat_mute_duration(this.dcn_context, chatId, duration)
)
}
/** get information about the provider */
getProviderFromEmail(email: string) {
debug('DeltaChat.getProviderFromEmail')
const provider = binding.dcn_provider_new_from_email(
this.dcn_context,
email
)
if (!provider) {
return undefined
}
return {
before_login_hint: binding.dcn_provider_get_before_login_hint(provider),
overview_page: binding.dcn_provider_get_overview_page(provider),
status: binding.dcn_provider_get_status(provider),
}
}
sendWebxdcStatusUpdate<T>(
msgId: number,
json: WebxdcSendingStatusUpdate<T>,
descr: string
) {
return Boolean(
binding.dcn_send_webxdc_status_update(
this.dcn_context,
msgId,
JSON.stringify(json),
descr
)
)
}
getWebxdcStatusUpdates<T>(
msgId: number,
serial = 0
): WebxdcReceivedStatusUpdate<T>[] {
return JSON.parse(
binding.dcn_get_webxdc_status_updates(this.dcn_context, msgId, serial)
)
}
/** the string contains the binary data, it is an "u8 string", maybe we will use a more efficient type in the future. */
getWebxdcBlob(message: Message, filename: string): Buffer | null {
return binding.dcn_msg_get_webxdc_blob(message.dc_msg, filename)
}
}
export type WebxdcInfo = {
name: string
icon: string
summary: string
/**
* if set by the webxdc, name of the document in edit
*/
document?: string
}
type WebxdcSendingStatusUpdate<T> = {
/** the payload, deserialized json:
* any javascript primitive, array or object. */
payload: T
/** optional, short, informational message that will be added to the chat,
* eg. "Alice voted" or "Bob scored 123 in MyGame";
* usually only one line of text is shown,
* use this option sparingly to not spam the chat. */
info?: string
/** optional, short text, shown beside app icon;
* it is recommended to use some aggregated value,
* eg. "8 votes", "Highscore: 123" */
summary?: string
/**
* optional, name of the document in edit,
* must not be used eg. in games where the Webxdc does not create documents
*/
document?: string
}
type WebxdcReceivedStatusUpdate<T> = {
/** the payload, deserialized json */
payload: T
/** the serial number of this update. Serials are larger `0` and newer serials have higher numbers. */
serial: number
/** the maximum serial currently known.
* If `max_serial` equals `serial` this update is the last update (until new network messages arrive). */
max_serial: number
/** optional, short, informational message. */
info?: string
/** optional, short text, shown beside app icon. If there are no updates, an empty JSON-array is returned. */
summary?: string
}

205
node/lib/deltachat.ts Normal file
View File

@@ -0,0 +1,205 @@
/* eslint-disable camelcase */
import binding from './binding'
import { EventId2EventName } from './constants'
import { EventEmitter } from 'events'
import { existsSync } from 'fs'
import rawDebug from 'debug'
import { tmpdir } from 'os'
import { join } from 'path'
import { Context } from './context'
const debug = rawDebug('deltachat:node:index')
const noop = function () {}
interface NativeAccount {}
/**
* Wrapper around dcn_account_t*
*/
export class AccountManager extends EventEmitter {
dcn_accounts: NativeAccount
accountDir: string
constructor(cwd: string, os = 'deltachat-node') {
debug('DeltaChat constructor')
super()
this.accountDir = cwd
this.dcn_accounts = binding.dcn_accounts_new(os, this.accountDir)
}
getAllAccountIds() {
return binding.dcn_accounts_get_all(this.dcn_accounts)
}
selectAccount(account_id: number) {
return binding.dcn_accounts_select_account(this.dcn_accounts, account_id)
}
selectedAccount(): number {
return binding.dcn_accounts_get_selected_account(this.dcn_accounts)
}
addAccount(): number {
return binding.dcn_accounts_add_account(this.dcn_accounts)
}
addClosedAccount(): number {
return binding.dcn_accounts_add_closed_account(this.dcn_accounts)
}
removeAccount(account_id: number) {
return binding.dcn_accounts_remove_account(this.dcn_accounts, account_id)
}
accountContext(account_id: number) {
const native_context = binding.dcn_accounts_get_account(
this.dcn_accounts,
account_id
)
if (native_context === null) {
throw new Error(
`could not get context with id ${account_id}, does it even exist? please check your ids`
)
}
return new Context(this, native_context, account_id)
}
migrateAccount(dbfile: string): number {
return binding.dcn_accounts_migrate_account(this.dcn_accounts, dbfile)
}
close() {
this.stopIO()
debug('unrefing context')
binding.dcn_accounts_unref(this.dcn_accounts)
debug('Unref end')
}
emit(
event: string | symbol,
account_id: number,
data1: any,
data2: any
): boolean {
super.emit('ALL', event, account_id, data1, data2)
return super.emit(event, account_id, data1, data2)
}
handleCoreEvent(
eventId: number,
accountId: number,
data1: number,
data2: number | string
) {
const eventString = EventId2EventName[eventId]
debug('event', eventString, accountId, data1, data2)
debug(eventString, data1, data2)
if (!this.emit) {
console.log('Received an event but EventEmitter is already destroyed.')
console.log(eventString, data1, data2)
return
}
this.emit(eventString, accountId, data1, data2)
}
startEvents() {
if (this.dcn_accounts === null) {
throw new Error('dcn_account is null')
}
binding.dcn_accounts_start_event_handler(
this.dcn_accounts,
this.handleCoreEvent.bind(this)
)
debug('Started event handler')
}
startIO() {
binding.dcn_accounts_start_io(this.dcn_accounts)
}
stopIO() {
binding.dcn_accounts_stop_io(this.dcn_accounts)
}
static maybeValidAddr(addr: string) {
debug('DeltaChat.maybeValidAddr')
if (addr === null) return false
return Boolean(binding.dcn_maybe_valid_addr(addr))
}
static parseGetInfo(info: string) {
debug('static _getInfo')
const result: { [key: string]: string } = {}
const regex = /^(\w+)=(.*)$/i
info
.split('\n')
.filter(Boolean)
.forEach((line) => {
const match = regex.exec(line)
if (match) {
result[match[1]] = match[2]
}
})
return result
}
static newTemporary() {
let directory = null
while (true) {
const randomString = Math.random().toString(36).substr(2, 5)
directory = join(tmpdir(), 'deltachat-' + randomString)
if (!existsSync(directory)) break
}
const dc = new AccountManager(directory)
const accountId = dc.addAccount()
const context = dc.accountContext(accountId)
return { dc, context, accountId, directory }
}
static getSystemInfo() {
debug('DeltaChat.getSystemInfo')
const { dc, context } = AccountManager.newTemporary()
const info = AccountManager.parseGetInfo(
binding.dcn_get_info(context.dcn_context)
)
const {
deltachat_core_version,
sqlite_version,
sqlite_thread_safe,
libetpan_version,
openssl_version,
compile_date,
arch,
} = info
const result = {
deltachat_core_version,
sqlite_version,
sqlite_thread_safe,
libetpan_version,
openssl_version,
compile_date,
arch,
}
context.unref()
dc.close()
return result
}
/** get information about the provider
*
* This function creates a temporary context to be standalone,
* if posible use `Context.getProviderFromEmail` instead. (otherwise potential proxy settings are not used)
* @deprecated
*/
static getProviderFromEmail(email: string) {
debug('DeltaChat.getProviderFromEmail')
const { dc, context } = AccountManager.newTemporary()
const provider = context.getProviderFromEmail(email)
context.unref()
dc.close()
return provider
}
}

20
node/lib/index.ts Normal file
View File

@@ -0,0 +1,20 @@
import { AccountManager } from './deltachat'
export default AccountManager
export { Context } from './context'
export { Chat } from './chat'
export { ChatList } from './chatlist'
export { C } from './constants'
export { Contact } from './contact'
export { AccountManager as DeltaChat }
export { Locations } from './locations'
export { Lot } from './lot'
export {
Message,
MessageState,
MessageViewType,
MessageDownloadState,
} from './message'
export * from './types'

82
node/lib/locations.ts Normal file
View File

@@ -0,0 +1,82 @@
/* eslint-disable camelcase */
const binding = require('../binding')
const debug = require('debug')('deltachat:node:locations')
interface NativeLocations {}
/**
* Wrapper around dc_location_t*
*/
export class Locations {
constructor(public dc_locations: NativeLocations) {
debug('Locations constructor')
if (dc_locations === null) {
throw new Error('dc_locations can not be null')
}
}
locationToJson(index: number) {
debug('locationToJson')
return {
accuracy: this.getAccuracy(index),
latitude: this.getLatitude(index),
longitude: this.getLongitude(index),
timestamp: this.getTimestamp(index),
contactId: this.getContactId(index),
msgId: this.getMsgId(index),
chatId: this.getChatId(index),
isIndependent: this.isIndependent(index),
marker: this.getMarker(index),
}
}
toJson(): ReturnType<Locations['locationToJson']>[] {
debug('toJson')
const locations = []
const count = this.getCount()
for (let index = 0; index < count; index++) {
locations.push(this.locationToJson(index))
}
return locations
}
getCount(): number {
return binding.dcn_array_get_cnt(this.dc_locations)
}
getAccuracy(index: number): number {
return binding.dcn_array_get_accuracy(this.dc_locations, index)
}
getLatitude(index: number): number {
return binding.dcn_array_get_latitude(this.dc_locations, index)
}
getLongitude(index: number): number {
return binding.dcn_array_get_longitude(this.dc_locations, index)
}
getTimestamp(index: number): number {
return binding.dcn_array_get_timestamp(this.dc_locations, index)
}
getMsgId(index: number): number {
return binding.dcn_array_get_msg_id(this.dc_locations, index)
}
getContactId(index: number): number {
return binding.dcn_array_get_contact_id(this.dc_locations, index)
}
getChatId(index: number): number {
return binding.dcn_array_get_chat_id(this.dc_locations, index)
}
isIndependent(index: number): boolean {
return binding.dcn_array_is_independent(this.dc_locations, index)
}
getMarker(index: number): string {
return binding.dcn_array_get_marker(this.dc_locations, index)
}
}

52
node/lib/lot.ts Normal file
View File

@@ -0,0 +1,52 @@
/* eslint-disable camelcase */
const binding = require('../binding')
const debug = require('debug')('deltachat:node:lot')
interface NativeLot {}
/**
* Wrapper around dc_lot_t*
*/
export class Lot {
constructor(public dc_lot: NativeLot) {
debug('Lot constructor')
if (dc_lot === null) {
throw new Error('dc_lot can not be null')
}
}
toJson() {
debug('toJson')
return {
state: this.getState(),
text1: this.getText1(),
text1Meaning: this.getText1Meaning(),
text2: this.getText2(),
timestamp: this.getTimestamp(),
}
}
getId(): number {
return binding.dcn_lot_get_id(this.dc_lot)
}
getState(): number {
return binding.dcn_lot_get_state(this.dc_lot)
}
getText1(): string {
return binding.dcn_lot_get_text1(this.dc_lot)
}
getText1Meaning(): string {
return binding.dcn_lot_get_text1_meaning(this.dc_lot)
}
getText2(): string {
return binding.dcn_lot_get_text2(this.dc_lot)
}
getTimestamp(): number {
return binding.dcn_lot_get_timestamp(this.dc_lot)
}
}

370
node/lib/message.ts Normal file
View File

@@ -0,0 +1,370 @@
/* eslint-disable camelcase */
import binding from './binding'
import { C } from './constants'
import { Lot } from './lot'
import { Chat } from './chat'
import { WebxdcInfo } from './context'
const debug = require('debug')('deltachat:node:message')
export enum MessageDownloadState {
Available = C.DC_DOWNLOAD_AVAILABLE,
Done = C.DC_DOWNLOAD_DONE,
Failure = C.DC_DOWNLOAD_FAILURE,
InProgress = C.DC_DOWNLOAD_IN_PROGRESS,
}
/**
* Helper class for message states so you can do e.g.
*
* if (msg.getState().isPending()) { .. }
*
*/
export class MessageState {
constructor(public state: number) {
debug(`MessageState constructor ${state}`)
}
isUndefined() {
return this.state === C.DC_STATE_UNDEFINED
}
isFresh() {
return this.state === C.DC_STATE_IN_FRESH
}
isNoticed() {
return this.state === C.DC_STATE_IN_NOTICED
}
isSeen() {
return this.state === C.DC_STATE_IN_SEEN
}
isPending() {
return this.state === C.DC_STATE_OUT_PENDING
}
isFailed() {
return this.state === C.DC_STATE_OUT_FAILED
}
isDelivered() {
return this.state === C.DC_STATE_OUT_DELIVERED
}
isReceived() {
return this.state === C.DC_STATE_OUT_MDN_RCVD
}
}
/**
* Helper class for message types so you can do e.g.
*
* if (msg.getViewType().isVideo()) { .. }
*
*/
export class MessageViewType {
constructor(public viewType: number) {
debug(`MessageViewType constructor ${viewType}`)
}
isText() {
return this.viewType === C.DC_MSG_TEXT
}
isImage() {
return this.viewType === C.DC_MSG_IMAGE || this.viewType === C.DC_MSG_GIF
}
isGif() {
return this.viewType === C.DC_MSG_GIF
}
isAudio() {
return this.viewType === C.DC_MSG_AUDIO || this.viewType === C.DC_MSG_VOICE
}
isVoice() {
return this.viewType === C.DC_MSG_VOICE
}
isVideo() {
return this.viewType === C.DC_MSG_VIDEO
}
isFile() {
return this.viewType === C.DC_MSG_FILE
}
isVideochatInvitation() {
return this.viewType === C.DC_MSG_VIDEOCHAT_INVITATION
}
}
interface NativeMessage {}
/**
* Wrapper around dc_msg_t*
*/
export class Message {
constructor(public dc_msg: NativeMessage) {
debug('Message constructor')
if (dc_msg === null) {
throw new Error('dc_msg can not be null')
}
}
toJson() {
debug('toJson')
const quotedMessage = this.getQuotedMessage()
const viewType = binding.dcn_msg_get_viewtype(this.dc_msg)
return {
chatId: this.getChatId(),
webxdcInfo: viewType == C.DC_MSG_WEBXDC ? this.webxdcInfo : null,
downloadState: this.downloadState,
duration: this.getDuration(),
file: this.getFile(),
fromId: this.getFromId(),
id: this.getId(),
quotedText: this.getQuotedText(),
quotedMessageId: quotedMessage ? quotedMessage.getId() : null,
receivedTimestamp: this.getReceivedTimestamp(),
sortTimestamp: this.getSortTimestamp(),
text: this.getText(),
timestamp: this.getTimestamp(),
hasLocation: this.hasLocation(),
hasHTML: this.hasHTML,
viewType,
state: binding.dcn_msg_get_state(this.dc_msg),
hasDeviatingTimestamp: this.hasDeviatingTimestamp(),
showPadlock: this.getShowpadlock(),
summary: this.getSummary().toJson(),
subject: this.subject,
isSetupmessage: this.isSetupmessage(),
isInfo: this.isInfo(),
isForwarded: this.isForwarded(),
dimensions: {
height: this.getHeight(),
width: this.getWidth(),
},
videochatType: this.getVideochatType(),
videochatUrl: this.getVideochatUrl(),
overrideSenderName: this.overrideSenderName,
parentId: this.parent?.getId(),
}
}
getChatId(): number {
return binding.dcn_msg_get_chat_id(this.dc_msg)
}
get webxdcInfo(): WebxdcInfo | null {
let info = binding.dcn_msg_get_webxdc_info(this.dc_msg)
return info
? JSON.parse(binding.dcn_msg_get_webxdc_info(this.dc_msg))
: null
}
get downloadState(): MessageDownloadState {
return binding.dcn_msg_get_download_state(this.dc_msg)
}
get parent(): Message | null {
let msg = binding.dcn_msg_get_parent(this.dc_msg)
return msg ? new Message(msg) : null
}
getDuration(): number {
return binding.dcn_msg_get_duration(this.dc_msg)
}
getFile(): string {
return binding.dcn_msg_get_file(this.dc_msg)
}
getFilebytes(): number {
return binding.dcn_msg_get_filebytes(this.dc_msg)
}
getFilemime(): string {
return binding.dcn_msg_get_filemime(this.dc_msg)
}
getFilename(): string {
return binding.dcn_msg_get_filename(this.dc_msg)
}
getFromId(): number {
return binding.dcn_msg_get_from_id(this.dc_msg)
}
getHeight(): number {
return binding.dcn_msg_get_height(this.dc_msg)
}
getId(): number {
return binding.dcn_msg_get_id(this.dc_msg)
}
getQuotedText(): string {
return binding.dcn_msg_get_quoted_text(this.dc_msg)
}
getQuotedMessage(): Message | null {
const dc_msg = binding.dcn_msg_get_quoted_msg(this.dc_msg)
return dc_msg ? new Message(dc_msg) : null
}
getReceivedTimestamp(): number {
return binding.dcn_msg_get_received_timestamp(this.dc_msg)
}
getSetupcodebegin() {
return binding.dcn_msg_get_setupcodebegin(this.dc_msg)
}
getShowpadlock() {
return Boolean(binding.dcn_msg_get_showpadlock(this.dc_msg))
}
getSortTimestamp(): number {
return binding.dcn_msg_get_sort_timestamp(this.dc_msg)
}
getState() {
return new MessageState(binding.dcn_msg_get_state(this.dc_msg))
}
getSummary(chat?: Chat) {
const dc_chat = (chat && chat.dc_chat) || null
return new Lot(binding.dcn_msg_get_summary(this.dc_msg, dc_chat))
}
get subject(): string {
return binding.dcn_msg_get_subject(this.dc_msg)
}
getSummarytext(approxCharacters: number): string {
approxCharacters = approxCharacters || 0
return binding.dcn_msg_get_summarytext(this.dc_msg, approxCharacters)
}
getText(): string {
return binding.dcn_msg_get_text(this.dc_msg)
}
getTimestamp(): number {
return binding.dcn_msg_get_timestamp(this.dc_msg)
}
getViewType() {
return new MessageViewType(binding.dcn_msg_get_viewtype(this.dc_msg))
}
getVideochatType(): number {
return binding.dcn_msg_get_videochat_type(this.dc_msg)
}
getVideochatUrl(): string {
return binding.dcn_msg_get_videochat_url(this.dc_msg)
}
getWidth(): number {
return binding.dcn_msg_get_width(this.dc_msg)
}
get overrideSenderName(): string {
return binding.dcn_msg_get_override_sender_name(this.dc_msg)
}
hasDeviatingTimestamp() {
return binding.dcn_msg_has_deviating_timestamp(this.dc_msg)
}
hasLocation() {
return Boolean(binding.dcn_msg_has_location(this.dc_msg))
}
get hasHTML() {
return Boolean(binding.dcn_msg_has_html(this.dc_msg))
}
isDeadDrop() {
// TODO: Fix
//return this.getChatId() === C.DC_CHAT_ID_DEADDROP
return false
}
isForwarded() {
return Boolean(binding.dcn_msg_is_forwarded(this.dc_msg))
}
isIncreation() {
return Boolean(binding.dcn_msg_is_increation(this.dc_msg))
}
isInfo() {
return Boolean(binding.dcn_msg_is_info(this.dc_msg))
}
isSent() {
return Boolean(binding.dcn_msg_is_sent(this.dc_msg))
}
isSetupmessage() {
return Boolean(binding.dcn_msg_is_setupmessage(this.dc_msg))
}
latefilingMediasize(width: number, height: number, duration: number) {
binding.dcn_msg_latefiling_mediasize(this.dc_msg, width, height, duration)
}
setDimension(width: number, height: number) {
binding.dcn_msg_set_dimension(this.dc_msg, width, height)
return this
}
setDuration(duration: number) {
binding.dcn_msg_set_duration(this.dc_msg, duration)
return this
}
setFile(file: string, mime?: string) {
if (typeof file !== 'string') throw new Error('Missing filename')
binding.dcn_msg_set_file(this.dc_msg, file, mime || '')
return this
}
setLocation(longitude: number, latitude: number) {
binding.dcn_msg_set_location(this.dc_msg, longitude, latitude)
return this
}
setQuote(quotedMessage: Message | null) {
binding.dcn_msg_set_quote(this.dc_msg, quotedMessage?.dc_msg)
return this
}
setText(text: string) {
binding.dcn_msg_set_text(this.dc_msg, text)
return this
}
setHTML(html: string) {
binding.dcn_msg_set_html(this.dc_msg, html)
return this
}
setOverrideSenderName(senderName: string) {
binding.dcn_msg_set_override_sender_name(this.dc_msg, senderName)
return this
}
/** Force the message to be sent in plain text.
*
* This API is for bots, there is no need to expose it in the UI.
*/
forcePlaintext() {
binding.dcn_msg_force_plaintext(this.dc_msg)
}
}

24
node/lib/types.ts Normal file
View File

@@ -0,0 +1,24 @@
import { C } from './constants'
export type ChatTypes =
| C.DC_CHAT_TYPE_GROUP
| C.DC_CHAT_TYPE_MAILINGLIST
| C.DC_CHAT_TYPE_SINGLE
| C.DC_CHAT_TYPE_UNDEFINED
export interface ChatJSON {
archived: boolean
pinned: boolean
color: string
id: number
name: string
profileImage: string
type: number
isSelfTalk: boolean
isUnpromoted: boolean
isProtected: boolean
canSend: boolean
isDeviceTalk: boolean
isContactRequest: boolean
muted: boolean
}

6
node/lib/util.ts Normal file
View File

@@ -0,0 +1,6 @@
/**
* @param integerColor expects a 24bit rgb integer (left to right: 8bits red, 8bits green, 8bits blue)
*/
export function integerToHexColor(integerColor: number) {
return '#' + (integerColor + 16777216).toString(16).substring(1)
}

View File

@@ -0,0 +1,13 @@
diff --git i/node/binding.gyp w/node/binding.gyp
index b0d92eae..c5e504fa 100644
--- i/node/binding.gyp
+++ w/node/binding.gyp
@@ -43,7 +43,7 @@
"include_dirs": ["../deltachat-ffi"],
"ldflags": ["-Wl,-Bsymbolic"], # Prevent sqlite3 from electron from overriding sqlcipher
"libraries": [
- "../../target/release/libdeltachat.a",
+ "../../target/x86_64-apple-darwin/release/libdeltachat.a",
"-ldl",
],
"conditions": [],

26
node/scripts/common.js Normal file
View File

@@ -0,0 +1,26 @@
const spawnSync = require('child_process').spawnSync
const verbose = isVerbose()
function spawn (cmd, args, opts) {
log(`>> spawn: ${cmd} ${args.join(' ')}`)
const result = spawnSync(cmd, args, opts)
if (result.status === null) {
console.error(`Could not find ${cmd}`)
process.exit(1)
} else if (result.status !== 0) {
console.error(`${cmd} failed with code ${result.status}`)
process.exit(1)
}
}
function log (...args) {
if (verbose) console.log(...args)
}
function isVerbose () {
const loglevel = process.env.npm_config_loglevel
return loglevel === 'verbose' || process.env.CI === 'true'
}
module.exports = { spawn, log, isVerbose, verbose }

View File

@@ -0,0 +1,73 @@
#!/usr/bin/env node
const fs = require('fs')
const path = require('path')
const split = require('split2')
const data = []
const regex = /^#define\s+(\w+)\s+(\w+)/i
const header = path.resolve(
__dirname,
'../../deltachat-ffi/deltachat.h'
)
console.log('Generating constants...')
fs.createReadStream(header)
.pipe(split())
.on('data', (line) => {
const match = regex.exec(line)
if (match) {
const key = match[1]
const value = parseInt(match[2])
if (isNaN(value)) return
data.push({ key, value })
}
})
.on('end', () => {
const constants = data
.filter(
({ key }) => key.toUpperCase()[0] === key[0] // check if define name is uppercase
)
.sort((lhs, rhs) => {
if (lhs.key < rhs.key) return -1
else if (lhs.key > rhs.key) return 1
return 0
})
.map((row) => {
return ` ${row.key}: ${row.value}`
})
.join(',\n')
const events = data
.sort((lhs, rhs) => {
if (lhs.value < rhs.value) return -1
else if (lhs.value > rhs.value) return 1
return 0
})
.filter((i) => {
return i.key.startsWith('DC_EVENT_')
})
.map((i) => {
return ` ${i.value}: '${i.key}'`
})
.join(',\n')
// backwards compat
fs.writeFileSync(
path.resolve(__dirname, '../constants.js'),
`// Generated!\n\nmodule.exports = {\n${constants}\n}\n`
)
// backwards compat
fs.writeFileSync(
path.resolve(__dirname, '../events.js'),
`/* eslint-disable quotes */\n// Generated!\n\nmodule.exports = {\n${events}\n}\n`
)
fs.writeFileSync(
path.resolve(__dirname, '../lib/constants.ts'),
`// Generated!\n\nexport enum C {\n${constants.replace(/:/g, ' =')},\n}\n
// Generated!\n\nexport const EventId2EventName: { [key: number]: string } = {\n${events},\n}\n`
)
})

22
node/scripts/install.js Normal file
View File

@@ -0,0 +1,22 @@
const {execSync} = require('child_process')
const {existsSync} = require('fs')
const {join} = require('path')
const run = (cmd) => {
console.log('[i] running `' + cmd + '`')
execSync(cmd, {stdio: 'inherit'})
}
// Build bindings
if (process.env.USE_SYSTEM_LIBDELTACHAT === 'true') {
console.log('[i] USE_SYSTEM_LIBDELTACHAT is true, rebuilding c bindings and using pkg-config to retrieve lib paths and cflags of libdeltachat')
run('npm run build:bindings:c:c')
} else {
console.log('[i] Building rust core & c bindings, if possible use prebuilds')
run('npm run install:prebuilds')
}
if (!existsSync(join(__dirname, '..', 'dist'))) {
console.log('[i] Didn\'t find already built typescript bindings. Trying to transpile them. If this fail, make sure typescript is installed ;)')
run('npm run build:bindings:ts')
}

View File

@@ -0,0 +1,46 @@
const { readFileSync } = require('fs')
const sha = JSON.parse(
readFileSync(process.env['GITHUB_EVENT_PATH'], 'utf8')
).pull_request.head.sha
const base_url =
'https://download.delta.chat/node/'
const GITHUB_API_URL =
'https://api.github.com/repos/deltachat/deltachat-core-rust/statuses/' + sha
const file_url = process.env['URL']
const GITHUB_TOKEN = process.env['GITHUB_TOKEN']
const STATUS_DATA = {
state: 'success',
description: '⏩ Click on "Details" to download →',
context: 'Download the node-bindings.tar.gz',
target_url: base_url + file_url,
}
const http = require('https')
const options = {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'User-Agent': 'github-action ci for deltachat deskop',
authorization: 'Bearer ' + GITHUB_TOKEN,
},
}
const req = http.request(GITHUB_API_URL, options, function(res) {
var chunks = []
res.on('data', function(chunk) {
chunks.push(chunk)
})
res.on('end', function() {
var body = Buffer.concat(chunks)
console.log(body.toString())
})
})
req.write(JSON.stringify(STATUS_DATA))
req.end()

View File

@@ -0,0 +1,57 @@
const fs = require('fs')
const path = require('path')
if (process.platform !== 'win32') {
console.log('postinstall: not windows, so skipping!')
process.exit(0)
}
const from = path.resolve(
__dirname,
'..',
'..',
'target',
'release',
'deltachat.dll'
)
const getDestination = () => {
const argv = process.argv
if (argv.length === 3 && argv[2] === '--prebuild') {
return path.resolve(
__dirname,
'..',
'prebuilds',
'win32-x64',
'deltachat.dll'
)
} else {
return path.resolve(
__dirname,
'..',
'build',
'Release',
'deltachat.dll'
)
}
}
const dest = getDestination()
copy(from, dest, (err) => {
if (err) throw err
console.log(`postinstall: copied ${from} to ${dest}`)
})
function copy (from, to, cb) {
fs.stat(from, (err, st) => {
if (err) return cb(err)
fs.readFile(from, (err, buf) => {
if (err) return cb(err)
fs.writeFile(to, buf, (err) => {
if (err) return cb(err)
fs.chmod(to, st.mode, cb)
})
})
})
}

View File

@@ -0,0 +1,17 @@
const path = require('path')
const { spawn } = require('./common')
const opts = {
cwd: path.resolve(__dirname, '../..'),
stdio: 'inherit'
}
const buildArgs = [
'build',
'--release',
'--features',
'vendored',
'-p',
'deltachat_ffi'
]
spawn('cargo', buildArgs, opts)

3505
node/src/module.c Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,144 @@
#include <napi-macros.h>
#undef NAPI_STATUS_THROWS
#define NAPI_STATUS_THROWS(call) \
if ((call) != napi_ok) { \
napi_throw_error(env, NULL, #call " failed!"); \
}
#define NAPI_DCN_CONTEXT() \
dcn_context_t* dcn_context; \
NAPI_STATUS_THROWS(napi_get_value_external(env, argv[0], (void**)&dcn_context)); \
if (!dcn_context) { \
const char* msg = "Provided dnc_context is null"; \
NAPI_STATUS_THROWS(napi_throw_type_error(env, NULL, msg)); \
} \
if (!dcn_context->dc_context) { \
const char* msg = "Provided dc_context is null, did you close the context or not open it?"; \
NAPI_STATUS_THROWS(napi_throw_type_error(env, NULL, msg)); \
}
#define NAPI_DCN_ACCOUNTS() \
dcn_accounts_t* dcn_accounts; \
NAPI_STATUS_THROWS(napi_get_value_external(env, argv[0], (void**)&dcn_accounts)); \
if (!dcn_accounts) { \
const char* msg = "Provided dnc_acounts is null"; \
NAPI_STATUS_THROWS(napi_throw_type_error(env, NULL, msg)); \
} \
if (!dcn_accounts->dc_accounts) { \
const char* msg = "Provided dc_accounts is null, did you unref the accounts object?"; \
NAPI_STATUS_THROWS(napi_throw_type_error(env, NULL, msg)); \
}
#define NAPI_DC_CHAT() \
dc_chat_t* dc_chat; \
NAPI_STATUS_THROWS(napi_get_value_external(env, argv[0], (void**)&dc_chat));
#define NAPI_DC_CHATLIST() \
dc_chatlist_t* dc_chatlist; \
NAPI_STATUS_THROWS(napi_get_value_external(env, argv[0], (void**)&dc_chatlist));
#define NAPI_DC_CONTACT() \
dc_contact_t* dc_contact; \
NAPI_STATUS_THROWS(napi_get_value_external(env, argv[0], (void**)&dc_contact));
#define NAPI_DC_LOT() \
dc_lot_t* dc_lot; \
NAPI_STATUS_THROWS(napi_get_value_external(env, argv[0], (void**)&dc_lot));
#define NAPI_DC_MSG() \
dc_msg_t* dc_msg; \
NAPI_STATUS_THROWS(napi_get_value_external(env, argv[0], (void**)&dc_msg));
#define NAPI_ARGV_DC_MSG(name, position) \
dc_msg_t* name; \
NAPI_STATUS_THROWS(napi_get_value_external(env, argv[position], (void**)&name));
#define NAPI_DC_PROVIDER() \
dc_provider_t* dc_provider; \
NAPI_STATUS_THROWS(napi_get_value_external(env, argv[0], (void**)&dc_provider));
#define NAPI_DC_ARRAY() \
dc_array_t* dc_array; \
NAPI_STATUS_THROWS(napi_get_value_external(env, argv[0], (void**)&dc_array));
#define NAPI_RETURN_UNDEFINED() \
return 0;
#define NAPI_RETURN_UINT64(name) \
napi_value return_int64; \
NAPI_STATUS_THROWS(napi_create_bigint_int64(env, name, &return_int64)); \
return return_int64;
#define NAPI_RETURN_INT64(name) \
napi_value return_int64; \
NAPI_STATUS_THROWS(napi_create_int64(env, name, &return_int64)); \
return return_int64;
#define NAPI_RETURN_AND_UNREF_STRING(name) \
napi_value return_value; \
if (name == NULL) { \
NAPI_STATUS_THROWS(napi_get_null(env, &return_value)); \
return return_value; \
} \
NAPI_STATUS_THROWS(napi_create_string_utf8(env, name, NAPI_AUTO_LENGTH, &return_value)); \
dc_str_unref(name); \
return return_value;
#define NAPI_ASYNC_CARRIER_BEGIN(name) \
typedef struct name##_carrier_t { \
napi_ref callback_ref; \
napi_async_work async_work; \
dcn_context_t* dcn_context;
#define NAPI_ASYNC_CARRIER_END(name) \
} name##_carrier_t;
#define NAPI_ASYNC_EXECUTE(name) \
static void name##_execute(napi_env env, void* data)
#define NAPI_ASYNC_GET_CARRIER(name) \
name##_carrier_t* carrier = (name##_carrier_t*)data;
#define NAPI_ASYNC_COMPLETE(name) \
static void name##_complete(napi_env env, napi_status status, void* data)
#define NAPI_ASYNC_CALL_AND_DELETE_CB() \
napi_value global; \
NAPI_STATUS_THROWS(napi_get_global(env, &global)); \
napi_value callback; \
NAPI_STATUS_THROWS(napi_get_reference_value(env, carrier->callback_ref, &callback)); \
NAPI_STATUS_THROWS(napi_call_function(env, global, callback, argc, argv, NULL)); \
NAPI_STATUS_THROWS(napi_delete_reference(env, carrier->callback_ref)); \
NAPI_STATUS_THROWS(napi_delete_async_work(env, carrier->async_work));
#define NAPI_ASYNC_NEW_CARRIER(name) \
name##_carrier_t* carrier = calloc(1, sizeof(name##_carrier_t)); \
carrier->dcn_context = dcn_context;
#define NAPI_ASYNC_QUEUE_WORK(name, cb) \
napi_value callback = cb; \
napi_value async_resource_name; \
NAPI_STATUS_THROWS(napi_create_reference(env, callback, 1, &carrier->callback_ref)); \
NAPI_STATUS_THROWS(napi_create_string_utf8(env, #name "_callback", \
NAPI_AUTO_LENGTH, \
&async_resource_name)); \
NAPI_STATUS_THROWS(napi_create_async_work(env, callback, async_resource_name, \
name##_execute, name##_complete, \
carrier, &carrier->async_work)); \
NAPI_STATUS_THROWS(napi_queue_async_work(env, carrier->async_work));
/*** this could/should be moved to napi-macros ***/
#define NAPI_DOUBLE(name, val) \
double name; \
if (napi_get_value_double(env, val, &name) != napi_ok) { \
napi_throw_error(env, "EINVAL", "Expected double"); \
return NULL; \
}
#define NAPI_ARGV_DOUBLE(name, i) \
NAPI_DOUBLE(name, argv[i])

BIN
node/test/fixtures/avatar.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

BIN
node/test/fixtures/image.jpeg vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
node/test/fixtures/logo.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

862
node/test/test.js Normal file
View File

@@ -0,0 +1,862 @@
// @ts-check
import DeltaChat, { Message } from '../dist'
import binding from '../binding'
import { strictEqual } from 'assert'
import chai, { expect } from 'chai'
import chaiAsPromised from 'chai-as-promised'
import { EventId2EventName, C } from '../dist/constants'
import { join } from 'path'
import { mkdtempSync, statSync } from 'fs'
import { tmpdir } from 'os'
import { Context } from '../dist/context'
chai.use(chaiAsPromised)
async function createTempUser(url) {
const fetch = require('node-fetch')
async function postData(url = '') {
// Default options are marked with *
const response = await fetch(url, {
method: 'POST', // *GET, POST, PUT, DELETE, etc.
mode: 'cors', // no-cors, *cors, same-origin
cache: 'no-cache', // *default, no-cache, reload, force-cache, only-if-cached
credentials: 'same-origin', // include, *same-origin, omit
headers: {
'cache-control': 'no-cache',
},
referrerPolicy: 'no-referrer', // no-referrer, *client
})
return response.json() // parses JSON response into native JavaScript objects
}
return await postData(url)
}
describe('static tests', function () {
it('reverse lookup of events', function () {
const eventKeys = Object.keys(EventId2EventName).map((k) => Number(k))
const eventValues = Object.values(EventId2EventName)
const reverse = eventValues.map((v) => C[v])
expect(reverse).to.be.deep.equal(eventKeys)
})
it('event constants are consistent', function () {
const eventKeys = Object.keys(C)
.filter((k) => k.startsWith('DC_EVENT_'))
.sort()
const eventValues = Object.values(EventId2EventName).sort()
expect(eventKeys).to.be.deep.equal(eventValues)
})
it('static method maybeValidAddr()', function () {
expect(DeltaChat.maybeValidAddr(null)).to.equal(false)
expect(DeltaChat.maybeValidAddr('')).to.equal(false)
expect(DeltaChat.maybeValidAddr('uuu')).to.equal(false)
expect(DeltaChat.maybeValidAddr('dd.tt')).to.equal(false)
expect(DeltaChat.maybeValidAddr('tt.dd@yggmail')).to.equal(true)
expect(DeltaChat.maybeValidAddr('u@d')).to.equal(true)
//expect(DeltaChat.maybeValidAddr('u@d.')).to.equal(false)
//expect(DeltaChat.maybeValidAddr('u@d.t')).to.equal(false)
//expect(DeltaChat.maybeValidAddr('u@.tt')).to.equal(false)
expect(DeltaChat.maybeValidAddr('@d.tt')).to.equal(false)
expect(DeltaChat.maybeValidAddr('user@domain.tld')).to.equal(true)
expect(DeltaChat.maybeValidAddr('u@d.tt')).to.equal(true)
})
it('static getSystemInfo()', function () {
const info = Context.getSystemInfo()
expect(info).to.contain.keys([
'arch',
'deltachat_core_version',
'sqlite_version',
])
})
it('static context.getProviderFromEmail("example@example.com")', function () {
const provider = DeltaChat.getProviderFromEmail('example@example.com')
expect(provider).to.deep.equal({
before_login_hint: "Hush this provider doesn't exist!",
overview_page: 'https://providers.delta.chat/example-com',
status: 3,
})
})
})
describe('Basic offline Tests', function () {
it('opens a context', async function () {
const { dc, context } = DeltaChat.newTemporary()
strictEqual(context.isConfigured(), false)
dc.close()
})
it('set config', async function () {
const { dc, context } = DeltaChat.newTemporary()
context.setConfig('bot', true)
strictEqual(context.getConfig('bot'), '1')
context.setConfig('bot', false)
strictEqual(context.getConfig('bot'), '0')
context.setConfig('bot', '1')
strictEqual(context.getConfig('bot'), '1')
context.setConfig('bot', '0')
strictEqual(context.getConfig('bot'), '0')
context.setConfig('bot', 1)
strictEqual(context.getConfig('bot'), '1')
context.setConfig('bot', 0)
strictEqual(context.getConfig('bot'), '0')
context.setConfig('bot', null)
strictEqual(context.getConfig('bot'), '')
strictEqual(context.getConfig('selfstatus'), '')
context.setConfig('selfstatus', 'hello')
strictEqual(context.getConfig('selfstatus'), 'hello')
context.setConfig('selfstatus', '')
strictEqual(context.getConfig('selfstatus'), '')
context.setConfig('selfstatus', null)
strictEqual(context.getConfig('selfstatus'), '')
dc.close()
})
it('configure with either missing addr or missing mail_pw throws', async function () {
const { dc, context } = DeltaChat.newTemporary()
dc.startEvents()
await expect(
context.configure({ addr: 'delta1@delta.localhost' })
).to.eventually.be.rejectedWith('Please enter a password.')
await expect(context.configure({ mailPw: 'delta1' })).to.eventually.be
.rejected
context.stopOngoingProcess()
dc.close()
})
it('context.getInfo()', async function () {
const { dc, context } = DeltaChat.newTemporary()
const info = await context.getInfo()
expect(typeof info).to.be.equal('object')
expect(info).to.contain.keys([
'arch',
'bcc_self',
'blobdir',
'bot',
'configured_mvbox_folder',
'configured_sentbox_folder',
'database_dir',
'database_encrypted',
'database_version',
'delete_device_after',
'delete_server_after',
'deltachat_core_version',
'display_name',
'download_limit',
'e2ee_enabled',
'entered_account_settings',
'fetch_existing_msgs',
'fingerprint',
'folders_configured',
'is_configured',
'journal_mode',
'key_gen_type',
'last_housekeeping',
'level',
'mdns_enabled',
'media_quality',
'messages_in_contact_requests',
'mvbox_move',
'num_cpus',
'number_of_chat_messages',
'number_of_chats',
'number_of_contacts',
'only_fetch_mvbox',
'private_key_count',
'public_key_count',
'quota_exceeding',
'scan_all_folders_debounce_secs',
'selfavatar',
'send_sync_msgs',
'sentbox_watch',
'show_emails',
'socks5_enabled',
'sqlite_version',
'uptime',
'used_account_settings',
'webrtc_instance',
])
dc.close()
})
})
describe('Offline Tests with unconfigured account', function () {
let [dc, context, accountId, directory] = [null, null, null, null]
this.beforeEach(async function () {
let tmp = DeltaChat.newTemporary()
dc = tmp.dc
context = tmp.context
accountId = tmp.accountId
directory = tmp.directory
dc.startEvents()
})
this.afterEach(async function () {
if (context) {
context.stopOngoingProcess()
}
if (dc) {
try {
dc.stopIO()
dc.close()
} catch (error) {
console.error(error)
}
}
dc = null
context = null
accountId = null
directory = null
})
it('invalid context.joinSecurejoin', async function () {
expect(context.joinSecurejoin('test')).to.be.eq(0)
})
it('Device Chat', async function () {
const deviceChatMessageText = 'test234'
expect((await context.getChatList(0, '', null)).getCount()).to.equal(
0,
'no device chat after setup'
)
await context.addDeviceMessage('test', deviceChatMessageText)
const chatList = await context.getChatList(0, '', null)
expect(chatList.getCount()).to.equal(
1,
'device chat after adding device msg'
)
const deviceChatId = await chatList.getChatId(0)
const deviceChat = await context.getChat(deviceChatId)
expect(deviceChat.isDeviceTalk()).to.be.true
expect(deviceChat.toJson().isDeviceTalk).to.be.true
const deviceChatMessages = await context.getChatMessages(deviceChatId, 0, 0)
expect(deviceChatMessages.length).to.be.equal(
1,
'device chat has added message'
)
const deviceChatMessage = await context.getMessage(deviceChatMessages[0])
expect(deviceChatMessage.getText()).to.equal(
deviceChatMessageText,
'device chat message has the inserted text'
)
})
it('should have e2ee enabled and right blobdir', function () {
expect(context.getConfig('e2ee_enabled')).to.equal(
'1',
'e2eeEnabled correct'
)
expect(
String(context.getBlobdir()).startsWith(directory),
'blobdir should be inside temp directory'
)
expect(
String(context.getBlobdir()).endsWith('db.sqlite-blobs'),
'blobdir end with "db.sqlite-blobs"'
)
})
it('should create chat from contact and Chat methods', async function () {
const contactId = context.createContact('aaa', 'aaa@site.org')
strictEqual(context.lookupContactIdByAddr('aaa@site.org'), contactId)
strictEqual(context.lookupContactIdByAddr('nope@site.net'), 0)
let chatId = context.createChatByContactId(contactId)
let chat = context.getChat(chatId)
strictEqual(
chat.getVisibility(),
C.DC_CHAT_VISIBILITY_NORMAL,
'not archived'
)
strictEqual(chat.getId(), chatId, 'chat id matches')
strictEqual(chat.getName(), 'aaa', 'chat name matches')
strictEqual(chat.getProfileImage(), null, 'no profile image')
strictEqual(chat.getType(), C.DC_CHAT_TYPE_SINGLE, 'single chat')
strictEqual(chat.isSelfTalk(), false, 'no self talk')
// TODO make sure this is really the case!
strictEqual(chat.isUnpromoted(), false, 'not unpromoted')
strictEqual(chat.isProtected(), false, 'not verified')
strictEqual(typeof chat.color, 'string', 'color is a string')
strictEqual(context.getDraft(chatId), null, 'no draft message')
context.setDraft(chatId, context.messageNew().setText('w00t!'))
strictEqual(
context.getDraft(chatId).toJson().text,
'w00t!',
'draft text correct'
)
context.setDraft(chatId, null)
strictEqual(context.getDraft(chatId), null, 'draft removed')
strictEqual(context.getChatIdByContactId(contactId), chatId)
expect(context.getChatContacts(chatId)).to.deep.equal([contactId])
context.setChatVisibility(chatId, C.DC_CHAT_VISIBILITY_ARCHIVED)
strictEqual(
context.getChat(chatId).getVisibility(),
C.DC_CHAT_VISIBILITY_ARCHIVED,
'chat archived'
)
context.setChatVisibility(chatId, C.DC_CHAT_VISIBILITY_NORMAL)
strictEqual(
chat.getVisibility(),
C.DC_CHAT_VISIBILITY_NORMAL,
'chat unarchived'
)
chatId = context.createGroupChat('unverified group', false)
chat = context.getChat(chatId)
strictEqual(chat.isProtected(), false, 'is not verified')
strictEqual(chat.getType(), C.DC_CHAT_TYPE_GROUP, 'group chat')
expect(context.getChatContacts(chatId)).to.deep.equal([
C.DC_CONTACT_ID_SELF,
])
const draft2 = context.getDraft(chatId)
expect(draft2 == null, 'unpromoted group has no draft by default')
context.setChatName(chatId, 'NEW NAME')
strictEqual(context.getChat(chatId).getName(), 'NEW NAME', 'name updated')
chatId = context.createGroupChat('a verified group', true)
chat = context.getChat(chatId)
strictEqual(chat.isProtected(), true, 'is verified')
})
it('test setting profile image', async function () {
const chatId = context.createGroupChat('testing profile image group', false)
const image = 'image.jpeg'
const imagePath = join(__dirname, 'fixtures', image)
const blobs = context.getBlobdir()
context.setChatProfileImage(chatId, imagePath)
const blobPath = context.getChat(chatId).getProfileImage()
expect(blobPath.startsWith(blobs)).to.be.true
expect(blobPath.endsWith(image)).to.be.true
context.setChatProfileImage(chatId, null)
expect(context.getChat(chatId).getProfileImage()).to.be.equal(
null,
'image is null'
)
})
it('test setting ephemeral timer', function () {
const chatId = context.createGroupChat('testing ephemeral timer')
strictEqual(
context.getChatEphemeralTimer(chatId),
0,
'ephemeral timer is not set by default'
)
context.setChatEphemeralTimer(chatId, 60)
strictEqual(
context.getChatEphemeralTimer(chatId),
60,
'ephemeral timer is set to 1 minute'
)
context.setChatEphemeralTimer(chatId, 0)
strictEqual(
context.getChatEphemeralTimer(chatId),
0,
'ephemeral timer is reset'
)
})
it('should create and delete chat', function () {
const chatId = context.createGroupChat('GROUPCHAT')
const chat = context.getChat(chatId)
strictEqual(chat.getId(), chatId, 'correct chatId')
context.deleteChat(chat.getId())
strictEqual(context.getChat(chatId), null, 'chat removed')
})
it('new message and Message methods', function () {
const text = 'w00t!'
const msg = context.messageNew().setText(text)
strictEqual(msg.getChatId(), 0, 'chat id 0 before sent')
strictEqual(msg.getDuration(), 0, 'duration 0 before sent')
strictEqual(msg.getFile(), '', 'no file set by default')
strictEqual(msg.getFilebytes(), 0, 'and file bytes is 0')
strictEqual(msg.getFilemime(), '', 'no filemime by default')
strictEqual(msg.getFilename(), '', 'no filename set by default')
strictEqual(msg.getFromId(), 0, 'no contact id set by default')
strictEqual(msg.getHeight(), 0, 'plain text message have height 0')
strictEqual(msg.getId(), 0, 'id 0 before sent')
strictEqual(msg.getSetupcodebegin(), '', 'no setupcode begin')
strictEqual(msg.getShowpadlock(), false, 'no padlock by default')
const state = msg.getState()
strictEqual(state.isUndefined(), true, 'no state by default')
strictEqual(state.isFresh(), false, 'no state by default')
strictEqual(state.isNoticed(), false, 'no state by default')
strictEqual(state.isSeen(), false, 'no state by default')
strictEqual(state.isPending(), false, 'no state by default')
strictEqual(state.isFailed(), false, 'no state by default')
strictEqual(state.isDelivered(), false, 'no state by default')
strictEqual(state.isReceived(), false, 'no state by default')
const summary = msg.getSummary()
strictEqual(summary.getId(), 0, 'no summary id')
strictEqual(summary.getState(), 0, 'no summary state')
strictEqual(summary.getText1(), null, 'no summary text1')
strictEqual(summary.getText1Meaning(), 0, 'no summary text1 meaning')
strictEqual(summary.getText2(), '', 'no summary text2')
strictEqual(summary.getTimestamp(), 0, 'no summary timestamp')
//strictEqual(msg.getSummarytext(50), text, 'summary text is text')
strictEqual(msg.getText(), text, 'msg text set correctly')
strictEqual(msg.getTimestamp(), 0, 'no timestamp')
const viewType = msg.getViewType()
strictEqual(viewType.isText(), true)
strictEqual(viewType.isImage(), false)
strictEqual(viewType.isGif(), false)
strictEqual(viewType.isAudio(), false)
strictEqual(viewType.isVoice(), false)
strictEqual(viewType.isVideo(), false)
strictEqual(viewType.isFile(), false)
strictEqual(msg.getWidth(), 0, 'no message width')
strictEqual(msg.isDeadDrop(), false, 'not deaddrop')
strictEqual(msg.isForwarded(), false, 'not forwarded')
strictEqual(msg.isIncreation(), false, 'not in creation')
strictEqual(msg.isInfo(), false, 'not an info message')
strictEqual(msg.isSent(), false, 'messge is not sent')
strictEqual(msg.isSetupmessage(), false, 'not an autocrypt setup message')
msg.latefilingMediasize(10, 20, 30)
strictEqual(msg.getWidth(), 10, 'message width set correctly')
strictEqual(msg.getHeight(), 20, 'message height set correctly')
strictEqual(msg.getDuration(), 30, 'message duration set correctly')
msg.setDimension(100, 200)
strictEqual(msg.getWidth(), 100, 'message width set correctly')
strictEqual(msg.getHeight(), 200, 'message height set correctly')
msg.setDuration(314)
strictEqual(msg.getDuration(), 314, 'message duration set correctly')
expect(() => {
msg.setFile(null)
}).to.throw('Missing filename')
const logo = join(__dirname, 'fixtures', 'logo.png')
const stat = statSync(logo)
msg.setFile(logo)
strictEqual(msg.getFilebytes(), stat.size, 'correct file size')
strictEqual(msg.getFile(), logo, 'correct file name')
strictEqual(msg.getFilemime(), 'image/png', 'mime set implicitly')
msg.setFile(logo, 'image/gif')
strictEqual(msg.getFilemime(), 'image/gif', 'mime set (in)correctly')
msg.setFile(logo, 'image/png')
strictEqual(msg.getFilemime(), 'image/png', 'mime set correctly')
const json = msg.toJson()
expect(json).to.not.equal(null, 'not null')
strictEqual(typeof json, 'object', 'json object')
})
it('Contact methods', function () {
const contactId = context.createContact('First Last', 'first.last@site.org')
const contact = context.getContact(contactId)
strictEqual(contact.getAddress(), 'first.last@site.org', 'correct address')
strictEqual(typeof contact.color, 'string', 'color is a string')
strictEqual(contact.getDisplayName(), 'First Last', 'correct display name')
strictEqual(contact.getId(), contactId, 'contact id matches')
strictEqual(contact.getName(), 'First Last', 'correct name')
strictEqual(contact.getNameAndAddress(), 'First Last (first.last@site.org)')
strictEqual(contact.getProfileImage(), null, 'no contact image')
strictEqual(contact.isBlocked(), false, 'not blocked')
strictEqual(contact.isVerified(), false, 'unverified status')
strictEqual(contact.lastSeen, 0, 'last seen unknown')
})
it('create contacts from address book', function () {
const addresses = [
'Name One',
'name1@site.org',
'Name Two',
'name2@site.org',
'Name Three',
'name3@site.org',
]
const count = context.addAddressBook(addresses.join('\n'))
strictEqual(count, addresses.length / 2)
context
.getContacts(0, 'Name ')
.map((id) => context.getContact(id))
.forEach((contact) => {
expect(contact.getName().startsWith('Name ')).to.be.true
})
})
it('delete contacts', function () {
const id = context.createContact('someuser', 'someuser@site.com')
const contact = context.getContact(id)
strictEqual(contact.getId(), id, 'contact id matches')
strictEqual(context.deleteContact(id), true, 'delete call succesful')
strictEqual(context.getContact(id), null, 'contact is gone')
})
it('adding and removing a contact from a chat', function () {
const chatId = context.createGroupChat('adding_and_removing')
const contactId = context.createContact('Add Remove', 'add.remove@site.com')
strictEqual(
context.addContactToChat(chatId, contactId),
true,
'contact added'
)
strictEqual(
context.isContactInChat(chatId, contactId),
true,
'contact in chat'
)
strictEqual(
context.removeContactFromChat(chatId, contactId),
true,
'contact removed'
)
strictEqual(
context.isContactInChat(chatId, contactId),
false,
'contact not in chat'
)
})
it('blocking contacts', function () {
const id = context.createContact('badcontact', 'bad@site.com')
strictEqual(context.getBlockedCount(), 0)
strictEqual(context.getContact(id).isBlocked(), false)
expect(context.getBlockedContacts()).to.be.empty
context.blockContact(id, true)
strictEqual(context.getBlockedCount(), 1)
strictEqual(context.getContact(id).isBlocked(), true)
expect(context.getBlockedContacts()).to.deep.equal([id])
context.blockContact(id, false)
strictEqual(context.getBlockedCount(), 0)
strictEqual(context.getContact(id).isBlocked(), false)
expect(context.getBlockedContacts()).to.be.empty
})
it('ChatList methods', function () {
const ids = [
context.createGroupChat('groupchat1'),
context.createGroupChat('groupchat11'),
context.createGroupChat('groupchat111'),
]
let chatList = context.getChatList(0, 'groupchat1', null)
strictEqual(chatList.getCount(), 3, 'should contain above chats')
expect(ids.indexOf(chatList.getChatId(0))).not.to.equal(-1)
expect(ids.indexOf(chatList.getChatId(1))).not.to.equal(-1)
expect(ids.indexOf(chatList.getChatId(2))).not.to.equal(-1)
const lot = chatList.getSummary(0)
strictEqual(lot.getId(), 0, 'lot has no id')
strictEqual(lot.getState(), C.DC_STATE_UNDEFINED, 'correct state')
const text = 'No messages.'
context.createGroupChat('groupchat1111')
chatList = context.getChatList(0, 'groupchat1111', null)
strictEqual(
chatList.getSummary(0).getText2(),
text,
'custom new group message'
)
context.setChatVisibility(ids[0], C.DC_CHAT_VISIBILITY_ARCHIVED)
chatList = context.getChatList(C.DC_GCL_ARCHIVED_ONLY, 'groupchat1', null)
strictEqual(chatList.getCount(), 1, 'only one archived')
})
it('Remove qoute from (draft) message', function () {
context.addDeviceMessage('test_qoute', 'test')
const msgId = context.getChatMessages(10, 0, 0)[0]
const msg = context.messageNew()
msg.setQuote(context.getMessage(msgId))
expect(msg.getQuotedMessage()).to.not.be.null
msg.setQuote(null)
expect(msg.getQuotedMessage()).to.be.null
})
})
describe('Integration tests', function () {
this.timeout(60 * 3000) // increase timeout to 1min
let [dc, context, accountId, directory, account] = [
null,
null,
null,
null,
null,
]
let [dc2, context2, accountId2, directory2, account2] = [
null,
null,
null,
null,
null,
]
this.beforeEach(async function () {
let tmp = DeltaChat.newTemporary()
dc = tmp.dc
context = tmp.context
accountId = tmp.accountId
directory = tmp.directory
dc.startEvents()
})
this.afterEach(async function () {
if (context) {
try {
context.stopOngoingProcess()
} catch (error) {
console.error(error)
}
}
if (context2) {
try {
context2.stopOngoingProcess()
} catch (error) {
console.error(error)
}
}
if (dc) {
try {
dc.stopIO()
dc.close()
} catch (error) {
console.error(error)
}
}
dc = null
context = null
accountId = null
directory = null
context2 = null
accountId2 = null
directory2 = null
})
this.beforeAll(async function () {
if (!process.env.DCC_NEW_TMP_EMAIL) {
console.log(
'Missing DCC_NEW_TMP_EMAIL environment variable!, skip intergration tests'
)
this.skip()
}
account = await createTempUser(process.env.DCC_NEW_TMP_EMAIL)
if (!account || !account.email || !account.password) {
console.log(
"We didn't got back an account from the api, skip intergration tests"
)
this.skip()
}
})
it('configure', async function () {
strictEqual(context.isConfigured(), false, 'should not be configured')
// Not sure what's the best way to check the events
// TODO: check the events
// dc.once('DC_EVENT_CONFIGURE_PROGRESS', (data) => {
// t.pass('DC_EVENT_CONFIGURE_PROGRESS called at least once')
// })
// dc.on('DC_EVENT_ERROR', (error) => {
// console.error('DC_EVENT_ERROR', error)
// })
// dc.on('DC_EVENT_ERROR_NETWORK', (first, error) => {
// console.error('DC_EVENT_ERROR_NETWORK', error)
// })
// dc.on('ALL', (event, data1, data2) => console.log('ALL', event, data1, data2))
await expect(
context.configure({
addr: account.email,
mail_pw: account.password,
displayname: 'Delta One',
selfstatus: 'From Delta One with <3',
selfavatar: join(__dirname, 'fixtures', 'avatar.png'),
})
).to.be.eventually.fulfilled
strictEqual(context.getConfig('addr'), account.email, 'addr correct')
strictEqual(
context.getConfig('displayname'),
'Delta One',
'displayName correct'
)
strictEqual(
context.getConfig('selfstatus'),
'From Delta One with <3',
'selfStatus correct'
)
expect(
context.getConfig('selfavatar').endsWith('avatar.png'),
'selfavatar correct'
)
strictEqual(context.getConfig('e2ee_enabled'), '1', 'e2ee_enabled correct')
strictEqual(
context.getConfig('save_mime_headers'),
'',
'save_mime_headers correct'
)
expect(context.getBlobdir().endsWith('db.sqlite-blobs'), 'correct blobdir')
strictEqual(context.isConfigured(), true, 'is configured')
// whole re-configure to only change displayname: what the heck? (copied this from the old test)
await expect(
context.configure({
addr: account.email,
mail_pw: account.password,
displayname: 'Delta Two',
selfstatus: 'From Delta One with <3',
selfavatar: join(__dirname, 'fixtures', 'avatar.png'),
})
).to.be.eventually.fulfilled
strictEqual(
context.getConfig('displayname'),
'Delta Two',
'updated displayName correct'
)
})
it('Autocrypt setup - key transfer', async function () {
// Spawn a second dc instance with same account
// dc.on('ALL', (event, data1, data2) =>
// console.log('FIRST ', event, data1, data2)
// )
dc.stopIO()
await expect(
context.configure({
addr: account.email,
mail_pw: account.password,
displayname: 'Delta One',
selfstatus: 'From Delta One with <3',
selfavatar: join(__dirname, 'fixtures', 'avatar.png'),
})
).to.be.eventually.fulfilled
const accountId2 = dc.addAccount()
console.log('accountId2:', accountId2)
context2 = dc.accountContext(accountId2)
let setupCode = null
const waitForSetupCode = waitForSomething()
const waitForEnd = waitForSomething()
dc.on('ALL', (event, accountId, data1, data2) => {
console.log('[' + accountId + ']', event, data1, data2)
})
dc.on('DC_EVENT_MSGS_CHANGED', async (aId, chatId, msgId) => {
console.log('[' + accountId + '] DC_EVENT_MSGS_CHANGED', chatId, msgId)
if (
aId != accountId ||
!context.getChat(chatId).isSelfTalk() ||
!context.getMessage(msgId).isSetupmessage()
) {
return
}
console.log('Setupcode!')
let setupCode = await waitForSetupCode.promise
// console.log('incoming msg', { setupCode })
const messages = context.getChatMessages(chatId, 0, 0)
expect(messages.indexOf(msgId) !== -1, 'msgId is in chat messages').to.be
.true
const result = await context.continueKeyTransfer(msgId, setupCode)
expect(result === true, 'continueKeyTransfer was successful').to.be.true
waitForEnd.done()
})
dc.stopIO()
await expect(
context2.configure({
addr: account.email,
mail_pw: account.password,
displayname: 'Delta One',
selfstatus: 'From Delta One with <3',
selfavatar: join(__dirname, 'fixtures', 'avatar.png'),
})
).to.be.eventually.fulfilled
dc.startIO()
console.log('Sending autocrypt setup code')
setupCode = await context2.initiateKeyTransfer()
console.log('Sent autocrypt setup code')
waitForSetupCode.done(setupCode)
console.log('setupCode is: ' + setupCode)
expect(typeof setupCode).to.equal('string', 'setupCode is string')
await waitForEnd.promise
})
it('configure using invalid password should fail', async function () {
await expect(
context.configure({
addr: 'hpk5@testrun.org',
mail_pw: 'asd',
})
).to.be.eventually.rejected
})
})
/**
* @returns {{done: (result?)=>void, promise:Promise<any> }}
*/
function waitForSomething() {
let resolvePromise
const promise = new Promise((res, rej) => {
resolvePromise = res
})
return {
done: resolvePromise,
promise,
}
}

22
node/tsconfig.json Normal file
View File

@@ -0,0 +1,22 @@
{
"compilerOptions": {
"outDir": "dist",
"rootDir": "./lib",
"sourceMap": true,
"module": "commonjs",
"target": "es5",
"esModuleInterop": true,
"declaration": true,
"declarationMap": true,
"strictNullChecks": true,
"strict": true
},
"exclude": ["node_modules", "deltachat-core-rust", "dist", "scripts"],
"typedocOptions": {
"mode": "file",
"out": "docs",
"excludeNotExported": true,
"defaultCategory": "index",
"includeVersion": true
}
}

37
node/windows.md Normal file
View File

@@ -0,0 +1,37 @@
> Steps on how to get windows set up properly for the node bindings
## install git
E.g via <https://git-scm.com/download/win>
## install node
Download and install `v16` from <https://nodejs.org/en/>
## install rust
Download and run `rust-init.exe` from <https://www.rust-lang.org/tools/install>
## configure node for native addons
```
$ npm i node-gyp -g
$ npm i windows-build-tools -g
```
`windows-build-tools` will install `Visual Studio 2017` by default and should not mess with existing installations of `Visual Studio C++`.
## get the code
```
$ mkdir -p src/deltachat
$ cd src/deltachat
$ git clone https://github.com/deltachat/deltachat-node
```
## build the code
```
$ cd src/deltachat/deltachat-node
$ npm install
```

65
package.json Normal file
View File

@@ -0,0 +1,65 @@
{
"dependencies": {
"debug": "^4.1.1",
"napi-macros": "^2.0.0",
"node-gyp-build": "^4.1.0"
},
"description": "node.js bindings for deltachat-core",
"devDependencies": {
"@types/debug": "^4.1.7",
"@types/node": "^16.11.26",
"chai": "^4.2.0",
"chai-as-promised": "^7.1.1",
"esm": "^3.2.25",
"hallmark": "^2.0.0",
"mocha": "^8.2.1",
"node-fetch": "^2.6.7",
"node-gyp": "^9.0.0",
"opn-cli": "^5.0.0",
"prebuildify": "^3.0.0",
"prebuildify-ci": "^1.0.4",
"prettier": "^2.0.5",
"split2": "^4.1.0",
"typedoc": "^0.17.0",
"typescript": "^3.9.10"
},
"engines": {
"node": ">=16.0.0"
},
"files": [
"node/scripts/*",
"*"
],
"homepage": "https://github.com/deltachat/deltachat-core-rust/tree/master/node",
"license": "GPL-3.0-or-later",
"main": "node/dist/index.js",
"name": "deltachat-node",
"repository": {
"type": "git",
"url": "https://github.com/deltachat/deltachat-core-rust.git"
},
"scripts": {
"build": "npm run build:core && npm run build:bindings",
"build:bindings": "npm run build:bindings:c && npm run build:bindings:ts",
"build:bindings:c": "npm run build:bindings:c:c && npm run build:bindings:c:postinstall",
"build:bindings:c:c": "cd node && node-gyp rebuild",
"build:bindings:c:postinstall": "node node/scripts/postinstall.js",
"build:bindings:ts": "cd node && tsc",
"build:core": "npm run build:core:rust && npm run build:core:constants",
"build:core:constants": "node node/scripts/generate-constants.js",
"build:core:rust": "node node/scripts/rebuild-core.js",
"clean": "rm -rf node/dist node/build node/prebuilds node/node_modules ./target",
"download-prebuilds": "prebuildify-ci download",
"hallmark": "hallmark --fix",
"install": "node node/scripts/install.js",
"install:prebuilds": "cd node && node-gyp-build \"npm run build:core\" \"npm run build:bindings:c:postinstall\"",
"lint": "prettier --check \"node/lib/**/*.{ts,tsx}\"",
"lint-fix": "prettier --write \"node/lib/**/*.{ts,tsx}\" \"node/test/**/*.js\"",
"prebuildify": "cd node && prebuildify -t 16.13.0 --napi --strip --postinstall \"node scripts/postinstall.js --prebuild\"",
"test": "npm run test:lint && npm run test:mocha",
"test:lint": "npm run lint",
"test:mocha": "mocha -r esm node/test/test.js --growl --reporter=spec"
},
"types": "node/dist/index.d.ts",
"version": "1.86.0"
}

View File

@@ -7,3 +7,5 @@
cc c310754465ee0261807b96fa9bcc4861ff9aa286e94667524b5960c69f9b6620 # shrinks to buf = "", approx_chars = 0, do_unwrap = false
cc 5fd8d730b0a9cdf7308ce58818ca9aefc0255c9ba2a0878944fc48d43a67315b # shrinks to buf = "𑒀ὐ¢🜀\u{1e01b}A a🟠", approx_chars = 0, do_unwrap = false
cc c6a0029a54137a4b9efc9ef2ea6d9a7dd1d60d1c937bb472b66a174618ba8013 # shrinks to buf = "𐠈0Aᝮa𫝀®!ꫛa¡0A𐢧00𐹠®A 丽ⷐએ ", approx_chars = 0, do_unwrap = false
cc 9796807baeda701227dcdcfc9fdaa93ddd556da2bb1630381bfe2e037bee73f6 # shrinks to buf = " ꫛ®a\u{11300}a", approx_chars = 0
cc 063a4c42ac1ec9aa37af54521b210ba9cd82dcc9cc3be296ca2fedf8240072d4 # shrinks to buf = "a᪠ 0A", approx_chars = 0

View File

@@ -58,12 +58,13 @@ end-to-end tests that require accounts on real e-mail servers.
running "live" tests with temporary accounts
---------------------------------------------
If you want to run live functional tests you can set ``DCC_NEW_TMP_EMAIL``::
If you want to run live functional tests you can set ``DCC_NEW_TMP_EMAIL`` to a URL that creates e-mail accounts. Most developers use https://testrun.org URLS created and managed by [mailadm](https://mailadm.readthedocs.io/en/latest/).
export DCC_NEW_TMP_EMAIL=https://testrun.org/new_email?t=1h_4w4r8h7y9nmcdsy
Please feel free to contact us through a github issue or by e-mail and we'll send you a URL that you can then use for functional tests like this:
With this, pytest runs create ephemeral e-mail accounts on the http://testrun.org server.
These accounts exists for one 1hour and then are removed completely.
export DCC_NEW_TMP_EMAIL=<URL you got from us>
With this account-creation setting, pytest runs create ephemeral e-mail accounts on the http://testrun.org server. These accounts exists only for one hour and then are removed completely.
One hour is enough to invoke pytest and run all offline and online tests:
pytest

View File

@@ -1,4 +1,3 @@
# content of echo_and_quit.py
from deltachat import account_hookimpl, run_cmdline

View File

@@ -1,4 +1,3 @@
# content of group_tracking.py
from deltachat import account_hookimpl, run_cmdline
@@ -33,15 +32,21 @@ class GroupTrackingPlugin:
@account_hookimpl
def ac_member_added(self, chat, contact, actor, message):
print("ac_member_added {} to chat {} from {}".format(
contact.addr, chat.id, actor or message.get_sender_contact().addr))
print(
"ac_member_added {} to chat {} from {}".format(
contact.addr, chat.id, actor or message.get_sender_contact().addr
)
)
for member in chat.get_contacts():
print("chat member: {}".format(member.addr))
@account_hookimpl
def ac_member_removed(self, chat, contact, actor, message):
print("ac_member_removed {} from chat {} by {}".format(
contact.addr, chat.id, actor or message.get_sender_contact().addr))
print(
"ac_member_removed {} from chat {} by {}".format(
contact.addr, chat.id, actor or message.get_sender_contact().addr
)
)
def main(argv=None):

View File

@@ -1,20 +1,20 @@
import pytest
import py
import echo_and_quit
import group_tracking
import py
import pytest
from deltachat.events import FFIEventLogger
@pytest.fixture(scope='session')
@pytest.fixture(scope="session")
def datadir():
"""The py.path.local object of the test-data/ directory."""
for path in reversed(py.path.local(__file__).parts()):
datadir = path.join('test-data')
datadir = path.join("test-data")
if datadir.isdir():
return datadir
else:
pytest.skip('test-data directory not found')
pytest.skip("test-data directory not found")
def test_echo_quit_plugin(acfactory, lp):
@@ -22,7 +22,7 @@ def test_echo_quit_plugin(acfactory, lp):
botproc = acfactory.run_bot_process(echo_and_quit)
lp.sec("creating a temp account to contact the bot")
ac1 = acfactory.get_one_online_account()
(ac1,) = acfactory.get_online_accounts(1)
lp.sec("sending a message to the bot")
bot_contact = ac1.create_contact(botproc.addr)
@@ -42,11 +42,13 @@ def test_group_tracking_plugin(acfactory, lp):
lp.sec("creating one group-tracking bot and two temp accounts")
botproc = acfactory.run_bot_process(group_tracking, ffi=False)
ac1, ac2 = acfactory.get_two_online_accounts(quiet=True)
ac1, ac2 = acfactory.get_online_accounts(2)
botproc.fnmatch_lines("""
botproc.fnmatch_lines(
"""
*ac_configure_completed*
""")
"""
)
ac1.add_account_plugin(FFIEventLogger(ac1))
ac2.add_account_plugin(FFIEventLogger(ac2))
@@ -56,9 +58,11 @@ def test_group_tracking_plugin(acfactory, lp):
ch.add_contact(bot_contact)
ch.send_text("hello")
botproc.fnmatch_lines("""
botproc.fnmatch_lines(
"""
*ac_chat_modified*bot test group*
""")
"""
)
lp.sec("adding third member {}".format(ac2.get_config("addr")))
contact3 = ac1.create_contact(ac2.get_config("addr"))
@@ -68,12 +72,20 @@ def test_group_tracking_plugin(acfactory, lp):
assert "hello" in reply.text
lp.sec("now looking at what the bot received")
botproc.fnmatch_lines("""
botproc.fnmatch_lines(
"""
*ac_member_added {}*from*{}*
""".format(contact3.addr, ac1.get_config("addr")))
""".format(
contact3.addr, ac1.get_config("addr")
)
)
lp.sec("contact successfully added, now removing")
ch.remove_contact(contact3)
botproc.fnmatch_lines("""
botproc.fnmatch_lines(
"""
*ac_member_removed {}*from*{}*
""".format(contact3.addr, ac1.get_config("addr")))
""".format(
contact3.addr, ac1.get_config("addr")
)
)

View File

@@ -24,7 +24,7 @@ if __name__ == "__main__":
print("running:", " ".join(cmd))
subprocess.check_call(cmd)
subprocess.check_call("rm -rf build/ src/deltachat/*.so" , shell=True)
subprocess.check_call("rm -rf build/ src/deltachat/*.so src/deltachat/*.dylib src/deltachat/*.dll" , shell=True)
if len(sys.argv) <= 1 or sys.argv[1] != "onlybuild":
subprocess.check_call([

26
python/mypy.ini Normal file
View File

@@ -0,0 +1,26 @@
[mypy]
[mypy-py.*]
ignore_missing_imports = True
[mypy-deltachat.capi.*]
ignore_missing_imports = True
[mypy-pluggy.*]
ignore_missing_imports = True
[mypy-cffi.*]
ignore_missing_imports = True
[mypy-imapclient.*]
ignore_missing_imports = True
[mypy-pytest.*]
ignore_missing_imports = True
[mypy-_pytest.*]
ignore_missing_imports = True
[mypy-imap_tools.*]
ignore_missing_imports = True

11
python/pyproject.toml Normal file
View File

@@ -0,0 +1,11 @@
[build-system]
requires = ["setuptools>=45", "wheel", "setuptools_scm>=6.2", "cffi>=1.0.0", "pkgconfig"]
build-backend = "setuptools.build_meta"
[tool.setuptools_scm]
root = ".."
tag_regex = '^(?P<prefix>py-)?(?P<version>[^\+]+)(?P<suffix>.*)?$'
git_describe_command = "git describe --dirty --tags --long --match py-*.*"
[tool.black]
line-length = 120

View File

@@ -8,17 +8,14 @@ def main():
long_description = f.read()
setuptools.setup(
name='deltachat',
setup_requires=['setuptools_scm', 'cffi>=1.0.0'],
use_scm_version = {
"root": "..",
"relative_to": __file__,
'tag_regex': r'^(?P<prefix>py-)?(?P<version>[^\+]+)(?P<suffix>.*)?$',
'git_describe_command': "git describe --dirty --tags --long --match py-*.*",
},
description='Python bindings for the Delta Chat Core library using CFFI against the Rust-implemented libdeltachat',
long_description=long_description,
author='holger krekel, Floris Bruynooghe, Bjoern Petersen and contributors',
install_requires=['cffi>=1.0.0', 'pluggy', 'imapclient'],
install_requires=['cffi>=1.0.0', 'pluggy', 'imap-tools', 'requests'],
setup_requires=[
'setuptools_scm', # required for compatibility with `python3 setup.py sdist`
'pkgconfig',
],
packages=setuptools.find_packages('src'),
package_dir={'': 'src'},
cffi_modules=['src/deltachat/_build.py:ffibuilder'],

View File

@@ -1,15 +1,15 @@
import sys
from . import capi, const, hookspec # noqa
from .capi import ffi # noqa
from .account import Account # noqa
from .message import Message # noqa
from .contact import Contact # noqa
from .chat import Chat # noqa
from .hookspec import account_hookimpl, global_hookimpl # noqa
from . import events
from pkg_resources import DistributionNotFound, get_distribution
from . import capi, const, events, hookspec # noqa
from .account import Account, get_core_info # noqa
from .capi import ffi # noqa
from .chat import Chat # noqa
from .contact import Contact # noqa
from .hookspec import account_hookimpl, global_hookimpl # noqa
from .message import Message # noqa
from pkg_resources import get_distribution, DistributionNotFound
try:
__version__ = get_distribution(__name__).version
except DistributionNotFound:
@@ -19,14 +19,14 @@ except DistributionNotFound:
def get_dc_event_name(integer, _DC_EVENTNAME_MAP={}):
if not _DC_EVENTNAME_MAP:
for name, val in vars(const).items():
for name in dir(const):
if name.startswith("DC_EVENT_"):
_DC_EVENTNAME_MAP[val] = name
_DC_EVENTNAME_MAP[getattr(const, name)] = name
return _DC_EVENTNAME_MAP[integer]
def register_global_plugin(plugin):
""" Register a global plugin which implements one or more
"""Register a global plugin which implements one or more
of the :class:`deltachat.hookspec.Global` hooks.
"""
gm = hookspec.Global._get_plugin_manager()
@@ -43,9 +43,10 @@ register_global_plugin(events)
def run_cmdline(argv=None, account_plugins=None):
""" Run a simple default command line app, registering the specified
account plugins. """
"""Run a simple default command line app, registering the specified
account plugins."""
import argparse
if argv is None:
argv = sys.argv
@@ -69,13 +70,12 @@ def run_cmdline(argv=None, account_plugins=None):
ac.add_account_plugin(plugin)
if not ac.is_configured():
assert args.email and args.password, (
"you must specify --email and --password once to configure this database/account"
)
assert (
args.email and args.password
), "you must specify --email and --password once to configure this database/account"
ac.set_config("addr", args.email)
ac.set_config("mail_pw", args.password)
ac.set_config("mvbox_move", "0")
ac.set_config("mvbox_watch", "0")
ac.set_config("sentbox_watch", "0")
ac.set_config("bot", "1")
configtracker = ac.configure()

Some files were not shown because too many files have changed in this diff Show More