Skip to content

Commit e03e2d9

Browse files
cliffmccarthyHocuri
authored andcommitted
fix: List e-mail contacts in repl listcontacts command
- After the revisions to support key contacts, the 'listcontacts' command in the repl only lists key-contacts. A separate flag now has to be passed to Contact::get_all() to list address contacts. This makes it difficult to run the example in README.md because we need to see the new contact so we can get its ID for the next command in the example, that creates a chat by ID. - Revised 'listcontacts' command to make a second call to Contact::get_all() with the DC_GCL_ADDRESS flag, then print the e-mail contacts after the key contacts. - Revised configuration example in top-level README.md to reflect current command output. fixes #7011
1 parent 8fc6ea1 commit e03e2d9

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

README.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,26 +84,29 @@ Create a contact:
8484

8585
```
8686
> addcontact [email protected]
87-
Command executed successfully.
8887
```
8988

9089
List contacts:
9190

9291
```
9392
> listcontacts
94-
Contact#10: <name unset> <[email protected]>
95-
Contact#1: Me √√ <[email protected]>
93+
Contact#Contact#Self: Me √ <[email protected]>
94+
1 key contacts.
95+
96+
1 address contacts.
9697
```
9798

9899
Create a chat with your friend and send a message:
99100

100101
```
101102
> createchat 10
102-
Single#10 created successfully.
103-
> chat 10
104-
103+
Single#Chat#12 created successfully.
104+
> chat 12
105+
Selecting chat Chat#12
106+
Single#Chat#12: [email protected] [[email protected]] Icon: profile-db-blobs/4138c52e5bc1c576cda7dd44d088c07.png
107+
0 messages.
108+
81.252µs to create this list, 123.625µs to mark all messages as noticed.
105109
> send hi
106-
Message sent.
107110
```
108111

109112
List messages when inside a chat:

deltachat-repl/src/cmdline.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1151,7 +1151,10 @@ pub async fn cmdline(context: Context, line: &str, chat_id: &mut ChatId) -> Resu
11511151
"listcontacts" | "contacts" => {
11521152
let contacts = Contact::get_all(&context, DC_GCL_ADD_SELF, Some(arg1)).await?;
11531153
log_contactlist(&context, &contacts).await?;
1154-
println!("{} contacts.", contacts.len());
1154+
println!("{} key contacts.", contacts.len());
1155+
let addrcontacts = Contact::get_all(&context, DC_GCL_ADDRESS, Some(arg1)).await?;
1156+
log_contactlist(&context, &addrcontacts).await?;
1157+
println!("{} address contacts.", addrcontacts.len());
11551158
}
11561159
"addcontact" => {
11571160
ensure!(!arg1.is_empty(), "Arguments [<name>] <addr> expected.");

0 commit comments

Comments
 (0)