Commit Graph

105 Commits

Author SHA1 Message Date
Alexander Krotov 8e0a29e9b5 Stop using Event callback return values
Since stock string callback has been deprecated, all event callbacks
return 0.

For compatibility, C declarations are not changed and FFI users are
expected to return 0 from their callbacks.
2019-12-21 22:51:44 +00:00
Alexander Krotov 4ad9166b5a Move one chat test from stress.rs to chat module 2019-12-10 13:54:05 +01:00
dignifiedquire db88212a64 refactor: unsafe, CStr and libc moved out 2019-12-03 12:25:22 +01:00
Alexander Krotov a7bb249070 Move another OAuth2 test from stress.rs to oauth2.rs 2019-12-01 20:46:35 +01:00
Alexander Krotov 17cb1226c6 Move OAuth 2 stress tests to oauth2 module 2019-11-30 19:19:05 +01:00
Alexander Krotov d0795f5770 Automatically fix some clippy warnings with "cargo fix" 2019-11-27 21:43:18 +01:00
B. Petersen 5796c28391 test contact adding and modifying 2019-11-16 13:55:59 +01:00
dignifiedquire dc2cf8ecfc unify naming in pgp 2019-10-10 00:23:36 +02:00
dignifiedquire 03979fdc51 wip 2019-10-10 00:23:36 +02:00
dignifiedquire fb9369f333 refactor(imex): almost all unsafe gone here 2019-09-28 02:55:42 +02:00
Alexander Krotov cb499ae502 Return Result<String> from dc_decrypt_setup_file 2019-09-26 18:05:29 +02:00
holger krekel d5383aecc9 finish dc_imex refactoring, fix linting, rustify some things 2019-09-25 23:46:44 +02:00
Alexander Krotov 8165b76001 Make dc_normalize_setup_code safe 2019-09-25 03:29:37 +02:00
dignifiedquire 05f9f454c3 refactor: remove x module and delete deadcode 2019-09-21 17:56:49 +02:00
Dmitry Bogatov 95d8665dbe Refine signature of dc_get_oauth2_access_token()
Previously, `dc_get_oauth2_access_token` accepted "flags" argument,
that actually had only one possible field: 0x1 == DC_REGENERATE.

This change replaces "flags" argument with single boolean argument
"regenerate".
2019-09-18 19:29:39 +02:00
dignifiedquire 84bf1ec6e7 refactor(tools): no more dc_mprintf 2019-09-16 07:58:08 +02:00
dignifiedquire 5486ac5b9f refacor: use an enum for events 2019-09-15 23:40:08 +02:00
dignifiedquire f31f341a50 feat: enforce Debug implementations and remove mod types 2019-09-15 16:36:31 +02:00
dignifiedquire c2501258b6 apply CR feedback 2019-09-15 16:36:31 +02:00
dignifiedquire de1e3e1d4f refactor(context): remove last unsafe bits from the context struct 2019-09-15 16:36:31 +02:00
Floris Bruynooghe afc9a31080 Remove dc_open call
A new context is now created by calling Context::new and therefore you
always have a valid context.  This is much more in Rust style and will
allow a lot of furture simplifications on the context itself.

