src/status.c

changeset 10860
8f600347b9e4
parent 10760
36ed17d3ad9d
child 10895
afb9f109e5c6
equal deleted inserted replaced
10859:d0da8cb9d2e9 10860:8f600347b9e4
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];

mercurial