add decision- and blocking-functions to repl, cleanup (#2258)

* deprecate mostly unused dc_get_blocked_cnt() api

instead, the size returned by get_blocked_contacts() should be checked,
this is safer and allows easier adaption of blocking rules.

ui or python seems not to use dc_get_blocked_cnt(),
however, there is one test in node,
therefore, the function will continue working for now
(by just returning Contact::get_all_blocked().len() then)

* add decision api to repl tool

* add block/unblock api to repl tool

* unify usage of @deprecated doxygen command
This commit is contained in:
bjoern
2021-02-22 14:58:49 +01:00
committed by GitHub
parent 6792523fcd
commit 6d93d7af63
5 changed files with 52 additions and 35 deletions

View File

@@ -674,18 +674,6 @@ impl Contact {
Ok(ret)
}
pub async fn get_blocked_cnt(context: &Context) -> usize {
context
.sql
.query_get_value::<isize>(
context,
"SELECT COUNT(*) FROM contacts WHERE id>? AND blocked!=0",
paramsv![DC_CONTACT_ID_LAST_SPECIAL as i32],
)
.await
.unwrap_or_default() as usize
}
/// Get blocked contacts.
pub async fn get_all_blocked(context: &Context) -> Vec<u32> {
context