The FFI layer has not yet been adjusted in this commit and thus will
fail.
2019-09-15 02:37:13 +02:00
B. Petersen 177ab0229a do not call fs::remove_dir_all() implicitly on non-files; deleting folders is not needed and calling remove_dir_all() is considered harmful 2019-09-11 17:02:27 +02:00
Alexander Krotov 706a97b013 Move part of test_encryption_decryption to key.rs 2019-09-11 00:40:46 +03:00
Alexander Krotov 22c1ee1f55 cargo fmt 2019-09-10 16:29:41 +03:00
Alexander Krotov 69f8973339 test_encryption_decryption: use safe from_slice instead of from_binary 2019-09-10 16:29:24 +03:00
Alexander Krotov 188eab5faf Fix test_encryption_decryption
It is broken since 28cae607a4
2019-09-10 12:00:59 +02:00
Alexander Krotov 28cae607a4 Pass buffers to pgp.rs as slices 2019-09-09 18:50:47 +02:00
Dmitry Bogatov 2fe07e86c7 Replace explicit casts from 0 to pointer with std::ptr::null 2019-08-27 21:22:03 +00:00
Dmitry Bogatov db4f972315 Move test for mimeparser from stress.rs into src/* 2019-08-27 22:20:45 +02:00
Dmitry Bogatov 8e4a01c98d Make dc_mimeparser_parse() return parser instead of modifying reference
Since dc_mimeparser_parse() called `dc_mimeparser_empty()' on passed reference
anyway, it makes more sense to create new instance of `dc_mimeparser_t' and
return it instead.

Previously, usage pattern was following:

 dc_mimeparser_new()
 dc_mimeparser_empty() // semantically no-op, called inside dc_mimeparser_parse

Now call to dc_mimeparser_empty() is avoided.
2019-08-27 22:20:45 +02:00
Dmitry Bogatov 21976b14a6 dc_mimeparser_parse: accept input as slice, not as pointer + length 2019-08-27 22:20:45 +02:00
dignifiedquire 886262539a refactor: save lot implementation and follow up refactors
rewrote qr code to match the now safe lot
2019-08-19 08:06:54 +02:00
dignifiedquire b5c66dd52a refactor(lot): rust memory management 2019-08-19 08:06:54 +02:00
dignifiedquire 25e97df641 refactor(chat): store rust strings in the chat struct 2019-08-17 11:35:02 +02:00
dignifiedquire 001880e1f0 refactor(chat): first round of method renaming and restructuring 2019-08-17 11:34:10 +02:00
dignifiedquire ddfd067e97 refactor(chat): rust based memory management 2019-08-17 11:30:26 +02:00
dignifiedquire 64117c2964 refactor(chat): rename dc_chat to chat 2019-08-17 11:30:26 +02:00
dignifiedquire 4878192a25 refactor: remove now unused saxparser 2019-08-17 01:32:43 +02:00
dignifiedquire b2a6876a50 refactor(location): switch to rust based xml parsing 2019-08-17 01:32:43 +02:00
Friedel Ziegelmayer ed237c8d25 refactor(receive_imf): first pass at some more sanity 2019-08-13 17:58:32 +02:00
Alexander Krotov fb7bbac524 Return Vec from dc_get_chat_contacts 2019-08-13 02:37:18 +03:00
Alexander Krotov ff021fed1f dc_tools: rustify interfaces of file-related functions 2019-08-10 21:15:48 +03:00
Friedel Ziegelmayer ea6972118a refactor: rusty contact
* refactor(contact): rename and rusty memory allocations
* refactor(contact): use enum to indidcate origin
* refactor(contact): safe blocking and unblocking api
* refactor(contact): only safe and no more cstrings
2019-08-07 22:20:48 +02:00
Floris Bruynooghe d37dda6f50 Turn the function safe 2019-08-03 01:00:59 +02:00
Alexander Krotov a4f94dbf86 Store dc_mimeparser_t::parts as Vec instead of carray 2019-08-01 23:21:56 +03:00
Floris Bruynooghe b6b0849bce Remove to_cstring() naming convention ambiguity
Add a trait for str.strdup() to replace to_cstring() which avoid the
signature ambiguity with .to_string().

Also instruduce CString::yolo() as a shortcut to
CString::new().unwrap() and use it whenever the variable does can be
deallocated by going out of scope.  This is less error prone.

Use some Path.to_c_string() functions where possible.
2019-08-01 19:06:39 +02:00
Friedel Ziegelmayer e7456248a0 Merge pull request #244 from link2xt/dc_location_vec
Replace some dc_array_t with Vec<dc_location>
2019-07-31 22:15:35 +02:00
Dmitry Bogatov 39e530f759 Change Context.os_name field to String 2019-07-31 15:45:35 +00:00
Alexander Krotov 707c8c2830 Make dc_split_armored_data return bool (#251)
* Make dc_split_armored_data return bool

* Remove double negations
2019-07-30 08:46:36 +02:00
Alexander Krotov ae6c41a019 dc_kml_t: replace Option<dc_array_t> with Option<Vec<dc_location>> 2019-07-30 02:34:05 +03:00