- Change Summary:
-
add the ticket
- Bugs:
Create PurplePerson.
Review Request #1838 — Created Sept. 25, 2022 and submitted
This automatically manages the sorting of contacts and will report the highest ranked one as the priority contact.
Ran the unit tests
Summary | ID |
---|---|
6d1f75b68b5351c58e2f1a900e64a006356a168c |
Description | From | Last Updated |
---|---|---|
I forgot that I forgot to finish the docs, I'll get to that tonight.. |
grim | |
"after add all the contacts" add was supposed to be adding? |
lifesfaded | |
priority |
lifesfaded | |
priority |
lifesfaded | |
Since |
QuLogic | |
user's Or maybe rewrite like purple_person_set_avatar |
QuLogic | |
Ref should actually go in the if; see /r/1836. |
QuLogic | |
Extra blank line. |
QuLogic | |
When you remove a contact from the person, it doesn't appear that these signal handlers are removed. |
QuLogic | |
But avatar is NULL, which is the same as not passing it, so it doesn't exactly confirm that this worked. |
QuLogic | |
const? |
QuLogic | |
Why no assert for the second contact? |
QuLogic | |
This was only for debugging, wasn't it? |
QuLogic | |
sorted_presence and sorted_contact are not unref'd. |
QuLogic | |
I think the contacts should only be sorted when removed is true to avoid unnecessary sorting. Also this causes unexpected … |
ivanhoe | |
Maybe skip this if nothing removed as well? |
QuLogic | |
This callback is not added to contact. |
QuLogic |
- Change Summary:
-
Address issues
- Commits:
-
Summary ID 29558c3158db7119c701ee6ecbfbdb7c24ddbb75 3502f3475725c33ec5c25b053e5bf549ebfa082b
- Change Summary:
-
rebased and addressed issues.
- Commits:
-
Summary ID 3502f3475725c33ec5c25b053e5bf549ebfa082b 362ac6e7d8da4076b280c41538f305169445710d
-
-
I think the contacts should only be sorted when
removed
is true to avoid unnecessary sorting.Also this causes unexpected behaviour in my opinion when you consider following unit test where the wrong contact is tried to be removed:
static void test_purple_person_no_remove(void) { PurpleAccount *account = NULL; PurpleContact *contact1 = NULL; PurpleContact *contact2 = NULL; PurplePerson *person1 = NULL; PurplePerson *person2 = NULL; gboolean person1_changed = FALSE; gboolean person2_changed = FALSE; account = purple_account_new("test", "test"); contact1 = purple_contact_new(account, "user1"); contact2 = purple_contact_new(account, "user2"); person1 = purple_person_new(); person2 = purple_person_new(); purple_person_add_contact(person1, contact1); purple_person_add_contact(person2, contact2); g_signal_connect(person1, "items-changed", G_CALLBACK(test_purple_person_items_changed_cb), &person1_changed); g_signal_connect(person2, "items-changed", G_CALLBACK(test_purple_person_items_changed_cb), &person2_changed); g_assert_false(purple_person_remove_contact(person1, contact2)); g_assert_false(person1_changed); g_clear_object(&person1); g_clear_object(&person2); g_clear_object(&account); }
With the current code the second assertion fails.
- Change Summary:
-
Don't sort in the remove function if we didn't actually remove anything.
- Commits:
-
Summary ID 362ac6e7d8da4076b280c41538f305169445710d 036516628336df177f188bb096ea55cb123343ef