Commit Graph
100 Commits
Author SHA1 Message Date
Alexander Krotov 8fb859c0c4 Merge pull request #445 from deltachat/smtp_error
Avoid panic on SMTP error
2019-09-05 20:22:24 +00:00
Alexander Krotov 094d46293e Set Smtp.error when SMTP fails to send message 2019-09-05 05:29:37 +03:00
Alexander Krotov c8d945db56 Store Smtp.error as Option<String>
Without this change, when SMTP password is incorrect,
as_str(sock.error) is called with a null pointer,
and as_str panics.

Now it does not crash when the error is not set.
2019-09-05 05:28:57 +03:00
Alexander Krotov f78f0079c1 Upgrade to the latest version of imap crate 2019-09-04 20:59:54 +02:00
Alexander Krotov 46520edd87 Print error if CAPABILITY command fails. 2019-09-04 15:12:00 +02:00
Alexander Krotov 65adff4bdd Merge pull request #437 from KAction/spelling
Fix minor spelling errors in python/README.rst
2019-09-04 10:55:58 +00:00
Alexander Krotov ffd719962c Merge pull request #430 from deltachat/latest-imap
Update to the latest rust-imap
2019-09-03 17:12:12 +00:00
Alexander Krotov 489f25940f Update to the latest rust-imap
It uses imap-proto 0.8.1 instead of outdated 0.7.0.
2019-09-03 19:14:56 +03:00
Alexander Krotov aeb1a88e7a Remove dc_move.rs
and move dc_do_heuristics_moves to context.rs
2019-09-03 13:39:14 +02:00
Alexander Krotov c406675d6a Mark dc_do_heuristics_moves as safe 2019-09-03 13:39:14 +02:00
Alexander Krotov 1ec193991b Make dc_token.rs safe 2019-09-02 20:57:22 +02:00
Alexander Krotov 77be6c4294 Merge pull request #424 from link2xt/chatlist_safe
Mark Chatlist::get_summary as safe
2019-09-02 11:45:12 +00:00
Alexander Krotov 1497f263dc Mark Chatlist::get_summary as safe 2019-09-02 13:00:04 +03:00
Alexander Krotov b5a9cc1380 Convert DC_*_ID_* constants to u32 2019-09-01 23:41:05 +03:00
Alexander Krotov 1ba7368c6d mailmime_get_mime_type: do not dereference null pointer
In C code there was a check for null pointer in reconcat_mime()
It did nothing if raw_mime was null.
Now the result is stored even when mailmime_get_mime_type is
explicitly called with null pointer.

This commit restores C core logic.

