Add find_or_create method to Purple.ContactManager

Review Request #3846 — Created Feb. 17, 2025 and updated

Information

pidgin/pidgin
default

Reviewers

Add find_or_create method to Purple.ContactManager

Ran the unit test in valgrind.

Summary ID
Add find_or_create method to Purple.ContactManager
4626234658fd19a91332028e85aaead00479713b
Description From Last Updated

this should probably use !purple_strempty

grimgrim

Deleting this seems unnecessary

grimgrim

There's no need for the [class@Pruple.Account] here its just redundant in the documentation.

grimgrim

clear object or unref on the second one should be fine.

grimgrim

reording this to the below should remove the need for the remove_all as that's just clearing the reference to the …

grimgrim

This should be marked as (out) and (optional), not (nullable).

QuLogicQuLogic

Add g_assert_true(PURPLE_IS_CONTACT(contact1))? Right now they're just compared to each other, and could be NULL.

QuLogicQuLogic
ivanhoe
  1. 
      
  2. libpurple/tests/test_contact_manager.c (Diff revision 1)
     
     

    I wasn't too sure about this cleanup because contact2 is using g_object_unref and contact1 is using g_assert_finalize_object to free the object, but I also tested using g_clear_object on both contact1 and contact2 instead of the current cleanup code and it ran through fine in valgrind too.

  3. 
      
grim
  1. 
      
  2. libpurple/purplecontactmanager.c (Diff revision 1)
     
     
    Show all issues

    this should probably use !purple_strempty

  3. libpurple/purplecontactmanager.c (Diff revision 1)
     
     
    Show all issues

    Deleting this seems unnecessary

    1. Oh, I didn't notice that. Looks like my whitespace-cleanup reduces multiple blank lines at the end of the file to one blank line.

  4. libpurple/purplecontactmanager.h (Diff revision 1)
     
     
    Show all issues

    There's no need for the [class@Pruple.Account] here its just redundant in the documentation.

    Image

  5. libpurple/tests/test_contact_manager.c (Diff revision 1)
     
     
    Show all issues

    clear object or unref on the second one should be fine.

    1. Do you want me to change something or is it just information?

  6. libpurple/tests/test_contact_manager.c (Diff revision 1)
     
     
    Show all issues

    reording this to the below should remove the need for the remove_all as that's just clearing the reference to the account that still exists in the manager. But if the manager is finalized first, it'll do its cleanup and unref the account as it should by itself.

    g_assert_finalize_object(manager);
    g_assert_finalize_object(account);
    
  7. 
      
ivanhoe
Review request changed
Change Summary:

Addressed issues

Commits:
Summary ID
Add find_or_create method to Purple.ContactManager
f230af143c4cce861b8607344ce0b3b5f8b378e4
Add find_or_create method to Purple.ContactManager
4626234658fd19a91332028e85aaead00479713b
QuLogic
  1. 
      
  2. libpurple/purplecontactmanager.h (Diff revision 2)
     
     
    Show all issues

    This should be marked as (out) and (optional), not (nullable).

  3. libpurple/tests/test_contact_manager.c (Diff revision 2)
     
     
     
     
    Show all issues

    Add g_assert_true(PURPLE_IS_CONTACT(contact1))? Right now they're just compared to each other, and could be NULL.

  4.