diff --git a/deltachat-ffi/deltachat.h b/deltachat-ffi/deltachat.h index adbf81668..b2fca4d1b 100644 --- a/deltachat-ffi/deltachat.h +++ b/deltachat-ffi/deltachat.h @@ -2132,7 +2132,10 @@ uint32_t dc_lookup_contact_id_by_addr (dc_context_t* context, const char* uint32_t dc_create_contact (dc_context_t* context, const char* name, const char* addr); -#define DC_GCL_VERIFIED_ONLY 0x01 + +// Deprecated 2025-05-20, setting this flag is a no-op. +#define DC_GCL_DEPRECATED_VERIFIED_ONLY 0x01 + #define DC_GCL_ADD_SELF 0x02 @@ -2194,8 +2197,6 @@ dc_array_t* dc_import_vcard (dc_context_t* context, const char* * @param context The context object. * @param flags A combination of flags: * - if the flag DC_GCL_ADD_SELF is set, SELF is added to the list unless filtered by other parameters - * - if the flag DC_GCL_VERIFIED_ONLY is set, only verified contacts are returned. - * if DC_GCL_VERIFIED_ONLY is not set, verified and unverified contacts are returned. * @param query A string to filter the list. Typically used to implement an * incremental search. NULL for no filtering. * @return An array containing all contact IDs. Must be dc_array_unref()'d diff --git a/deltachat-repl/src/cmdline.rs b/deltachat-repl/src/cmdline.rs index 0c51e3f31..0aceb14b8 100644 --- a/deltachat-repl/src/cmdline.rs +++ b/deltachat-repl/src/cmdline.rs @@ -1162,17 +1162,8 @@ pub async fn cmdline(context: Context, line: &str, chat_id: &mut ChatId) -> Resu let reaction = arg2; send_reaction(&context, msg_id, reaction).await?; } - "listcontacts" | "contacts" | "listverified" => { - let contacts = Contact::get_all( - &context, - if arg0 == "listverified" { - DC_GCL_VERIFIED_ONLY | DC_GCL_ADD_SELF - } else { - DC_GCL_ADD_SELF - }, - Some(arg1), - ) - .await?; + "listcontacts" | "contacts" => { + let contacts = Contact::get_all(&context, DC_GCL_ADD_SELF, Some(arg1)).await?; log_contactlist(&context, &contacts).await?; println!("{} contacts.", contacts.len()); } diff --git a/deltachat-rpc-client/src/deltachat_rpc_client/account.py b/deltachat-rpc-client/src/deltachat_rpc_client/account.py index e98c6f4e0..11d76ff04 100644 --- a/deltachat-rpc-client/src/deltachat_rpc_client/account.py +++ b/deltachat-rpc-client/src/deltachat_rpc_client/account.py @@ -211,8 +211,8 @@ class Account: def get_contacts( self, query: Optional[str] = None, + *, with_self: bool = False, - verified_only: bool = False, snapshot: bool = False, ) -> Union[list[Contact], list[AttrDict]]: """Get a filtered list of contacts. @@ -220,12 +220,9 @@ class Account: :param query: if a string is specified, only return contacts whose name or e-mail matches query. :param with_self: if True the self-contact is also included if it matches the query. - :param only_verified: if True only return verified contacts. :param snapshot: If True return a list of contact snapshots instead of Contact instances. """ flags = 0 - if verified_only: - flags |= ContactFlag.VERIFIED_ONLY if with_self: flags |= ContactFlag.ADD_SELF diff --git a/deltachat-rpc-client/src/deltachat_rpc_client/const.py b/deltachat-rpc-client/src/deltachat_rpc_client/const.py index 2ca3c9f2c..6ba25bdeb 100644 --- a/deltachat-rpc-client/src/deltachat_rpc_client/const.py +++ b/deltachat-rpc-client/src/deltachat_rpc_client/const.py @@ -8,7 +8,6 @@ COMMAND_PREFIX = "/" class ContactFlag(IntEnum): """Bit flags for get_contacts() method.""" - VERIFIED_ONLY = 0x01 ADD_SELF = 0x02 diff --git a/python/src/deltachat/account.py b/python/src/deltachat/account.py index 503462ec8..8bc199ce9 100644 --- a/python/src/deltachat/account.py +++ b/python/src/deltachat/account.py @@ -355,20 +355,16 @@ class Account: self, query: Optional[str] = None, with_self: bool = False, - only_verified: bool = False, ) -> List[Contact]: """get a (filtered) list of contacts. :param query: if a string is specified, only return contacts whose name or e-mail matches query. - :param only_verified: if true only return verified contacts. :param with_self: if true the self-contact is also returned. :returns: list of :class:`deltachat.contact.Contact` objects. """ flags = 0 query_c = as_dc_charpointer(query) - if only_verified: - flags |= const.DC_GCL_VERIFIED_ONLY if with_self: flags |= const.DC_GCL_ADD_SELF dc_array = ffi.gc(lib.dc_get_contacts(self._dc_context, flags, query_c), lib.dc_array_unref) diff --git a/python/tests/test_3_offline.py b/python/tests/test_3_offline.py index f0f3737aa..aae958216 100644 --- a/python/tests/test_3_offline.py +++ b/python/tests/test_3_offline.py @@ -184,7 +184,6 @@ class TestOfflineContact: assert not ac1.get_contacts(query="some2") assert ac1.get_contacts(query="some1") - assert not ac1.get_contacts(only_verified=True) assert len(ac1.get_contacts(with_self=True)) == 2 assert ac1.delete_contact(contact1) diff --git a/src/constants.rs b/src/constants.rs index d4a1e326f..522d67502 100644 --- a/src/constants.rs +++ b/src/constants.rs @@ -88,7 +88,6 @@ pub const DC_GCL_NO_SPECIALS: usize = 0x02; pub const DC_GCL_ADD_ALLDONE_HINT: usize = 0x04; pub const DC_GCL_FOR_FORWARDING: usize = 0x08; -pub const DC_GCL_VERIFIED_ONLY: u32 = 0x01; pub const DC_GCL_ADD_SELF: u32 = 0x02; // unchanged user avatars are resent to the recipients every some days diff --git a/src/contact.rs b/src/contact.rs index 08174f9e0..7f923348f 100644 --- a/src/contact.rs +++ b/src/contact.rs @@ -25,7 +25,7 @@ use crate::blob::BlobObject; use crate::chat::{ChatId, ChatIdBlocked, ProtectionStatus}; use crate::color::str_to_color; use crate::config::Config; -use crate::constants::{Blocked, Chattype, DC_GCL_ADD_SELF, DC_GCL_VERIFIED_ONLY}; +use crate::constants::{Blocked, Chattype, DC_GCL_ADD_SELF}; use crate::context::Context; use crate::events::EventType; use crate::key::{load_self_public_key, DcKey, SignedPublicKey}; @@ -1041,9 +1041,8 @@ impl Contact { /// /// `listflags` is a combination of flags: /// - if the flag DC_GCL_ADD_SELF is set, SELF is added to the list unless filtered by other parameters - /// - if the flag DC_GCL_VERIFIED_ONLY is set, only verified contacts are returned. - /// if DC_GCL_VERIFIED_ONLY is not set, verified and unverified contacts are returned. - /// `query` is a string to filter the list. + /// + /// `query` is a string to filter the list. pub async fn get_all( context: &Context, listflags: u32, @@ -1056,14 +1055,13 @@ impl Contact { .collect::>(); let mut add_self = false; let mut ret = Vec::new(); - let flag_verified_only = (listflags & DC_GCL_VERIFIED_ONLY) != 0; let flag_add_self = (listflags & DC_GCL_ADD_SELF) != 0; let minimal_origin = if context.get_config_bool(Config::Bot).await? { Origin::Unknown } else { Origin::IncomingReplyTo }; - if flag_verified_only || query.is_some() { + if query.is_some() { let s3str_like_cmd = format!("%{}%", query.unwrap_or("")); context .sql @@ -1074,14 +1072,12 @@ impl Contact { AND c.origin>=? \ AND c.blocked=0 \ AND (iif(c.name='',c.authname,c.name) LIKE ? OR c.addr LIKE ?) \ - AND (1=? OR LENGTH(ps.verified_key_fingerprint)!=0) \ ORDER BY c.last_seen DESC, c.id DESC;", ( ContactId::LAST_SPECIAL, minimal_origin, &s3str_like_cmd, &s3str_like_cmd, - if flag_verified_only { 0i32 } else { 1i32 }, ), |row| { let id: ContactId = row.get(0)?;