# HG changeset patch # User andrew.victor@mxit.com # Date 1320093339 0 # Node ID d288f5215a9a41f4163693f5862f322395f07780 # Parent 76096c42f558158109df31651b670020ad6c9b2c Add purple_contact_get_contact_size(). diff -r 76096c42f558 -r d288f5215a9a ChangeLog.API --- a/ChangeLog.API Mon Oct 31 19:21:14 2011 +0000 +++ b/ChangeLog.API Mon Oct 31 20:35:39 2011 +0000 @@ -18,6 +18,7 @@ * purple_conversation_set_ui_data * purple_conversation_message_get_alias * purple_conversation_message_get_conv + * purple_contact_get_contact_size * purple_notify_searchresult_column_get_title * purple_notify_searchresult_column_is_visible * purple_notify_searchresult_column_set_visible diff -r 76096c42f558 -r d288f5215a9a finch/gntblist.c --- a/finch/gntblist.c Mon Oct 31 19:21:14 2011 +0000 +++ b/finch/gntblist.c Mon Oct 31 20:35:39 2011 +0000 @@ -1561,7 +1561,7 @@ if (PURPLE_BLIST_NODE_IS_CONTACT(node)) { PurpleContact *c = (PurpleContact*)node; name = purple_contact_get_alias(c); - if (c->totalsize > 1) + if (purple_contact_get_contact_size(c, TRUE) > 1) sec = _("Removing this contact will also remove all the buddies in the contact"); } else if (PURPLE_BLIST_NODE_IS_BUDDY(node)) { name = purple_buddy_get_name((PurpleBuddy*)node); diff -r 76096c42f558 -r d288f5215a9a finch/plugins/grouping.c --- a/finch/plugins/grouping.c Mon Oct 31 19:21:14 2011 +0000 +++ b/finch/plugins/grouping.c Mon Oct 31 20:35:39 2011 +0000 @@ -54,7 +54,7 @@ case PURPLE_BLIST_CONTACT_NODE: { PurpleContact *contact = (PurpleContact*)node; - if (contact->currentsize > 0) + if (purple_contact_get_contact_size(contact, FALSE) > 0) return TRUE; return FALSE; } diff -r 76096c42f558 -r d288f5215a9a libpurple/blist.c --- a/libpurple/blist.c Mon Oct 31 19:21:14 2011 +0000 +++ b/libpurple/blist.c Mon Oct 31 20:35:39 2011 +0000 @@ -1774,6 +1774,13 @@ contact->priority_valid = FALSE; } +int purple_contact_get_contact_size(PurpleContact *contact, gboolean offline) +{ + g_return_val_if_fail(contact != NULL, 0); + + return offline ? contact->totalsize : contact->currentsize; +} + PurpleGroup *purple_group_new(const char *name) { PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); diff -r 76096c42f558 -r d288f5215a9a libpurple/blist.h --- a/libpurple/blist.h Mon Oct 31 19:21:14 2011 +0000 +++ b/libpurple/blist.h Mon Oct 31 20:35:39 2011 +0000 @@ -756,6 +756,15 @@ void purple_contact_invalidate_priority_buddy(PurpleContact *contact); /** + * Determines the total size of a contact. + * + * @param contact The contact + * @param offline Count buddies in offline accounts + * @return The number of buddies in the contact + */ +int purple_contact_get_contact_size(PurpleContact *contact, gboolean offline); + +/** * Removes a buddy from the buddy list and frees the memory allocated to it. * This doesn't actually try to remove the buddy from the server list. * diff -r 76096c42f558 -r d288f5215a9a pidgin/gtkdialogs.c --- a/pidgin/gtkdialogs.c Mon Oct 31 19:21:14 2011 +0000 +++ b/pidgin/gtkdialogs.c Mon Oct 31 20:35:39 2011 +0000 @@ -1195,8 +1195,8 @@ "want to continue?", "You are about to remove the contact containing %s " "and %d other buddies from your buddy list. Do you " - "want to continue?", contact->totalsize - 1), - purple_buddy_get_name(buddy), contact->totalsize - 1); + "want to continue?", purple_contact_get_contact_size(contact, TRUE) - 1), + purple_buddy_get_name(buddy), purple_contact_get_contact_size(contact, TRUE) - 1); purple_request_action(contact, NULL, _("Remove Contact"), text, 0, NULL, purple_contact_get_alias(contact), NULL,