Commit Graph

200 Commits

Author SHA1 Message Date
holger krekel
04ee9dde2c Merge pull request #181 from deltachat/improve_receive_imf1
improve dc_receive_imf and friends a little (part 1)
2019-07-10 19:54:22 +02:00
holger krekel
669476afd3 fix comment 2019-07-10 12:06:59 +02:00
holger krekel
b810b5a8f8 other cast as per @dignifiedquire comment -- also convert some logging along the way 2019-07-10 11:54:29 +02:00
holger krekel
6d17de05b2 also convert lookup_field function to use a &str param isntead of char* 2019-07-10 11:43:16 +02:00
holger krekel
e3fb0a23c6 get rid of c version of dc_mimeparser_lookup_field completely 2019-07-10 11:32:50 +02:00
Floris Bruynooghe
4c646dc1e0 Rename dc_chat_t to Chat
This clears the way to start working on making the functions safe.
But small PRs are good PRs so let's get this rename out of the way and
have future PRs less noisy.

Also stop making this #[repr(C)] and start making fields that are not
used private. Lastly clean up some comments by moving them or
deleting them, so they make sense again after the translation.
2019-07-09 21:46:31 +02:00
holger krekel
d67dd9cc33 convert another carray 2019-07-09 21:04:23 +02:00
holger krekel
b93f5aa0b6 minimize casting 2019-07-09 20:55:29 +02:00
holger krekel
6c4b9e79c7 convert created_db_entries into a Rust vector instead of using low-level carray 2019-07-09 19:31:51 +02:00
holger krekel
95437d726e some streamlinings, after advise by @dignifedquire 2019-07-09 17:39:05 +02:00
Floris Bruynooghe
816fa1df9b test: ignore expensive tests by default
This makes interactively running the tests a much more pleasant
experience rather than something one dreads.  These tests will still
be run on the CI.  To run these manually run:

cargo test [TESTNAME] -- --ignored
2019-07-09 13:36:16 +02:00
holger krekel
c2ca30cc16 fix #176 by transforming unsafe dc_log_info calls -- i think the unsafe
referencing via &jobthread.name was the culprit but not sure ;)
2019-07-06 22:26:26 +02:00
holger krekel
692b779896 Merge pull request #173 from deltachat/actests
test and fix Autocrypt Setup Message flow
2019-07-06 12:32:56 +02:00
dignifiedquire
184b3c8e91 undo version bump 2019-07-06 11:30:45 +02:00
holger krekel
2aa81a7a9a speed up test teardown by now waiting for threads to finish ...
and remove a debug statement
2019-07-05 23:12:11 +02:00
Hocuri
f671b25cbc refactor: make dc_jobthread_t safe 2019-07-05 21:17:57 +02:00
holger krekel
3d7be47adf fix rust format 2019-07-05 20:05:08 +02:00
holger krekel
27c8bb64c8 remove some debuging 2019-07-05 19:26:40 +02:00
dignifiedquire
4c95664992 fix and improve key import 2019-07-05 19:12:08 +02:00
holger krekel
f7d13fd12f comment on when it passes 2019-07-05 16:32:26 +02:00
holger krekel
35248296af some refinements, bump versions already 2019-07-05 16:23:33 +02:00
holger krekel
dfa2fcda73 use safe logging, and add some info on the processed key (this is WIP and needs to be removed) 2019-07-05 13:04:26 +02:00
holger krekel
6e13e177f7 fixed logging, removed one more "old" style logging 2019-07-04 11:16:15 +02:00
holger krekel
799ba8a5db fix rust-formatting 2019-07-03 20:38:17 +02:00
holger krekel
4378608617 convert some log infos and guard bindings against some misuse 2019-07-03 20:17:35 +02:00
holger krekel
adcb9d6069 fixed: make export/import work with blob-files again
also add some more logging.
2019-07-03 20:02:05 +02:00
holger krekel
08bade2c7c fix fmt 2019-07-02 08:36:15 +02:00
holger krekel
2c26f4f2ab convert the last two unsafe event emissions in smtp.rs 2019-07-02 01:45:48 +02:00
holger krekel
7a053b9f93 add SMTP_CONNECTED and IMAP_CONNECTED events 2019-07-01 22:27:44 +02:00
holger krekel
183a49eca0 remove superflous debug attempts 2019-07-01 20:11:35 +02:00
holger krekel
384822b5eb replace unsafe use of dc logging with info! macro as per advise from @flub 2019-07-01 18:57:37 +02:00
holger krekel
06e16c81f9 Wip 2019-07-01 18:06:16 +02:00
Floris Bruynooghe
6ccc75b1ed Arbitrarily bump the version
This allows me to create a new tag and play wity building flatpak
builds for this tag.
2019-06-30 19:48:44 +02:00
Floris Bruynooghe
f8d428c308 Make the SQLite struct opaque
With the API changes already done, notably .is_open(), the
implementation of the sqlite can and should now be private.