Fixes #420
2019-09-01 20:11:50 +03:00
Alexander Krotov c1a78d9c3e Merge remote-tracking branch 'kaction/clippy'
Fix clippy warnings.
2019-08-30 01:49:46 +03:00
Alexander Krotov ae17971599 top_evil_rs.py: use glob to walk into subdirs
Otherwise configure/* is not included in the report.
2019-08-26 19:31:30 +02:00
Alexander Krotov 8a73f84003 Move all unsafe code from dc_array.rs to FFI 2019-08-21 09:30:59 +02:00
Alexander Krotov 1a8e08e429 Merge pull request #396 from deltachat/chat-array
Remove dc_array_t from chat.rs
2019-08-19 06:55:58 +00:00
Alexander Krotov e7cf5a546a Remove dc_array_t from chat.rs 2019-08-18 23:02:16 +03:00
Alexander Krotov 6b2fe03d08 Replace dc_array_t with Vec in context.rs 2019-08-18 12:44:49 +02:00
Alexander Krotov e013532e27 Remove unused dc_array_get_string 2019-08-17 01:04:37 +02:00
Alexander Krotov 1a42a1e6b1 Replace dc_array with Vec in dc_receive_imf.rs 2019-08-17 01:04:37 +02:00
Alexander Krotov fadcd43fee Move some unsafe dc_array_* functions to FFI 2019-08-16 00:53:32 +03:00
Alexander Krotov 37622af55a Return Vec<dc_location> from dc_get_locations 2019-08-15 20:43:04 +02:00
Alexander Krotov 29d4f6888d Store IDs in dc_array as u32
This changes dc_array_get_raw API
2019-08-15 01:54:51 +02:00
Alexander Krotov 5b47409fb0 Remove unused dc_array_* API 2019-08-15 01:54:51 +02:00
Alexander Krotov 88a81f5737 Return Vec from get_all_blocked
And never return nullptr from dc_get_blocked_contacts.
2019-08-13 23:56:17 +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
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
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
Alexander Krotov 828e6e3fd0 Merge pull request #320 from link2xt/dc_tools_files
dc_tools: rustify interfaces of file-related functions
2019-08-10 23:10:24 +00:00
Alexander Krotov ff021fed1f dc_tools: rustify interfaces of file-related functions 2019-08-10 21:15:48 +03: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
Alexander Krotov 64051fca10 Rename dc_simplify_t into Simplify 2019-08-09 16:57:14 +02:00
Alexander Krotov 14ce55b1a8 Remove #[repr(C)] from dc_simplify_t 2019-08-09 16:57:14 +02:00
Alexander Krotov 7c34806125 Remove empty keyhistory module 2019-08-08 13:32:45 +03:00
Alexander Krotov 8c933f8fa8 Return bool from set_self_key() 2019-08-08 12:27:01 +03:00
Alexander Krotov 76dbb37609 Implement dc_get_abs_path_safe 2019-08-08 04:20:12 +03:00
Alexander Krotov 5811248bfc Merge pull request #289 from KAction/new-assert
python: assert that underlying dc_msg_t* for Message is not NULL
2019-08-04 12:58:04 +00:00
Alexander Krotov c5eef21645 Remove carray use and comment 2019-08-02 13:12:32 +03:00
Alexander Krotov d64fcece5b Return Vec instead of carray from dc_split_into_lines 2019-08-02 13:12:25 +03:00
Alexander Krotov e78b879c9e Remove unused function dc_simplify_simplify 2019-08-02 09:29:54 +03:00
Alexander Krotov 1145c3533b Use Vec instead of carray in dc_forward_msgs() 2019-08-02 01:34:15 +03:00
Alexander Krotov a4f94dbf86 Store dc_mimeparser_t::parts as Vec instead of carray 2019-08-01 23:21:56 +03:00
Alexander Krotov 9e50e77031 Simplify dc_initiate_key_transfer() 2019-07-31 22:06:05 +02:00
Alexander Krotov 164a8fe39a encode_66bits_as_base64: use base64 crate 2019-07-31 16:25:01 +02:00
Alexander Krotov 0b679f8b95 dc_tools: Make dc_create_id() safe 2019-07-31 16:25:01 +02:00
Alexander Krotov 8267ffb8d2 Replace dc_mimeparser_t::reports carray with Vec 2019-07-31 15:57:05 +03:00
Alexander Krotov 7bc338fc72 Mark get_backoff_time_offset as safe 2019-07-31 15:51:50 +03:00
Alexander Krotov d6dae0a9e8 Make dc_array_sort_ids() safe and move it into impl 2019-07-31 03:21:13 +03: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 f87c98d6ea Make cb_set_config() safe 2019-07-30 02:43:50 +03:00
Alexander Krotov 76e76470e0 Replace range loop with foreach loop 2019-07-30 02:34:05 +03: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
Alexander Krotov 81a84620eb Store dc_kml_t::locations as Option<dc_array_t> instead of pointer 2019-07-30 02:34:05 +03:00
Alexander Krotov 14e42b48bd dc_get_locations: use from(Vec<dc_location>) instead of add_location 2019-07-30 02:34:05 +03:00
Alexander Krotov 2688a397aa Implement From<Vec<dc_location>> for dc_array_t 2019-07-30 02:32:24 +03:00
Alexander Krotov 3ace4fcc2f Make key::to_asc return String 2019-07-30 02:22:08 +03:00
Alexander Krotov 21b4147d15 sql.rs: make is_file_in_use() safe 2019-07-30 01:15:51 +03:00
Alexander Krotov 03603a48a0 dc_job.rs: add DC_{IMAP,SMTP}_THREAD constants 2019-07-29 20:20:52 +03:00
Alexander Krotov 27342f50b5 Remove unsafe version of dc_timestamp_to_str 2019-07-29 18:45:12 +03:00
Alexander Krotov 2d5b04148f Make dc_open arguments rusty 2019-07-29 04:05:21 +03:00
Alexander Krotov dfce34f275 Return bool from is_file_size_okay 2019-07-29 03:14:21 +03:00
Alexander Krotov 3f445a3a6c Make dc_get_config_t safe 2019-07-28 23:57:28 +03:00
Alexander Krotov 6c818c6123 Make dc_tools::dc_exactly_one_bit_set safe and return bool 2019-07-28 22:40:30 +02:00
Alexander Krotov 3eaab07b0b top_evil_rs.py: remove comments before counting
For example, constants.rs is completely safe now, but has "free()" in the comments.
2019-07-28 22:39:39 +02:00
Alexander 0cffbaf1e9 refactor: rename dc_array_t::as_ptr() into dc_array_t::into_raw()
By convention as_* functions do not consume self by taking the reference.
2019-07-28 20:31:57 +02:00
Alexander 0132106c7e fix(imex): dc_decrypt_setup_file: extend lifetime of CString
payload_c binding makes sure the memory is not freed until strdup exits.

See as_ptr documentation:
https://doc.rust-lang.org/std/ffi/struct.CString.html#method.as_ptr
2019-07-28 19:47:52 +02:00
Alexander 5a8b4748b8 fix(msg): correct return value for dc_msg_is_setupmessage
It is broken since 8a0fc609e6
where 0i32 was replaced with true instead of false.
2019-07-28 18:33:31 +02:00
Alexander Krotov 3033d8100d Test dc_create_setup_code() without to_cstring() 2019-07-28 15:05:28 +03:00
Alexander Krotov 0e6b12d7ae Move to_string out of dc_create_setup_code 2019-07-28 15:05:28 +03:00
Alexander Krotov 21d94b1d09 Remove misplaced comment 2019-07-27 19:28:39 +03:00
Alexander Krotov ae1cbc9596 dc_array: store locations as Vec<dc_location> 2019-07-27 19:28:39 +03:00
Alexander Krotov 86d047f618 dc_chat: use get_id instead of accessing array fields directly 2019-07-27 19:28:39 +03:00
Alexander Krotov 1cd7cb541c Rewrite most location array member accessors 2019-07-27 19:28:39 +03:00
Alexander Krotov f27dda86ff Move dc_array_search_id into dc_array_t implementation 2019-07-27 19:28:39 +03:00
Alexander Krotov 51319f89e8 Create dc_array_t in dc_get_locations without unsafe 2019-07-27 19:28:39 +03:00
Alexander Krotov 8b4acbb63a Move dc_array_get_ptr inside dc_array_t implementation 2019-07-27 19:28:39 +03:00
Alexander Krotov 928361429e Move dc_array_get_{uint,id} inside dc_array_t implementation 2019-07-27 19:28:39 +03:00
Alexander Krotov c17632188a Avoid using return in dc_array_get_cnt implementation 2019-07-27 19:28:39 +03:00
Alexander Krotov ea3c89e913 Move dc_array_unref logic inside dc_array_t implementation
This will allow to make dc_array_t members private in the future.
2019-07-27 19:28:39 +03:00
Alexander Krotov ea84edf13a Implement dc_array_t::len() 2019-07-27 19:28:39 +03:00
Alexander Krotov c335348f20 Implement dc_array_t::is_empty() 2019-07-27 19:28:39 +03:00
Alexander Krotov 1e91f6a204 Merge dc_array_free_ptr into dc_array_unref 2019-07-27 19:28:39 +03:00
Alexander Krotov dfd43cbb97 Rename dc_array_new_typed into dc_array_new_locations
dc_array_new_typed is only used internally, so we can change its API.
2019-07-27 19:28:39 +03:00
Alexander Krotov c7a6b3caae Remove unnecessary check in dc_array_new_typed
Allocating Vec with 0 capacity is correct.
2019-07-27 19:28:39 +03:00
Alexander Krotov f3eea41914 Reimplement dc_array_new without dc_array_new_typed 2019-07-27 19:28:39 +03:00
Alexander Krotov 8d43ad4809 Construct dc_array_t id arrays using safe methods 2019-07-27 19:28:39 +03:00
Alexander Krotov 1f63753a8b Simplify dc_array_search_id 2019-07-27 19:28:39 +03:00
Alexander Krotov e796a4c438 Move dc_array_add_{uint,id} implementations into dc_array_t 2019-07-27 19:28:39 +03:00
Alexander Krotov 85dfd65e48 Simplify dc_array_get_string 2019-07-27 19:28:39 +03:00
Alexander Krotov a323fe68a6 Simplify dc_array_duplicate 2019-07-27 19:28:39 +03:00
Alexander Krotov 05aca2c529 Make dc_array_new and dc_array_new_typed safe
Just like Box::into_raw, these functions are safe,
even though the caller is responsible for the allocated structure.
2019-07-27 19:16:42 +03:00
Alexander Krotov 1dfad65afd dc_array.rs: remove magic field
It was always set to DC_ARRAY_MAGIC, except immediately before freeing the memory.
2019-07-27 19:16:42 +03:00
Alexander Krotov e15e3a1e84 Use Vec to store dc_array_t data 2019-07-27 18:25:24 +03:00
Alexander Krotov 252697b174 Implement dc_array_t::new() and use Box to allocate dc_array_t 2019-07-27 18:25:24 +03:00