Commit Graph
100 Commits
Author SHA1 Message Date
Floris Bruynooghe 73b90eee3e improve docs 2023-02-20 13:10:29 +01:00
Floris Bruynooghe 4637a28bf6 doc comment 2023-02-20 13:08:43 +01:00
Floris Bruynooghe d0638c1542 typo 2023-02-20 13:05:11 +01:00
Floris Bruynooghe 788d3125a3 Do not save svg to file, just print qr text 2023-02-20 13:02:16 +01:00
Floris Bruynooghe 3c4ffc3550 Some fixes 2023-02-20 12:58:23 +01:00
Floris Bruynooghe ada858f439 Improve comments, mostly ffi. and some renames 2023-02-20 12:48:43 +01:00
Floris Bruynooghe f2570945c6 Don't reimplement qr::format_backup 2023-02-16 18:18:18 +01:00
Floris Bruynooghe 8072f78058 Do not emit ImexEvent From BlobDirIter
We no longer need that in the transfer case, that would give very
weird results.  This also means there is nothing imex-specific about
this anymore so move it to blobs.rs
2023-02-16 18:05:09 +01:00
Floris Bruynooghe 8ae0ee5a67 Merge branch 'master' into flub/send-backup 2023-02-16 17:19:31 +01:00
Floris Bruynooghe a75d2b1c80 Create a blocking call for jsonrpc 2023-02-16 17:15:54 +01:00
Floris Bruynooghe c48c2af7a1 Allow retrieval of backup QR on context
This enables being able to get the QR code without needing to have
access to the BackupProvider itself.  This is useful for the JSON-RPC
server.
2023-02-16 16:49:20 +01:00
Floris Bruynooghe 490a14c5ef Remove the need for a directory for db export
Plus on import use the context directory.  We can actually write there
just fine.
2023-02-16 16:06:41 +01:00
Floris Bruynooghe dcce6ef50b Some docs 2023-02-16 15:19:44 +01:00
Floris Bruynooghe 7cf0820d2b diff 2023-02-16 14:56:18 +01:00
Floris Bruynooghe 0bae3caaff dear CI masters: i regret every trying to be clever 2023-02-16 14:55:24 +01:00
Floris Bruynooghe bca0b256c9 goodness ci? 2023-02-16 14:52:05 +01:00
Floris Bruynooghe a53d30c459 fixed another bug, try main again 2023-02-16 14:49:48 +01:00
Floris Bruynooghe 7a9f497aa7 why can't i see this action now? 2023-02-16 14:49:04 +01:00
Floris Bruynooghe f9f9bc3efb yaml 2023-02-16 09:10:47 +01:00
Floris Bruynooghe 904990bf91 ugh, yaml syntax 2023-02-16 09:08:14 +01:00
Floris Bruynooghe b2266ffca1 make the have a valid on spec at least so gh doesn't complain too much 2023-02-16 09:06:40 +01:00
Floris Bruynooghe bb9a3d4b8e more bug hunting: disable most ci, point to branch 2023-02-16 09:00:27 +01:00
Floris Bruynooghe e565e19b42 fix msrv in sendme 2023-02-15 16:01:39 +01:00
Floris Bruynooghe 41319c85c7 patch in previous revision of sendme
main broke rust 1.63 support :'(
2023-02-15 15:12:14 +01:00
Floris Bruynooghe daf56804a5 use correct branch 2023-02-15 14:57:26 +01:00
Floris Bruynooghe 6f7a43804d Add changelog 2023-02-15 14:48:17 +01:00
Floris Bruynooghe 0ca76d36ef Merge branch 'master' into flub/send-backup 2023-02-15 14:46:57 +01:00
Floris Bruynooghe ec5789997a back to master 2023-02-15 14:45:52 +01:00
Floris Bruynooghe 7a0d61bbb0 hey 2023-02-15 13:50:39 +01:00
Floris Bruynooghe 1c2461974d better way 2023-02-14 18:29:15 +01:00
Floris Bruynooghe 2a754744fe char, not chat 2023-02-14 18:03:39 +01:00
Floris Bruynooghe b413593c43 hi 2023-02-14 17:39:58 +01:00
Floris Bruynooghe c73edd7e21 oh 2023-02-14 17:20:25 +01:00
Floris Bruynooghe a34a69d8e4 yes, ci fun 2023-02-14 17:15:52 +01:00
Floris Bruynooghe 020a9d33f6 new sendme for lower msrv 2023-02-14 15:49:21 +01:00
Floris Bruynooghe 19f6f89312 no let else :( 2023-02-14 13:29:55 +01:00
Floris Bruynooghe d56e05a11a fixup doc links 2023-02-14 13:27:15 +01:00
Floris Bruynooghe c379a4e5a7 use ProgressEmitter from sendme 2023-02-14 13:19:43 +01:00
Floris Bruynooghe 44c1efe4e4 Add jsonrpc support 2023-02-14 13:05:54 +01:00
Floris Bruynooghe ff0d675082 Make getting backup use the ongoing process 2023-02-14 12:19:40 +01:00
Floris Bruynooghe e1087b4145 translate the string for qr code 2023-02-14 12:07:02 +01:00
Floris Bruynooghe 323535584b implement ffi and use public sendme 2023-02-13 18:25:12 +01:00
Floris Bruynooghe 852adbe514 bits left over from master merge 2023-02-13 15:45:38 +01:00
Floris Bruynooghe 4c78553d90 Merge branch 'master' into flub/send-backup 2023-02-13 11:25:51 +01:00
Floris Bruynooghe a31ae5297a Add to repl example 2023-02-10 18:35:47 +01:00
Floris Bruynooghe e7792a0c65 clippy 2023-02-10 18:27:03 +01:00
Floris Bruynooghe 3c32de1859 Generate a QR code 2023-02-10 18:16:01 +01:00
Floris Bruynooghe 6a3fe3db92 fixup doc comments 2023-02-10 14:15:39 +01:00
Floris Bruynooghe ac048c154d Add progress for provider
Fix progress for getter.  Maths.  It's hard.

Add test for progress.
2023-02-10 13:54:50 +01:00
Floris Bruynooghe 3f51a8ffc2 Some more doc comments 2023-02-10 10:48:10 +01:00
Floris Bruynooghe 2129b2b7a0 Add a ton of code for receiver-side progress 2023-02-09 18:09:16 +01:00
Floris Bruynooghe 3734fc25a7 update callback to take collection by ref 2023-02-09 10:02:18 +01:00
Floris Bruynooghe 05ddc13054 Use name prefixes so the db can not be spoofed by a blob 2023-02-07 18:21:46 +01:00
Floris Bruynooghe 716504b833 do not pull in sendme cli deps 2023-02-07 17:20:35 +01:00
Floris Bruynooghe 187861c3b2 Make stuff work. With test! 2023-02-07 17:18:34 +01:00
Floris Bruynooghe 0b075ac762 Stop after a transfer happened. 2023-02-06 14:58:08 +01:00
Floris Bruynooghe a6c889ed5e Clean up files on errors 2023-02-02 18:11:12 +01:00
Floris Bruynooghe ca1533b0e4 delete device messages 2023-02-02 17:47:41 +01:00
Floris Bruynooghe 3267596a30 handle the database 2023-02-02 17:43:12 +01:00
Floris Bruynooghe 5f29b93970 Start of get support and create new module. 2023-02-02 17:15:23 +01:00
Floris Bruynooghe 2a6a21c33a handle the ongoing process correctly 2023-02-01 17:53:23 +01:00
Floris Bruynooghe 059af398eb Allow decoding the QR code 2023-02-01 17:06:07 +01:00
Floris Bruynooghe 6044e5961b Send and receive backup over network using QR code
This adds functionality to send and receive a backup over the network
using a QR code.

The sender or provider prepares the backup, sets up a server that
waits for clients.  It provides a ticket in the form of a QR code
which contains connection and authentication information.

The receiver uses the QR code to connect to the provider and fetches
backup, restoring it locally.
2023-02-01 16:45:09 +01:00
Floris Bruynooghe 76893df5bd Remove the nightly PGP feature
This was to test pgp early on, but that's not deltachat's business.
If needed the PGP project can always do this with patching.
2023-01-31 11:54:48 +01:00
Floris Bruynooghe 3150d2b94b Introduce a ContextBuilder struct (#3698)
The way to create a Context is now rather burdensome, users have to
create and import a bunch of things just to get a Context.  So let's
introduce a builder.

Notice that the builder can only produce an open context, if the
context can not be opened it is dropped.  This is on purpose, the
Context itself can become RAII again at some point by doing this.
Only the FFI needs to have the concept of an open and a closed
Context.
2022-11-04 20:23:06 +00:00
Floris Bruynooghe 38efde6c98 Seems the npm stuff manages to avoid the cargo config file 2022-11-04 12:32:22 +00:00
Floris Bruynooghe 056b8ba1e8 link tokio issue, remove opt-level line
opt-level relies on the default instead
2022-11-04 12:32:22 +00:00
Floris Bruynooghe ccd4d46391 Do not use optimised debug builds
Optimised debug builds result in an extremely slow code-build-test
cycle.  The reason we do this is because we have a few tests which end
up overflowing the stack.  This increases the stack instead.
2022-11-04 12:32:22 +00:00
Floris Bruynooghe a73fbf7232 Update textwrap dependency
The current version is unsatisfyable if you use deltachat as a
dependency itself.
2022-10-24 22:09:41 +02:00
Floris Bruynooghe 8033966a70 Validate and simplify LoginParam struct
This makes sure that under normal circumstances the LoginParam struct
is always fully validated, ensure future use does not have to be
careful with this.

The brittle handling of `server_flags` is also abstraced away from
users of it and is now handled entirely internally, as the flags is
really only a boolean a lot of the flag parsing complexity is removed.
The OAuth2 flag is moved into the ServerLoginParam struct as it really
belongs in there.
2022-06-16 18:14:23 +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
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
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
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
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
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
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
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
Floris BruynoogheandHocuri 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
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
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
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
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
Floris Bruynooghe 2c613b3837 Fix typo 2021-02-18 21:39:27 +01:00
Floris Bruynooghe 036c9cd513 Wait for join-group to finish using ongoing channel
The ongoing mechanism actually has a channel to wait on instead of
sleeping in a loop.  Let's use it.
2021-02-18 21:39:27 +01:00
Floris Bruynooghe 24cb6aa9a4 Fix terminating the ongoing process in securejoin
When securejoin allocated an ongoing process it was never freed
again.  This fixes this and also adds test coverage for the right
ongoing behaviour.
2021-02-18 21:39:27 +01:00
Floris Bruynooghe 04a978687f Errors are ok, apparently 2021-02-17 19:22:14 +01:00
Floris Bruynooghe f464e43ba9 Handle errors properly
The other db-loading branches of this code handle an error, there's no
reason this bit should be skipping this.
2021-02-17 19:22:14 +01:00