changeset 10860:d01d81de94d8

[gaim-migrate @ 12543] sf patch #1188728, from Enix "this patch fixes the sort by status option in HEAD so that it actually sorts by status. Also, changes the documenation in status.h for the gaim_presence_compare() function so that it makes sense." committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sun, 24 Apr 2005 18:13:16 +0000
parents 310c5e6120fb
children 42c16b293867
files src/gtkblist.c src/protocols/oscar/oscar.c src/prpl.h src/status.c src/status.h
diffstat 5 files changed, 18 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/src/gtkblist.c	Sun Apr 24 17:39:11 2005 +0000
+++ b/src/gtkblist.c	Sun Apr 24 18:13:16 2005 +0000
@@ -5104,7 +5104,7 @@
 			gaim_buddy_get_presence(this_buddy));
 
 		if (this_buddy == NULL ||
-			(presence_cmp > 0 ||
+			(presence_cmp < 0 ||
 			 (presence_cmp == 0 &&
 			  (name_cmp < 0 || (name_cmp == 0 && node < n)))))
 		{
--- a/src/protocols/oscar/oscar.c	Sun Apr 24 17:39:11 2005 +0000
+++ b/src/protocols/oscar/oscar.c	Sun Apr 24 18:13:16 2005 +0000
@@ -3010,11 +3010,9 @@
 	if (caps & AIM_CAPS_ICQ_DIRECT)
 		caps ^= AIM_CAPS_ICQ_DIRECT;
 
-	if (info->present & AIM_USERINFO_PRESENT_IDLE) {
-		time(&time_idle);
-		time_idle -= info->idletime*60;
-		/* time_idle should be the seconds since epoch at which the user became idle */
-	}
+	/* info->idletime is the number of minutes that this user has been idle */
+	if (info->present & AIM_USERINFO_PRESENT_IDLE)
+		time_idle = time(NULL) - info->idletime * 60;
 
 	if (info->present & AIM_USERINFO_PRESENT_ONLINESINCE)
 		signon = info->onlinesince;
--- a/src/prpl.h	Sun Apr 24 17:39:11 2005 +0000
+++ b/src/prpl.h	Sun Apr 24 18:13:16 2005 +0000
@@ -368,7 +368,9 @@
  * @param account   The account the user is on.
  * @param name      The screen name of the user.
  * @param idle      The user's idle state.
- * @param idle_time The user's idle time.
+ * @param idle_time The user's idle time.  This is the time at
+ *                  which the user became idle, in seconds since
+ *                  the epoch.
  */
 void gaim_prpl_got_user_idle(GaimAccount *account, const char *name,
 							 gboolean idle, time_t idle_time);
--- a/src/status.c	Sun Apr 24 17:39:11 2005 +0000
+++ b/src/status.c	Sun Apr 24 18:13:16 2005 +0000
@@ -130,15 +130,15 @@
 	-75,    /* unavailable              */
 	-50,    /* hidden                   */
 	-100,   /* away                     */
-	-200    /* extended away            */
+	-200,   /* extended away            */
 	-10,    /* idle, special case.      */
 	-5      /* idle time, special case. */
 };
 
 static GHashTable *buddy_presences = NULL;
 
-#define SCORE_IDLE      5
-#define SCORE_IDLE_TIME 6
+#define SCORE_IDLE      8
+#define SCORE_IDLE_TIME 9
 
 /**************************************************************************
  * GaimStatusPrimitive API
@@ -1565,7 +1565,7 @@
 		const GaimPresence *presence2)
 {
 	gboolean idle1, idle2;
-	size_t idle_time_1, idle_time_2;
+	time_t idle_time_1, idle_time_2;
 	int score1 = 0, score2 = 0;
 	const GList *l;
 
@@ -1605,8 +1605,8 @@
 	if (idle2)
 		score2 += primitive_scores[SCORE_IDLE];
 
-	idle_time_1 = gaim_presence_get_idle_time(presence1);
-	idle_time_2 = gaim_presence_get_idle_time(presence2);
+	idle_time_1 = time(NULL) - gaim_presence_get_idle_time(presence1);
+	idle_time_2 = time(NULL) - gaim_presence_get_idle_time(presence2);
 
 	if (idle_time_1 > idle_time_2)
 		score1 += primitive_scores[SCORE_IDLE_TIME];
--- a/src/status.h	Sun Apr 24 17:39:11 2005 +0000
+++ b/src/status.h	Sun Apr 24 18:13:16 2005 +0000
@@ -794,7 +794,9 @@
  *
  * @param presence  The presence.
  * @param idle      The idle state.
- * @param idle_time The idle time, if @a idle is TRUE.
+ * @param idle_time The idle time, if @a idle is TRUE.  This
+ *                  is the time at which the user became idle,
+ *                  in seconds since the epoch.
  */
 void gaim_presence_set_idle(GaimPresence *presence, gboolean idle,
 							time_t idle_time);
@@ -980,9 +982,9 @@
  * @param presence1 The first presence.
  * @param presence2 The second presence.
  *
- * @return -1 if @a presence1 is less available than @a presence2.
+ * @return -1 if @a presence1 is more available than @a presence2.
  *          0 if @a presence1 is equal to @a presence2.
- *          1 if @a presence2 is more available than @a presence1.
+ *          1 if @a presence1 is less available than @a presence2.
  */
 gint gaim_presence_compare(const GaimPresence *presence1,
 						   const GaimPresence *presence2);