dignifiedquire
1a1f0c0a7c
refactor(e2ee): rename dc_e2ee -> e2ee
2019-09-03 19:05:21 +02:00
dignifiedquire
3944592c09
refactor(e2ee): restructure types a and method slightly
2019-09-03 19:05:21 +02: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
Dmitry Bogatov
2fe07e86c7
Replace explicit casts from 0 to pointer with std::ptr::null
2019-08-27 21:22:03 +00:00
Dmitry Bogatov
22c1b34ebf
Remove 'unsafe' qualifier of dc_mimeparser_new()
2019-08-27 22:20:45 +02:00
Dmitry Bogatov
eca11a74d7
Change type of dc_mimepart_t.msg to Option<String>
2019-08-27 22:20:45 +02:00
Dmitry Bogatov
b3df24d188
Make dc_mimeparser_is_mailinglist_message() return bool, not int
2019-08-27 22:20:45 +02:00
Dmitry Bogatov
6fcd6419bd
Use named MAILMIME_* constants instead of numeric values
2019-08-27 22:20:45 +02:00
Dmitry Bogatov
edb0fa17af
Make dc_mimeparser::reconcat_mime() safe
2019-08-27 22:20:45 +02:00
Dmitry Bogatov
86eb9cc058
Change type of `dc_mimeparser_t.type_0' to constants::Viewtype
...
Adjust use sites accordingly.
2019-08-27 22:20:45 +02:00
Dmitry Bogatov
47c0526026
Avoid separate declaration and definition of `need_drop' variable
2019-08-27 22:20:45 +02:00
Dmitry Bogatov
f5416b1c2c
Drop deprecated S_GENERATE_COMPOUND_MSGS flag
...
There is no code that modifies this flag anyway.
2019-08-27 22:20:45 +02:00
Dmitry Bogatov
a9f42f7a9e
dc_mimeparser_parse(): avoid mutability of `has_setup_file' variable
2019-08-27 22:20:45 +02:00
Dmitry Bogatov
7650e1c7df
Narrow type of dc_mimeparser_t.is_send_by_messenger to bool
2019-08-27 22:20:45 +02:00
Dmitry Bogatov
0de76d6d3f
dc_mimeparser_parse(): simplify conditional expression
2019-08-27 22:20:45 +02: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
d25d839d6a
refactor(location): more rusty api
2019-08-26 21:29:40 +02:00
dignifiedquire
23d49560bf
refactor(location): rename module dc_location -> location
2019-08-26 21:09:40 +02:00
dignifiedquire
bb16849eef
refactor(location): remove most unsafe usage
2019-08-26 21:07:53 +02:00
Dmitry Bogatov
d7d7147549
refactor: make dc_dehtml() function safe
...
* Make dc_dehtml() function safe
* Change type of is_msgrmsg parameter to bool
* Narrow type of local variable in simplify_plain_text()
* Export less fields of `Simplify' record
* Demote is_cut_* from fields of `Simplify' to local variables
* Refactor part of simplify_plain_text()
Refactor footer ("-- " and similar) code into separate function,
and re-implement it with standard Rust string methods.
It simplifies code and allows removing one mutable local variable.
* Replace dc_split_into_lines with String.split()
* src/dc_simplify.rs(find_message_footer): adjust type signature to accept
slice of &str, not slice of pointers
* src/dc_simplify.rs(simplify_plain_text): adjust code to use '==' operator
instead of strcmp(3).
* src/dc_simplify.rs(is_empty_line, is_quoted_headline, is_plain_quote):
+ adjust type signatures to accept &str, not 'const char *'
+ remove no longer needed 'unsafe' qualifier
* src/dc_tools(dc_split_into_lines, dc_free_splitted_lines): remove no longer
used functions.
In addition to additional type-safety, this change reduces number of
allocations: String.split returns iterator of &str.
* Make simplify_plain_text() safe
* Make Simplify.simplify return String, not pointer
* Refactor Simplify.simplify to use String methods, not pointers
* Make Simplify.simplify() safe
* Avoid neeless allocation in Simplify.simplify when input is html
* Add tests for simplify utilities
* Document discussion about is_empty_line() discussion
2019-08-26 17:15:14 +02:00
holger krekel
799d362654
cargo fmt
2019-08-18 12:44:03 +02:00
holger krekel
64beb17fa6
subst current_blocks with ok_to_continue
2019-08-18 12:44:03 +02:00
Dmitry Bogatov
7c7a1b64df
Remove dead code
2019-08-16 04:46:20 +00:00
Dmitry Bogatov
ea661896a1
Do not export more than strictly necessary
2019-08-16 04:46:20 +00:00
dignifiedquire
712f5a9782
refactor(tools): cleanup and make clippy a little happier
...
Uses a crate now for extracing image meta data, instead of our own hand rolled code.
2019-08-15 11:26:32 +02:00
Dmitry Bogatov
8342b29618
Fix some clippy warnings
2019-08-14 01:45:39 +02:00
Friedel Ziegelmayer
ed237c8d25
refactor(receive_imf): first pass at some more sanity
2019-08-13 17:58:32 +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
Alexander Krotov
64051fca10
Rename dc_simplify_t into Simplify
2019-08-09 16:57:14 +02:00
dignifiedquire
6772d6f66c
fix: improve some string handling in the message recieve path
2019-08-09 11:32:24 +02: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
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
Alexander Krotov
8267ffb8d2
Replace dc_mimeparser_t::reports carray with Vec
2019-07-31 15:57: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
Friedel Ziegelmayer
188da2a020
refactor(params): rustify
2019-07-29 01:49:53 +02:00
Dmitry Bogatov
669ed0e0df
Override non_camel_case_types warning on per-declaration basis
2019-07-28 22:44:21 +02:00
Dmitry Bogatov
c6ccfd824e
Override `non_shake_case' warning on per-function basis
...
This change removes global override of `non_shake_case' warning and replaces it
with per-function overrrides. This way, compiler will complain about style
guide violation in new code.
It should be noted, that `rustc' is not smart enough to emit warning when
override is no longer needed, it must be checked manually.
2019-07-28 22:44:21 +02:00
Dmitry Bogatov
39cc93240f
Fix 'non_upper_case_globals' compiler warnings
2019-07-28 22:44:21 +02:00
Floris Bruynooghe
4902310138
Make stock strings rusty
...
This converts the stock strings API to be more safe-rust style. The
API is kept roughly the same for now but moved to methods on the
context.
2019-07-27 12:37:22 +02:00
Alexander Krotov
c7ebf6de09
cargo fmt
2019-07-25 23:32:17 +02:00
Alexander Krotov
2f204fd2aa
Simplify dc_simplify_t implementation
...
- Replace dc_simplify_new and dc_simplify_unref with ::new()
- Move dc_simplify_simplify and dc_simplify_simplify_plain_text into impl
2019-07-25 23:32:17 +02:00
Alexander Krotov
ec6cc5c355
Allocate dc_kml_t in a rusty way
2019-07-25 22:41:33 +02:00
holger krekel
6a956b6008
Merge branch 'master' into flub-param-names
2019-07-22 00:36:52 +02:00
holger krekel
8089559958
Squashed commit of the following:
...
commit 6bc5d1b90e
Author: holger krekel <holger@merlinux.eu >
Date: Sun Jul 21 22:56:37 2019 +0200
fix fmt
commit 197d94ad9d
Merge: 7ce337c 686678c
Author: holger krekel <holger@merlinux.eu >
Date: Sun Jul 21 22:51:16 2019 +0200
Merge remote-tracking branch 'origin/master' into eventlogging
commit 7ce337c6d0
Author: holger krekel <holger@merlinux.eu >
Date: Sun Jul 21 22:44:27 2019 +0200
left-over error logging
commit 10148d2e43
Author: holger krekel <holger@merlinux.eu >
Date: Sun Jul 21 22:03:17 2019 +0200
ignore non-utf8 parts of header fields (add comment why it shouldn't happen)
don't throw error if no sql rows are returned
commit 69dc237ee3
Author: dignifiedquire <dignifiedquire@users.noreply.github.com >
Date: Sun Jul 21 12:56:04 2019 +0200
fix(receive_imf): remove recursive sql call
commit df5464ea80
Author: dignifiedquire <dignifiedquire@users.noreply.github.com >
Date: Sat Jul 20 17:05:24 2019 +0200
fix: blocked is an optional value
commit e4bf9956a5
Author: dignifiedquire <dignifiedquire@users.noreply.github.com >
Date: Sat Jul 20 16:50:56 2019 +0200
fix(msg): handle optional in_reply_to
commit d353d9d9d8
Author: dignifiedquire <dignifiedquire@users.noreply.github.com >
Date: Sat Jul 20 16:17:25 2019 +0200
fix(chat): remove recursive sql usage
commit 1ad45ed4d6
Author: holger krekel <holger@merlinux.eu >
Date: Sat Jul 20 15:14:11 2019 +0200
fix rust fmt
commit 496e980a17
Author: dignifiedquire <dignifiedquire@users.noreply.github.com >
Date: Sat Jul 20 14:34:20 2019 +0200
use forked rusqlite
commit fa09e46ed9
Author: holger krekel <holger@merlinux.eu >
Date: Sat Jul 20 12:37:51 2019 +0200
another pace where we might (and in my case did) get invalid utf8
commit d6de420b9a
Author: holger krekel <holger@merlinux.eu >
Date: Sat Jul 20 12:30:48 2019 +0200
fix some string issues, introduce to_string_lossy such that to_string() continues to panic on non-utf8
commit 38eb708db8
Author: holger krekel <holger@merlinux.eu >
Date: Sat Jul 20 01:17:53 2019 +0200
for now make to_string() less strict as we often don't want to crash the whole app just because some non-proper utf8 came in (through a message we can't neccesarily congtrol)
commit 7a59da5f8f
Author: holger krekel <holger@merlinux.eu >
Date: Fri Jul 19 22:48:39 2019 +0200
fix linting
commit f13a1d4a2f
Author: holger krekel <holger@merlinux.eu >
Date: Fri Jul 19 22:46:58 2019 +0200
fix some test flakyness
commit 7b3a450918
Author: holger krekel <holger@merlinux.eu >
Date: Fri Jul 19 22:35:07 2019 +0200
- fix saved_mime test which broke to improper conversion of
imf_raw_not_terminated
- some cargo.toml updates no clue where they come from
- log Message-ID for received messages
commit 169923b102
Author: holger krekel <holger@merlinux.eu >
Date: Fri Jul 19 12:31:22 2019 +0200
formatting
commit 42688a0622
Author: holger krekel <holger@merlinux.eu >
Date: Fri Jul 19 12:24:56 2019 +0200
remove some print statements
commit 35f3c0edd1
Merge: e7a2362 f58b1d6
Author: holger krekel <holger@merlinux.eu >
Date: Fri Jul 19 10:25:21 2019 +0200
Merge branch 'master' into eventlogging
commit e7a236264a
Author: dignifiedquire <dignifiedquire@users.noreply.github.com >
Date: Thu Jul 18 23:20:20 2019 +0200
print invalid strings
commit aaa5b820d9
Author: dignifiedquire <dignifiedquire@users.noreply.github.com >
Date: Thu Jul 18 23:12:35 2019 +0200
cleanup
commit e7f0745010
Author: dignifiedquire <dignifiedquire@users.noreply.github.com >
Date: Thu Jul 18 23:03:57 2019 +0200
reduce direc usage of CString
commit c68e7ae14e
Author: dignifiedquire <dignifiedquire@users.noreply.github.com >
Date: Thu Jul 18 22:47:47 2019 +0200
audit use of to_cstring and fix ub
commit 618087e5a7
Author: dignifiedquire <dignifiedquire@users.noreply.github.com >
Date: Thu Jul 18 21:38:52 2019 +0200
fix(imap): body ptr lifetime
commit 245abb8384
Author: dignifiedquire <dignifiedquire@users.noreply.github.com >
Date: Thu Jul 18 19:44:10 2019 +0200
remove debug
commit a3e1042001
Author: dignifiedquire <dignifiedquire@users.noreply.github.com >
Date: Thu Jul 18 18:30:54 2019 +0200
fix some things, add more debugging statements
commit 7b7ce9348f
Author: holger krekel <holger@merlinux.eu >
Date: Thu Jul 18 15:11:57 2019 +0200
fix python lint issues
commit 7a4808ba0d
Author: holger krekel <holger@merlinux.eu >
Date: Thu Jul 18 14:35:54 2019 +0200
cargofmt
commit 8f240f7153
Author: holger krekel <holger@merlinux.eu >
Date: Thu Jul 18 14:03:57 2019 +0200
(dig,hpk) pull out job collection from sql query/lock logic
commit 7d0b5d8abb
Author: holger krekel <holger@merlinux.eu >
Date: Thu Jul 18 12:52:02 2019 +0200
remove print statements and fix a crash
commit ee317cb1b5
Author: holger krekel <holger@merlinux.eu >
Date: Thu Jul 18 11:38:10 2019 +0200
fix some merge issues
commit 7b736fe635
Author: holger krekel <holger@merlinux.eu >
Date: Thu Jul 18 11:16:38 2019 +0200
(dig,hpk) add test and fix for wrong dbs
commit c7db15352a
Merge: 0b37167 0c5015d
Author: holger krekel <holger@merlinux.eu >
Date: Thu Jul 18 09:59:44 2019 +0200
Merge branch 'master' into eventlogging
commit 0b37167be8
Author: holger krekel <holger@merlinux.eu >
Date: Thu Jul 18 00:06:05 2019 +0200
address @dignifiedquire comments
commit 5cac4b5076
Author: holger krekel <holger@merlinux.eu >
Date: Wed Jul 17 12:47:22 2019 +0200
remove spurious print
commit 475a41beb3
Author: holger krekel <holger@merlinux.eu >
Date: Wed Jul 17 12:31:12 2019 +0200
address @dignifiedquire rustyness comment and fix changelog
commit ad4be80b4e
Author: holger krekel <holger@merlinux.eu >
Date: Wed Jul 17 10:25:25 2019 +0200
make smtp/imap connect() return bool instead of c-int
commit 8737c1d142
Author: holger krekel <holger@merlinux.eu >
Date: Wed Jul 17 09:26:33 2019 +0200
cleanup some parts, add comments
commit 964fe466cc
Author: holger krekel <holger@merlinux.eu >
Date: Tue Jul 16 20:05:41 2019 +0200
wip-commit which passes all tests with proper finalization
commit 43936e7db7
Author: holger krekel <holger@merlinux.eu >
Date: Tue Jul 16 16:17:42 2019 +0200
snapshot of my current debugging state
commit 0e80ce9c39
Author: holger krekel <holger@merlinux.eu >
Date: Tue Jul 16 12:57:19 2019 +0200
more aggressively skip perform API when threads are closing
commit c652bae68a
Author: holger krekel <holger@merlinux.eu >
Date: Tue Jul 16 12:06:05 2019 +0200
intermediate wip commit
commit bc904a495d
Author: holger krekel <holger@merlinux.eu >
Date: Tue Jul 16 11:18:56 2019 +0200
add some logging, and a more precise teardown for online python tests
commit 8d99444c6a
Author: holger krekel <holger@merlinux.eu >
Date: Tue Jul 16 00:22:12 2019 +0200
fix std
commit 9dab53e0af
Author: holger krekel <holger@merlinux.eu >
Date: Tue Jul 16 00:20:54 2019 +0200
rustfmt
commit 360089ac74
Author: holger krekel <holger@merlinux.eu >
Date: Tue Jul 16 00:03:49 2019 +0200
remove some debugging
commit e892c5cf4d
Author: holger krekel <holger@merlinux.eu >
Date: Mon Jul 15 23:31:30 2019 +0200
fix test for events
commit 9ad4c9a6fe
Author: holger krekel <holger@merlinux.eu >
Date: Mon Jul 15 22:51:57 2019 +0200
wip try test that we see INFO events from the core
2019-07-21 23:31:14 +02:00
Alexander Krotov
686678c96c
Spellcheck
2019-07-21 21:40:19 +02:00