Skip to content

Commit 37dc1f5

Browse files
committed
api!: deprecate DC_GCL_VERIFIED_ONLY
1 parent a68ddab commit 37dc1f5

File tree

8 files changed

+11
-33
lines changed

8 files changed

+11
-33
lines changed

deltachat-ffi/deltachat.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2132,7 +2132,10 @@ uint32_t dc_lookup_contact_id_by_addr (dc_context_t* context, const char*
21322132
uint32_t dc_create_contact (dc_context_t* context, const char* name, const char* addr);
21332133

21342134

2135-
#define DC_GCL_VERIFIED_ONLY 0x01
2135+
2136+
// Deprecated 2025-05-20, setting this flag is a no-op.
2137+
#define DC_GCL_DEPRECATED_VERIFIED_ONLY 0x01
2138+
21362139
#define DC_GCL_ADD_SELF 0x02
21372140

21382141

@@ -2194,8 +2197,6 @@ dc_array_t* dc_import_vcard (dc_context_t* context, const char*
21942197
* @param context The context object.
21952198
* @param flags A combination of flags:
21962199
* - if the flag DC_GCL_ADD_SELF is set, SELF is added to the list unless filtered by other parameters
2197-
* - if the flag DC_GCL_VERIFIED_ONLY is set, only verified contacts are returned.
2198-
* if DC_GCL_VERIFIED_ONLY is not set, verified and unverified contacts are returned.
21992200
* @param query A string to filter the list. Typically used to implement an
22002201
* incremental search. NULL for no filtering.
22012202
* @return An array containing all contact IDs. Must be dc_array_unref()'d

deltachat-repl/src/cmdline.rs

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1162,17 +1162,8 @@ pub async fn cmdline(context: Context, line: &str, chat_id: &mut ChatId) -> Resu
11621162
let reaction = arg2;
11631163
send_reaction(&context, msg_id, reaction).await?;
11641164
}
1165-
"listcontacts" | "contacts" | "listverified" => {
1166-
let contacts = Contact::get_all(
1167-
&context,
1168-
if arg0 == "listverified" {
1169-
DC_GCL_VERIFIED_ONLY | DC_GCL_ADD_SELF
1170-
} else {
1171-
DC_GCL_ADD_SELF
1172-
},
1173-
Some(arg1),
1174-
)
1175-
.await?;
1165+
"listcontacts" | "contacts" => {
1166+
let contacts = Contact::get_all(&context, DC_GCL_ADD_SELF, Some(arg1)).await?;
11761167
log_contactlist(&context, &contacts).await?;
11771168
println!("{} contacts.", contacts.len());
11781169
}

deltachat-rpc-client/src/deltachat_rpc_client/account.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -211,21 +211,18 @@ def get_chat_by_contact(self, contact: Union[int, Contact]) -> Optional[Chat]:
211211
def get_contacts(
212212
self,
213213
query: Optional[str] = None,
214+
*,
214215
with_self: bool = False,
215-
verified_only: bool = False,
216216
snapshot: bool = False,
217217
) -> Union[list[Contact], list[AttrDict]]:
218218
"""Get a filtered list of contacts.
219219
220220
:param query: if a string is specified, only return contacts
221221
whose name or e-mail matches query.
222222
:param with_self: if True the self-contact is also included if it matches the query.
223-
:param only_verified: if True only return verified contacts.
224223
:param snapshot: If True return a list of contact snapshots instead of Contact instances.
225224
"""
226225
flags = 0
227-
if verified_only:
228-
flags |= ContactFlag.VERIFIED_ONLY
229226
if with_self:
230227
flags |= ContactFlag.ADD_SELF
231228

deltachat-rpc-client/src/deltachat_rpc_client/const.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
class ContactFlag(IntEnum):
99
"""Bit flags for get_contacts() method."""
1010

11-
VERIFIED_ONLY = 0x01
1211
ADD_SELF = 0x02
1312

1413

python/src/deltachat/account.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -355,20 +355,16 @@ def get_contacts(
355355
self,
356356
query: Optional[str] = None,
357357
with_self: bool = False,
358-
only_verified: bool = False,
359358
) -> List[Contact]:
360359
"""get a (filtered) list of contacts.
361360
362361
:param query: if a string is specified, only return contacts
363362
whose name or e-mail matches query.
364-
:param only_verified: if true only return verified contacts.
365363
:param with_self: if true the self-contact is also returned.
366364
:returns: list of :class:`deltachat.contact.Contact` objects.
367365
"""
368366
flags = 0
369367
query_c = as_dc_charpointer(query)
370-
if only_verified:
371-
flags |= const.DC_GCL_VERIFIED_ONLY
372368
if with_self:
373369
flags |= const.DC_GCL_ADD_SELF
374370
dc_array = ffi.gc(lib.dc_get_contacts(self._dc_context, flags, query_c), lib.dc_array_unref)

python/tests/test_3_offline.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,6 @@ def test_get_contacts_and_delete(self, acfactory):
184184

185185
assert not ac1.get_contacts(query="some2")
186186
assert ac1.get_contacts(query="some1")
187-
assert not ac1.get_contacts(only_verified=True)
188187
assert len(ac1.get_contacts(with_self=True)) == 2
189188

190189
assert ac1.delete_contact(contact1)

src/constants.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ pub const DC_GCL_NO_SPECIALS: usize = 0x02;
8888
pub const DC_GCL_ADD_ALLDONE_HINT: usize = 0x04;
8989
pub const DC_GCL_FOR_FORWARDING: usize = 0x08;
9090

91-
pub const DC_GCL_VERIFIED_ONLY: u32 = 0x01;
9291
pub const DC_GCL_ADD_SELF: u32 = 0x02;
9392

9493
// unchanged user avatars are resent to the recipients every some days

src/contact.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use crate::blob::BlobObject;
2525
use crate::chat::{ChatId, ChatIdBlocked, ProtectionStatus};
2626
use crate::color::str_to_color;
2727
use crate::config::Config;
28-
use crate::constants::{Blocked, Chattype, DC_GCL_ADD_SELF, DC_GCL_VERIFIED_ONLY};
28+
use crate::constants::{Blocked, Chattype, DC_GCL_ADD_SELF};
2929
use crate::context::Context;
3030
use crate::events::EventType;
3131
use crate::key::{load_self_public_key, DcKey, SignedPublicKey};
@@ -1041,9 +1041,8 @@ impl Contact {
10411041
///
10421042
/// `listflags` is a combination of flags:
10431043
/// - if the flag DC_GCL_ADD_SELF is set, SELF is added to the list unless filtered by other parameters
1044-
/// - if the flag DC_GCL_VERIFIED_ONLY is set, only verified contacts are returned.
1045-
/// if DC_GCL_VERIFIED_ONLY is not set, verified and unverified contacts are returned.
1046-
/// `query` is a string to filter the list.
1044+
///
1045+
/// `query` is a string to filter the list.
10471046
pub async fn get_all(
10481047
context: &Context,
10491048
listflags: u32,
@@ -1056,14 +1055,13 @@ impl Contact {
10561055
.collect::<HashSet<_>>();
10571056
let mut add_self = false;
10581057
let mut ret = Vec::new();
1059-
let flag_verified_only = (listflags & DC_GCL_VERIFIED_ONLY) != 0;
10601058
let flag_add_self = (listflags & DC_GCL_ADD_SELF) != 0;
10611059
let minimal_origin = if context.get_config_bool(Config::Bot).await? {
10621060
Origin::Unknown
10631061
} else {
10641062
Origin::IncomingReplyTo
10651063
};
1066-
if flag_verified_only || query.is_some() {
1064+
if query.is_some() {
10671065
let s3str_like_cmd = format!("%{}%", query.unwrap_or(""));
10681066
context
10691067
.sql
@@ -1074,14 +1072,12 @@ impl Contact {
10741072
AND c.origin>=? \
10751073
AND c.blocked=0 \
10761074
AND (iif(c.name='',c.authname,c.name) LIKE ? OR c.addr LIKE ?) \
1077-
AND (1=? OR LENGTH(ps.verified_key_fingerprint)!=0) \
10781075
ORDER BY c.last_seen DESC, c.id DESC;",
10791076
(
10801077
ContactId::LAST_SPECIAL,
10811078
minimal_origin,
10821079
&s3str_like_cmd,
10831080
&s3str_like_cmd,
1084-
if flag_verified_only { 0i32 } else { 1i32 },
10851081
),
10861082
|row| {
10871083
let id: ContactId = row.get(0)?;

0 commit comments

Comments
 (0)