im.pidgin.pidgin: a998fcfd3ae58ca18d7fe6f439b7669e5a85de62

sadrul at pidgin.im sadrul at pidgin.im
Tue Oct 16 02:25:41 EDT 2007


-----------------------------------------------------------------
Revision: a998fcfd3ae58ca18d7fe6f439b7669e5a85de62
Ancestor: 2859800860a726be81d3a19e19a5138521211b27
Author: sadrul at pidgin.im
Date: 2007-10-16T06:27:16
Branch: im.pidgin.pidgin

Modified files:
        ChangeLog.API libpurple/savedstatuses.c
        libpurple/savedstatuses.h

ChangeLog: 

deryni noticed that the documentation and code do not match for
purple_savedstatus_get_popular. Fix the doc, and change the code to match
the rest of the doc.

-------------- next part --------------
============================================================
--- ChangeLog.API	004fe380994e95c2d54dbf878df6b6b3cc61a22a
+++ ChangeLog.API	2f9a82d79675ae5e3c53050639cdd37d8bda6a53
@@ -6,6 +6,10 @@ version 2.2.2 (??/??/????):
 		* The size parameter of purple_util_write_data_to_file_absolute
 		  has been changed to gssize instead of a size_t to correctly
 		  indicate that -1 can be used for a nul-delimited string.
+		* The documentation for purple_savedstatuses_get_popular used to
+		  incorrectly claim that the active status is excluded from the
+		  returned list. The documentation has been corrected. Also, the
+		  function now returns a correct list when called with a value of 0.
 
 version 2.2.0 (09/13/2007):
 	libpurple:
============================================================
--- libpurple/savedstatuses.c	7e5db00ae4932bf7ef7036d38edba7a07bfe5164
+++ libpurple/savedstatuses.c	b2e7bfa66d083b7a38026c1dc623662318bb3c3c
@@ -761,10 +761,13 @@ purple_savedstatuses_get_popular(unsigne
 {
 	GList *popular = NULL;
 	GList *cur;
-	int i;
+	unsigned int i;
 	PurpleSavedStatus *next;
 
-	/* Copy 'how_many' elements to a new list */
+	/* Copy 'how_many' elements to a new list. If 'how_many' is 0, then copy all of 'em. */
+	if (how_many == 0)
+		how_many = (unsigned int) -1;
+
 	i = 0;
 	cur = saved_statuses;
 	while ((i < how_many) && (cur != NULL))
@@ -773,7 +776,7 @@ purple_savedstatuses_get_popular(unsigne
 		if ((!purple_savedstatus_is_transient(next)
 			|| purple_savedstatus_get_message(next) != NULL))
 		{
-			popular = g_list_prepend(popular, cur->data);
+			popular = g_list_prepend(popular, next);
 			i++;
 		}
 		cur = cur->next;
============================================================
--- libpurple/savedstatuses.h	89d1c00a7511a69c2281d4b25d6195fd7710fe5c
+++ libpurple/savedstatuses.h	b141ec2b5344dd3b0ca9c9007abb703bed5bbb63
@@ -170,11 +170,8 @@ GList *purple_savedstatuses_get_all(void
 /**
  * Returns the n most popular saved statuses.  "Popularity" is
  * determined by when the last time a saved_status was used and
- * how many times it has been used.  If the current status would
- * normally show up in this list, then it is omited and instead
- * the "how_many+1" saved status will appear in the list.  Also
- * transient statuses without messages are not included in the
- * list.
+ * how many times it has been used. Transient statuses without
+ * messages are not included in the list.
  *
  * @param how_many The maximum number of saved statuses
  *                 to return, or '0' to get all saved


More information about the Commits mailing list