B. Petersen
51f43842cf
cargo fmt
2019-10-27 11:42:56 +01:00
B. Petersen
8015ba1d64
dc_get_chat_id_by_contact_id() returns 0 if no chat is found.
...
this is no error;
in fact, the function is used to probe
if there is a chat with a given contact at several places
eg. in the android-ui.
2019-10-26 18:37:33 +02:00
Dmitry Bogatov
a9dd78f622
Narrow return type of location::set: cint -> bool
2019-10-19 22:38:43 +02:00
B. Petersen
7b958a20fd
prefer to_string_lossy() over as_str() as the latter pancis on non-wellformatted utf-8
2019-10-19 22:30:25 +02:00
B. Petersen
4519071718
prefer to_opt_string_lossy() over as_opt_str() as the latter pancis on non-wellformatted utf-8
2019-10-19 22:30:25 +02:00
B. Petersen
bb08b39c71
remove duplicated code
2019-10-19 22:30:25 +02:00
holger krekel
24c0a833bd
address @flub comments
2019-10-09 15:59:31 +02:00
holger krekel
45f011c63c
expose and test set_stock_translation to Python
2019-10-09 15:59:31 +02:00
holger krekel
b82af9fff3
introduce set_stock_translation and remove call to DC_EVENT_GET_STRING
2019-10-09 15:59:31 +02:00
holger krekel
b8f211a013
cargo fmt
2019-10-07 00:55:33 +02:00
holger krekel
51534b2fae
move all alloc/free/stop/has/shall_stop*ongoing* methods to context
...
introduce stop_ongoing to bindings and test for cancelation of configure
2019-10-07 00:55:33 +02:00
B. Petersen
db2064de14
use .to_string_lossy() member of Path, CStr etc.
...
instead of calling to_str().unwrap_or_default().
2019-10-05 22:46:29 +02:00
björn petersen
2fe98775f9
Merge pull request #673 from deltachat/dont-panic
...
Don't Panic!
2019-10-05 15:08:15 +02:00
B. Petersen
abfff96cd4
cargo fmt
2019-10-05 12:44:08 +02:00
B. Petersen
735bdd1c20
always use to_string_lossy() for converting c-strings to String
...
the function to_string() is removed;
c-strings may always be badly formatted and this should never lead to a panic.
2019-10-05 00:12:32 +02:00
B. Petersen
477af413c6
if in doubt, prefer unwrap_or_default()
...
if the past we had lots of crashes because of unexpected unwrap failures,
mostly related to string.
this commit avoids them eg. for string-conversions that may panic
eg. when encountering a null-byte or by logical programming errors
where an object is assumed to be set but is not under unexpected circumstances.
2019-10-04 23:07:33 +02:00
holger krekel
603761e4b7
add DC_EVENT_DELETED_BLOB_FILE
2019-10-03 18:01:56 +02:00
holger krekel
467c09f491
introduce DC_EVENT_NEW_BLOB_FILE event and test for it
2019-10-03 18:01:56 +02:00
holger krekel
509a21ff05
introduce DC_IMAP_MESSAGE_MOVED event and try harder to send out MDNs
2019-10-02 23:51:14 +02:00
holger krekel
96066712bd
add and test for DC_IMAP_MESSAGE_DELETED event
2019-10-02 23:51:14 +02:00
holger krekel
489cdd1b24
- resultify send-out pipeline for better error reporting
...
- early ignore sending out smtp messages with no recipients
2019-10-02 22:51:09 +02:00
holger krekel
3f7995a7ea
start with some refactoring of the outgoing pipeline
2019-10-02 22:51:09 +02:00
B. Petersen
3a16ad89bd
make ffi-string-parameter const
...
typically, nearly all string-parameters in the ffi should be const.
one of the few exceptions is dc_str_unref() that really modifies the given data.
2019-09-28 02:56:27 +02:00
dignifiedquire
fb9369f333
refactor(imex): almost all unsafe gone here
2019-09-28 02:55:42 +02:00
Alexander Krotov
f346a052c1
Return Result from dc_initiate_key_transfer
2019-09-27 17:57:45 +02:00
Floris Bruynooghe
8b7cd2dd1a
Revert back to only ffi-level checking of open context
...
The Rust context is always open, the return value of this function was
simply the wrong way around.
2019-09-26 20:08:36 +02:00
jikstra
20b82b3638
Fix ffi actually calling context.sql.is_open()
2019-09-26 18:36:31 +02:00
holger krekel
02b73207f9
fixup this PR with tests, and returning None from get_filemime
2019-09-26 17:12:06 +02:00
Floris Bruynooghe
69f1497986
Make dc_get_info() work on a closed context
...
There is very little API guarantees about this, but clients seem to
expect *something* to work on a closed context. So split this up into
static info an more dynamic context-related info, but let's not
provide any guarantees about what keys are available when.
Fixes #599
2019-09-26 14:22:03 +02:00
holger krekel
6cd3580263
rustifying dc_continue_key_transfer and fix master-conflict
2019-09-25 23:46:44 +02:00
holger krekel
d5383aecc9
finish dc_imex refactoring, fix linting, rustify some things
2019-09-25 23:46:44 +02:00
holger krekel
8518d8f456
rustify imex and friends
2019-09-25 23:46:44 +02:00
Alexander Krotov
60bd053095
Pass setup_code to dc_continue_key_transfer as &str
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
dignifiedquire
e80345a05b
refactor(chat): remove c types and unsafe
2019-09-21 16:59:59 +02:00
dignifiedquire
0bdcc3d616
refactor(message): remove remaining unsafe and c types
2019-09-21 16:37:19 +02:00
dignifiedquire
987f12740e
refactor(message): remove unsafe and c types from the Message api
2019-09-21 16:37:19 +02:00
dignifiedquire
1265016a55
refactor(message): rustiy api
2019-09-21 16:37:19 +02:00
holger krekel
91b98e8c6d
as discussed during camp and otherwise ... add dc_perform_{mvbox,sentbox}_jobs hooks which, however, for now have an empty implementation. They can already be called from UIs, though. Next step is refactoring imap-job handling to only execute jobs belonging to the respective imap folder.
2019-09-20 01:03:25 +02:00
Simon Laux
37f854be3e
Add provider info functions to the FFI API
...
A lot of work from @Hocuri and @Simon-Laux mostly.
This exposes the API of the deltachat-provider-overview crate on the
deltachat FFI API, allowing clients to use it to help users set up
their accounts.
2019-09-19 07:17:44 +02:00
Dmitry Bogatov
e0e82e1877
Fix ffi interoperability issue
...
Clients expect empty "dbfile" argument to be treated as NULL value.
This change fulfills their expectations.
Closes : #530
2019-09-19 07:15:35 +02:00
dignifiedquire
0bf3d20e07
fix and implement ffi tranlation
2019-09-15 23:40:08 +02:00
dignifiedquire
16c281a9b7
refactor(context): safe interface
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
a3f64d4e95
Handle new Context creation API on the FFI
...
This adopts the FFI API to use the new Context::new() and
Contest::drop() Rust-style APIs while preserving the semantics of the
existing FFI API. It introduces a wrapper around the context which
keeps an optional reference to the actual context, changing dc_open()
and dc_close() to create/destroy the actual reference.
This changes the events emitted on closing slightly: they only get
emitted when dc_close() was called while the context was open. While
dc_close() remains idempotent in that it can still be called safely
multiple times, the close events will only occur if the context is
actually closed.
2019-09-15 02:37:13 +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
Simon Laux
e5699e8ba9
Merge pull request #517 from deltachat/fix_get_draft
...
Fix get_draft to just return null and not produce errors if there's no
2019-09-14 23:39:09 +02:00
Floris Bruynooghe
8a7143b791
Return a Result<Option<Message>> for get_draft
...
The function can fail, so we need to still have an error return as
well as a no-draft return.
Add tests.
2019-09-14 23:00:13 +02:00
Alexander Krotov
fad49e08d7
message.rs: resolve "should return bool" TODOs
2019-09-14 12:03:10 +03:00
Alexander Krotov
0f67b16f29
Return bool from add_contact_to_chat_ex
2019-09-14 12:03:10 +03:00