Friedel Ziegelmayer
ed237c8d25
refactor(receive_imf): first pass at some more sanity
2019-08-13 17:58:32 +02:00
Alexander Krotov
d46a5345d2
Use Vec instead of dc_array_t in search_chat_ids_by_contact_ids
2019-08-13 17:54:28 +02:00
dignifiedquire
523141597e
chore: remove no longer needed features
2019-08-13 12:20:53 +02:00
dignifiedquire
cfed5c914c
chore: update rust nightly version
2019-08-13 12:20:53 +02:00
dignifiedquire
20f9bb3b14
chore: setup clippy
2019-08-13 12:20:53 +02:00
Friedel Ziegelmayer
6067160582
Implement procedural macro to derive {To,From}Sql traits ( #322 )
...
Implement procedural macro to derive {To,From}Sql traits
2019-08-13 12:16:24 +02:00
Alexander Krotov
3175c4f7ba
Merge pull request #333 from link2xt/dc_array-assert
...
dc_array: panic on null pointers and out of range indexes
2019-08-13 12:53:46 +03:00
Simon Laux
a29f06a730
cargo fmt
2019-08-13 10:45:27 +02:00
Simon Laux
c713474d1f
remove lot magic
2019-08-13 10:45:27 +02:00
Simon Laux
89c874d4a9
remove message magic
...
there is still a reference to C #[repr(C)] so I'm not sure at this
2019-08-13 10:45:27 +02:00
Simon Laux
5e3cba9b70
remove chat magic
2019-08-13 10:45:27 +02:00
Dmitry Bogatov
a7894fd785
cargo fmt
2019-08-13 10:11:17 +02:00
Dmitry Bogatov
c638a770f9
Remove redundant check
...
Condition '!imffields.is_null()' is always true, since it is contained in conditional
if !(in_out_message.is_null() || imffields.is_null()) {
which is equivalent to
if !in_out_message.is_null() && !imffields.is_null() {
2019-08-13 10:11:17 +02:00
Simon Laux
6ced6ac23b
macro for progress event like in C core
2019-08-13 10:07:13 +02:00
Simon Laux
d0b77b61eb
cargo fmt
2019-08-13 10:07:13 +02:00
Simon Laux
b440c3636b
replace gotos with ok_to_continue
2019-08-13 10:07:13 +02:00
Floris Bruynooghe
dfd58961f7
Safe load_or_generate_self_public_key
...
The function is made safe and now returns Result. Functionally it now
fails when it can not write the newly generated key to the database
whereas before it still returned the key but logged a warning. There
is no reason this shouldn't be able to store the key and silently not
storing the key may result in later operations assuming the key is
available, so failing seems like a better choice.
The function now also uses a proper mutex to guard against multiple
threads generating keys. And this mutex is Context-scoped rather than
fully global (static).
2019-08-13 10:04:38 +02:00
Jikstra
139c9f37b1
Merge pull request #339 from deltachat/rm_goto_dc_job
...
rm GOTO: dc job
2019-08-13 02:10:08 +02:00
Alexander Krotov
4d402f3a06
dc_array: panic on null pointers and out of range indexes
2019-08-13 03:07:13 +03:00
Alexander Krotov
fb7bbac524
Return Vec from dc_get_chat_contacts
2019-08-13 02:37:18 +03:00
Alexander Krotov
6c95d008e0
Implement From<Vec<u32>> for dc_array_t and use it instead of new()
2019-08-13 01:40:47 +03:00
Simon Laux
9e30df4b43
cargo fmt
2019-08-12 05:42:02 +02:00
Simon Laux
50c592e41f
convert current_block to goto and remove UDC*
...
*Unreachable Duplicated Code (I made that shortcut up)
2019-08-12 05:41:24 +02:00
Jikstra
ce3b815bd8
Merge pull request #319 from deltachat/fix_utf8_text_msg_load_from_db
...
Fix having a msg object without a text in it because of invalid utf8
2019-08-12 01:16:23 +02:00
jikstra
a3683be047
cargo fmt
2019-08-11 18:55:23 +02:00
Jikstra
9dca19d6c9
Merge pull request #302 from deltachat/rm_goto_dc_imex
...
Remove goto in dc imex
2019-08-11 18:52:17 +02:00
jikstra
3ba847ece2
Apply requested changes
2019-08-11 16:57:49 +02:00
Simon Laux
91bf948d1e
chat magic to const
2019-08-11 10:45:17 +02:00
Simon Laux
91fec77f4b
fix msg info: message-id
2019-08-11 09:05:56 +02:00
Simon Laux
8fb25a6340
Cargo fmt: removed two empty llines
2019-08-11 09:04:47 +02:00
Simon Laux
cf49acff67
part 2
2019-08-11 02:07:51 +02:00
Simon Laux
4f1a25e1bf
cargo fmt
2019-08-11 02:07:51 +02:00
Simon Laux
8608daa7dc
remove goto
2019-08-11 02:07:51 +02:00
Alexander Krotov
ff021fed1f
dc_tools: rustify interfaces of file-related functions
2019-08-10 21:15:48 +03:00
Dmitry Bogatov
ed66f36cb5
Implement procedural macro to derive {To,From}Sql traits
...
With this macro it is possible to #[derive(ToSql, FromSql)] for enums, that do
not contain data (C-style).
2019-08-10 17:52:48 +00:00
jikstra
b7ff996b15
Cargo fmt + refactoring
2019-08-10 17:57:53 +02:00
jikstra
faf53fe11e
Manually get a lossy utf8 string from the database if other fails
2019-08-10 17:53:05 +02:00
jikstra
b23c4b4da6
Remove debug printlns, refactor a bit
2019-08-10 16:51:57 +02:00
jikstra
966bb2271a
Put something into the msg object if we fail to get a valid string out of the db
2019-08-10 16:47:38 +02:00
Floris Bruynooghe
5438be891b
Remove dc_context_unref from Rust API
...
This removes the dc_context_unref function from the Rust API which was
just an alias for dc_close. It still exists on the C API where it
makes sure to free the memory.
It also implements Drop for the context which just calls dc_close to
make sure all the memory is freed. Since you can call dc_close as
many times as you like this ensures that at the Rust level you can't
Drop the struct without releasing the memory.
Finally since memory is now freed by dropping the struct this removes
the #[repr(C)] for the struct. This struct is fully opaque to the C
API.
2019-08-10 12:04:11 +02:00
Floris Bruynooghe
f31f603c8b
Turn dc_ensure_secret_key_existy into something more rusty
...
This marks the function safe and returns Result, it also now returns
the ConfiguredAddr since it has to look this up anyway and it makes
testing more easy. Turns out it reduces some duplicate SQL query in
some callers too.
More test code has been moved from dc_imex to test_utils as it's
more genrally applicable.
2019-08-10 11:14:40 +02:00
Dmitry Bogatov
ff39fa0fed
Remove useless cast of format! argument
...
Both `c_int' and `u32' format is same way by default formatter `{}'.
2019-08-10 03:00:43 +02:00
Dmitry Bogatov
cdf3809634
Set type of dc_msg_t.server_folder to Option<String>
2019-08-10 03:00:43 +02:00
Simon Laux
b2a2791f6f
cargo fmt
2019-08-09 23:49:54 +02:00
Simon Laux
125df968d2
replace goto with ok_to_continue
2019-08-09 23:49:54 +02:00
Dmitry Bogatov
1c5d07a29f
Reimplement dc_str_replace() with standard Rust functions
...
This change removes one more use of unstable `wrapping_offset_of'.
2019-08-09 23:40:44 +02:00
Dmitry Bogatov
24b025f573
Replace DC_MOVE_* constants with enum
2019-08-09 21:51:33 +02:00
jikstra
d323bd3593
Write tests and docs for dc_strdup and dc_strdup_keep_null
2019-08-09 19:30:36 +02:00
Alexander Krotov
b7174783f1
Pass is_html to Simplify.simplify() as bool
2019-08-09 16:57:14 +02:00
Alexander Krotov
e3269616bd
Use bool for Simplify members
2019-08-09 16:57:14 +02:00