This also doesn't need to be #[repr(C)] anymore since the C API does
not need to access the fields in the struct.
2019-06-18 23:20:01 +02:00
Floris Bruynooghe
a6102d1039 Refactor the internal sql interface somewhat
Experiment with refactoring the internal sql interface a bit.  My
original goal was to modify the schema and thus refactor to a state
where it would be sane to write tests for dc_sqlite_open() (and/or
however it ends up refactored) to assert schame changes before/after.
2019-06-17 22:31:36 +02:00
Floris Bruynooghe
db9bc15d3e Make the callback optional again
The C API allows passing a NULL pointer is for the callback function.
However when calling the callback nothing checks for this null pointer
and thus things fail badly.  Even worse since the C API is defined
using an "fn pointer" rather than a "*-ptr" or raw pointer to the
function rust does not realise this can be invalid and therefore the
typechecker does not catch this even though there are no unsafe casts.

Fix this by making the callback an Option in rust, this can be easily
checked when calling.  Also add a Context.call_cb() function which
simplifies calling the callback, hides the weird syntax due to the
function pointer and makes the call a little easier.  Finally it also
means the option checking is only needed in one place.

For the C API this needs to check if this is a NULL pointer or not,
this is implicitly done by rust using the "nullable pointer
optimisation":
https://doc.rust-lang.org/nomicon/ffi.html#the-nullable-pointer-optimization
2019-06-17 20:06:15 +02:00
Floris Bruynooghe
dc0de47b4b Clean up some warnings and use newer nightly compiler
This stops using the deprecated libc::uint32_t and libc::uint64_t
types in favour of the native u32 and u64 types.

It also uses a newer nightly compiler to get rid of the incorrect
"unused no_mangle" warning when compiling incrementally.

Finally the newer compiler prefers us to be explicit when implementing
traits using the new dyn keyword.
2019-06-16 15:32:15 +02:00
Friedel Ziegelmayer
af8d056206 refactor: remove dc-strbuilder 2019-06-08 17:13:25 +02:00
Friedel Ziegelmayer
4e41dbf5ab refactor: reduce dependencies on libc 2019-06-08 17:13:05 +02:00
Floris Bruynooghe
0bce754adf Merge pull request #134 from flub/as_str
Rename to_str() -> as_str() to match stdlib naming convention
2019-06-08 10:57:24 +02:00
Lars-Magnus Skog
a32a275d73 feat: Add utility to convert OsStr to CString (#136)
* Add utility to convert OsStr to CString

This is approach seems acceptable in the context of deltachat, it
should work correctly on unix and on Windows requires paths to be
valid utf-8.

* Use failure crate for error types

* Add OsStrExt impl for Path, fix windows and update docs

- Adds an OsStrExt impl for Path directly, a little more convenience.

- Fix the windows code to actually use the right function name.  Test
  the impl function on unix too since that was the point of having it
  implemented in a separate function to begin with.

- Improve the docs, do hyperlinks a bit better.

* Another attempt at learing to type

Having your compiler in the cloud is just painful.

* Do not treat this as a fatal error

When PRs are made from forks the passwords are unavailable.  We don't
want CI to fail because of this.

* Implement using the AsRef<OsStr> trait

This means any type with implements this trait will get this
implementation, thus covering both OsStr and Path instead of having
duplicate implementations for those like before.

* fix format
2019-06-08 03:04:30 +02:00
Friedel Ziegelmayer
02e7dc022b feat: remove compile date
It has few use only and the problem to stand in the way of reproducible builds.
2019-06-07 22:41:48 +02:00
Floris Bruynooghe
855c7844b5 Rename to_str() -> as_str() to match stdlib naming convention
The function does a cast and does not create a new objects.  The
stdlib convention is to use to_*() for functions which return new
objects and as_*() for functions which keep referring to the same data
but using a different type.  Follow that convention.
2019-06-07 22:19:39 +02:00
Lars-Magnus Skog
18c0d9f83b chore: update version to 1.0.0-alpha.0 2019-06-07 13:36:15 +02:00
björn petersen
f5683f1fec fix: remove unneeded string duplication before passing to the callback 2019-06-07 13:34:00 +02:00
B. Petersen
99682f9569 remove compile date: it has few use only and the problem to stand in the way of reproducible builds 2019-06-06 15:15:38 +02:00
dignifiedquire
dc7d23ec47 fix(x): do not enforce valid utf8 in strndup
Closes #112
2019-06-06 13:13:16 +02:00
dignifiedquire
983ccaaccd feat(examples): refactor repl to use rustyline and safe rust 2019-06-06 13:13:16 +02:00
dignifiedquire
95d4df6027 refactor: reduce dependencies on libc 2019-06-05 00:56:59 +02:00
dignifiedquire
f4b68236fe refactor(context): simpler info formatting 2019-06-01 17:30:34 +02:00