Last active
October 21, 2020 19:34
-
-
Save r10s/50b4c95acb85ca02ec2aebed5a94f04c to your computer and use it in GitHub Desktop.
check delta chat group creation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this snippet does not care about freeing allocated objects! | |
dc_context_t* context = dc_context_new(NULL, NULL, NULL); | |
dc_delete_file(context, "/tmp/somefile"); | |
dc_open(context, "/tmp/somefile", NULL); | |
int contact_id1 = dc_create_contact(context, "some1", "[email protected]"); | |
int contact_id2 = dc_create_contact(context, "some2", "[email protected]"); | |
int chat_id = dc_create_group_chat(context, 0, "title1"); | |
dc_add_contact_to_chat(context, chat_id, contact_id1); | |
dc_add_contact_to_chat(context, chat_id, contact_id2); | |
dc_array_t* chat_contacts = dc_get_chat_contacts(context, chat_id); | |
for (size_t i=0; i<dc_array_get_cnt(chat_contacts); i++ ) { | |
// prints `10 - 11 - 1 - ` the 1 is SELF that is always added to group chats | |
printf("%i - ", dc_array_get_id(chat_contacts, i)); | |
} | |
printf("\n"); | |
dc_array_t* all_contacts = dc_get_contacts(context, 0, NULL); | |
for (size_t i=0; i<dc_array_get_cnt(all_contacts); i++ ) { | |
// prints `10 - 11 - ` - DC_GCL_ADD_SELF is not added to flags | |
printf("%i - ", dc_array_get_id(all_contacts, i)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
see deltachat/deltachat-core#294 (review)