link2xt
47a6e31047
fix: allow emojis for location markers
...
is_marker() should check for length in characters,
not bytes.
This was broken during the Rust translation
in changeset a5553f98af
2021-01-28 00:56:35 +03:00
Floris Bruynooghe
355e0145c0
Depend on anyhow directly
...
This removes the proxy via crate::error to depend on anyhow directly.
There is no benefit to this indirection and this makes it simpler to
see which error types are used.
2021-01-24 17:29:52 +03:00
Alexander Krotov
5e8e77dfb6
clippy: forbid wildcard_imports
2021-01-12 12:06:13 +03:00
Floris Bruynooghe
ee27c7d9d4
Run clippy on tests and examples
2020-09-05 18:13:16 +02:00
Alexander Krotov
6eef4066db
Do not restrict message.kml coordinates precision
...
Using only two digits results in visible difference between original
location and location received by other users.
2020-08-27 11:19:08 +03:00
dignifiedquire
1ae49c1fca
unify events
2020-08-10 10:32:48 +02:00
Floris Bruynooghe
9d7b756ddb
Unify some testing interfaces
...
This tidies up our testing tools a little bit. We had several
functions which through various changes ended up doing the same and
some more which did very similar stuff, so I merged them to have
things simpler. Also moved towards methods on the TestContext struct
while cleaning this up anyway, seems like this structure is going to
stay around for a bit anyway.
The intersting change is in `test_utils.rs`, everything else is just
updating callers. A few tests used example.org which I moved to
example.com to be able to re-use more configuration of the test
context.
2020-06-20 14:37:41 +02:00
dignifiedquire
baff13ecab
fix warnings and bugs, noticed on nightly
2020-06-17 19:27:27 +02:00
dignifiedquire
0ea442ca36
feat: add chat::send_msg_sync
2020-05-23 18:56:45 +02:00
Friedel Ziegelmayer
014d2946b2
feat: use EventEmitter for events
2020-05-22 21:03:01 +02:00
dignifiedquire
71f7a3e902
avoid clone
2020-05-19 18:07:04 +02:00
dignifiedquire
8a7923c974
Merge remote-tracking branch 'origin/master' into feat/async-jobs
2020-05-13 18:29:22 +02:00
Alexander Krotov
db5b5d321b
clippy: remove redundant imports
2020-04-13 23:02:57 +03:00
Alexander Krotov
324e5d0258
Use slice pattern to parse KML coordinates
2020-04-13 23:02:57 +03:00
Friedel Ziegelmayer
24f4cbbb27
refactor: replace failure
...
- failure is deprecated
- thiserror for deriving Error impl
- anyhow for highlevel error handling
2020-04-10 22:39:28 +02:00
dignifiedquire
4c9d049b10
blocking for with_conn
2020-03-14 15:17:47 +01:00
dignifiedquire
818e921192
it compiles
2020-03-14 15:17:47 +01:00
dignifiedquire
6ea1d665bb
start making sql async
2020-03-14 15:17:23 +01:00
dignifiedquire
9614a23506
first pass at async job
2020-03-14 15:14:49 +01:00
Alexander Krotov
508b8ef2e2
Improve documentation, mostly by hiding behind pub(crate)
2020-02-20 23:37:13 +03:00
Alexander Krotov
672fe2dfd7
Parse KML without converting to UTF-8 and back to bytes
2020-02-14 22:34:41 +01:00
Floris Bruynooghe
186f5553b8
Introduce a ChatId newtype
...
This doesn't try and change the way ChatId is used. It still allows
creating them with 0 and lets some function use a ChatId(0) as error
return.
2020-01-19 23:42:08 +01:00
Alexander Krotov
25842894d2
Rename job::Try into job::Status
2019-12-28 14:35:14 +00:00
Alexander Krotov
83c98c2d55
Replace unstable try_trait with a job_try! macro
2019-12-28 14:35:14 +00:00
Alexander Krotov
fe2011742d
Job error handling refactoring
2019-12-28 14:35:14 +00:00
dignifiedquire
db88212a64
refactor: unsafe, CStr and libc moved out
2019-12-03 12:25:22 +01:00
dignifiedquire
dbd6303829
remove mmime
2019-12-03 12:22:55 +01:00
Alexander Krotov
ee18d60644
cargo fmt
2019-12-01 21:01:03 +01:00
Alexander Krotov
612600278a
Move SQL errors into their own module
2019-12-01 21:01:03 +01:00
holger krekel
f87cb4231c
rename jobs to make "rg Markseen" and other searches for the job enum produce all places dealing with the enum
2019-11-28 19:42:24 +01:00
Nico de Haen
d7c42f3c98
Use coalesce for optional columns
...
resolves #851
2019-11-17 20:57:50 +01:00
Alexander Krotov
f778957caf
Improve documentation and comments
2019-11-16 13:53:47 +01:00
B. Petersen
be08bcb22b
rename DC_CONTACT_ID_DEVICE to DC_CONTACT_ID_INFO to be in-line with dc_msg_is_info()
2019-11-06 13:33:30 +01:00
Alexander Krotov
51a804a80f
location: use "bool" for "independent" argument
2019-11-06 14:17:59 +03:00
B. Petersen
8c2efa707a
name special contact-ids where easily possible
...
the point of this pr is to get an overview
how and where DC_CONTACT_ID_DEVICE is used,
to prepare introducing a device-"chat".
i did not change the sql statements for now
as this would require some more refactoring
and has the potential to introduce bugs.
2019-11-04 13:20:35 +01:00
holger krekel
c5f64d2988
address @link2xt comments
2019-11-03 00:21:27 +01:00
holger krekel
d774430ec2
simplify location parsing
2019-11-03 00:21:27 +01:00
holger krekel
d74c70a57c
fix and streamline location-outgoing pipeline
2019-11-03 00:21:27 +01:00
Floris Bruynooghe
c8d296ea0e
A MsgId newtype
...
This more strongly types the ubiquitous message id type by no longer
making it an integer. It keeps the actual ID opaque. Only for the
generic job API the number keeps being used. Some locations also need
to create it from an integer and call MsgId::new().
2019-10-29 15:30:53 +01:00
Alexander Krotov
6ac4384769
location.rs cleanup
...
Use constants where possible, move "let" closer to assignments.
2019-10-27 11:51:35 +01:00
Alexander Krotov
cfa69cf35a
Add Params::set_cmd and use SystemMessage constants
2019-10-26 14:04:08 +02:00
Alexander Krotov
bed14d5c02
Initialize continue_streaming with false
...
Otherwise this variable is constant.
2019-10-22 13:24:23 +03:00
Alexander Krotov
d3c831a0a2
Replace continue_streaming int with bool
2019-10-22 13:24:23 +03:00
Alexander Krotov
0007c12dea
Replace FORCE_SCHEDULE #define from C core with bool
2019-10-22 13:24:23 +03:00
Dmitry Bogatov
a9dd78f622
Narrow return type of location::set: cint -> bool
2019-10-19 22:38:43 +02:00
Dmitry Bogatov
2d0f563dfe
Replace magic constant with symbolic name
2019-10-15 13:45:08 +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
B. Petersen
c6b2d640ae
prefer context.get_config() over context.sql.get_config() as the latter does not handle default values.
2019-10-03 17:15:40 +02:00
Alexander Krotov
130d485cac
Fix some clippy warnings
2019-10-03 14:30:40 +02:00
dignifiedquire
1265016a55
refactor(message): rustiy api
2019-09-21 16:37:19 +02:00