Mercurial > pidgin.yaz
comparison src/status.c @ 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 | f93ed7f6ecc7 |
children | ffb30c2e82cb |
comparison
equal
deleted
inserted
replaced
10859:310c5e6120fb | 10860:d01d81de94d8 |
---|---|
128 0, /* online */ | 128 0, /* online */ |
129 100, /* available */ | 129 100, /* available */ |
130 -75, /* unavailable */ | 130 -75, /* unavailable */ |
131 -50, /* hidden */ | 131 -50, /* hidden */ |
132 -100, /* away */ | 132 -100, /* away */ |
133 -200 /* extended away */ | 133 -200, /* extended away */ |
134 -10, /* idle, special case. */ | 134 -10, /* idle, special case. */ |
135 -5 /* idle time, special case. */ | 135 -5 /* idle time, special case. */ |
136 }; | 136 }; |
137 | 137 |
138 static GHashTable *buddy_presences = NULL; | 138 static GHashTable *buddy_presences = NULL; |
139 | 139 |
140 #define SCORE_IDLE 5 | 140 #define SCORE_IDLE 8 |
141 #define SCORE_IDLE_TIME 6 | 141 #define SCORE_IDLE_TIME 9 |
142 | 142 |
143 /************************************************************************** | 143 /************************************************************************** |
144 * GaimStatusPrimitive API | 144 * GaimStatusPrimitive API |
145 **************************************************************************/ | 145 **************************************************************************/ |
146 static struct GaimStatusPrimitiveMap | 146 static struct GaimStatusPrimitiveMap |
1563 gint | 1563 gint |
1564 gaim_presence_compare(const GaimPresence *presence1, | 1564 gaim_presence_compare(const GaimPresence *presence1, |
1565 const GaimPresence *presence2) | 1565 const GaimPresence *presence2) |
1566 { | 1566 { |
1567 gboolean idle1, idle2; | 1567 gboolean idle1, idle2; |
1568 size_t idle_time_1, idle_time_2; | 1568 time_t idle_time_1, idle_time_2; |
1569 int score1 = 0, score2 = 0; | 1569 int score1 = 0, score2 = 0; |
1570 const GList *l; | 1570 const GList *l; |
1571 | 1571 |
1572 if ((presence1 == NULL && presence2 == NULL) || (presence1 == presence2)) | 1572 if ((presence1 == NULL && presence2 == NULL) || (presence1 == presence2)) |
1573 return 0; | 1573 return 0; |
1603 score1 += primitive_scores[SCORE_IDLE]; | 1603 score1 += primitive_scores[SCORE_IDLE]; |
1604 | 1604 |
1605 if (idle2) | 1605 if (idle2) |
1606 score2 += primitive_scores[SCORE_IDLE]; | 1606 score2 += primitive_scores[SCORE_IDLE]; |
1607 | 1607 |
1608 idle_time_1 = gaim_presence_get_idle_time(presence1); | 1608 idle_time_1 = time(NULL) - gaim_presence_get_idle_time(presence1); |
1609 idle_time_2 = gaim_presence_get_idle_time(presence2); | 1609 idle_time_2 = time(NULL) - gaim_presence_get_idle_time(presence2); |
1610 | 1610 |
1611 if (idle_time_1 > idle_time_2) | 1611 if (idle_time_1 > idle_time_2) |
1612 score1 += primitive_scores[SCORE_IDLE_TIME]; | 1612 score1 += primitive_scores[SCORE_IDLE_TIME]; |
1613 else if (idle_time_1 < idle_time_2) | 1613 else if (idle_time_1 < idle_time_2) |
1614 score2 += primitive_scores[SCORE_IDLE_TIME]; | 1614 score2 += primitive_scores[SCORE_IDLE_TIME]; |