changeset 32810:d288f5215a9a

Add purple_contact_get_contact_size().
author andrew.victor@mxit.com
date Mon, 31 Oct 2011 20:35:39 +0000
parents 76096c42f558
children 33f5c8ac8f97
files ChangeLog.API finch/gntblist.c finch/plugins/grouping.c libpurple/blist.c libpurple/blist.h pidgin/gtkdialogs.c
diffstat 6 files changed, 21 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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
--- 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);
--- 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;
 			}
--- 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();
--- 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.
  *
--- 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,