comparison src/status.c @ 12164:281ab2ecc08c

[gaim-migrate @ 14465] SF Patch #1361253 from Sadrul Summary: "Contact Priority Fix" "This was not updated when GAIM_STATUS_ONLINE was removed." Comment by sadrul: "I have also included a fix for the contact-priority plugin." I made a lot more changes to the contact priority. It seems to work for me now. committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Sat, 19 Nov 2005 16:35:34 +0000
parents 5bda6a03d43b
children 1811afd29b57
comparison
equal deleted inserted replaced
12163:f6f08fd1841a 12164:281ab2ecc08c
122 122
123 static int primitive_scores[] = 123 static int primitive_scores[] =
124 { 124 {
125 0, /* unset */ 125 0, /* unset */
126 -500, /* offline */ 126 -500, /* offline */
127 0, /* online */
128 100, /* available */ 127 100, /* available */
129 -75, /* unavailable */ 128 -75, /* unavailable */
130 -50, /* hidden */ 129 -50, /* hidden */
131 -100, /* away */ 130 -100, /* away */
132 -200, /* extended away */ 131 -200, /* extended away */
134 -5 /* idle time, special case. */ 133 -5 /* idle time, special case. */
135 }; 134 };
136 135
137 static GHashTable *buddy_presences = NULL; 136 static GHashTable *buddy_presences = NULL;
138 137
139 #define SCORE_IDLE 8 138 #define SCORE_IDLE 7
140 #define SCORE_IDLE_TIME 9 139 #define SCORE_IDLE_TIME 8
141 140
142 /************************************************************************** 141 /**************************************************************************
143 * GaimStatusPrimitive API 142 * GaimStatusPrimitive API
144 **************************************************************************/ 143 **************************************************************************/
145 static struct GaimStatusPrimitiveMap 144 static struct GaimStatusPrimitiveMap
1574 gboolean idle1, idle2; 1573 gboolean idle1, idle2;
1575 time_t idle_time_1, idle_time_2; 1574 time_t idle_time_1, idle_time_2;
1576 int score1 = 0, score2 = 0; 1575 int score1 = 0, score2 = 0;
1577 const GList *l; 1576 const GList *l;
1578 1577
1579 if ((presence1 == NULL && presence2 == NULL) || (presence1 == presence2)) 1578 if (presence1 == presence2)
1580 return 0; 1579 return 0;
1581 else if (presence1 == NULL) 1580 else if (presence1 == NULL)
1582 return 1; 1581 return 1;
1583 else if (presence2 == NULL) 1582 else if (presence2 == NULL)
1584 return -1; 1583 return -1;
1590 GaimStatusType *type = gaim_status_get_type(status); 1589 GaimStatusType *type = gaim_status_get_type(status);
1591 1590
1592 if (gaim_status_is_active(status)) 1591 if (gaim_status_is_active(status))
1593 score1 += primitive_scores[gaim_status_type_get_primitive(type)]; 1592 score1 += primitive_scores[gaim_status_type_get_primitive(type)];
1594 } 1593 }
1594 score1 += gaim_account_get_int(gaim_presence_get_account(presence1), "score", 0);
1595 1595
1596 /* Compute the score of the second set of statuses. */ 1596 /* Compute the score of the second set of statuses. */
1597 for (l = gaim_presence_get_statuses(presence2); l != NULL; l = l->next) 1597 for (l = gaim_presence_get_statuses(presence2); l != NULL; l = l->next)
1598 { 1598 {
1599 GaimStatus *status = (GaimStatus *)l->data; 1599 GaimStatus *status = (GaimStatus *)l->data;
1600 GaimStatusType *type = gaim_status_get_type(status); 1600 GaimStatusType *type = gaim_status_get_type(status);
1601 1601
1602 if (gaim_status_is_active(status)) 1602 if (gaim_status_is_active(status))
1603 score2 += primitive_scores[gaim_status_type_get_primitive(type)]; 1603 score2 += primitive_scores[gaim_status_type_get_primitive(type)];
1604 } 1604 }
1605 score2 += gaim_account_get_int(gaim_presence_get_account(presence2), "score", 0);
1605 1606
1606 idle1 = gaim_presence_is_idle(presence1); 1607 idle1 = gaim_presence_is_idle(presence1);
1607 idle2 = gaim_presence_is_idle(presence2); 1608 idle2 = gaim_presence_is_idle(presence2);
1608 1609
1609 if (idle1) 1610 if (idle1)