Mercurial > pidgin
comparison src/blist.c @ 7420:53c86d59f20b
[gaim-migrate @ 8022]
(19:08:24) deryni: Paco-Paco can stop wanting to kill Sean for using ctrl-f
in conversations, and all the rest of you can have fun making offline
buddies take priority over online ones (I'm sure you'll figure it out =)
and a change from free() to g_free() in yahoo from zuperdee, since g_free
is theoretically doing more error checking
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Tue, 04 Nov 2003 00:10:29 +0000 |
parents | b8ce6e194cff |
children | 58a426e1bd1a |
comparison
equal
deleted
inserted
replaced
7419:82dfe392a773 | 7420:53c86d59f20b |
---|---|
112 } | 112 } |
113 | 113 |
114 static void gaim_contact_compute_priority_buddy(GaimContact *contact) { | 114 static void gaim_contact_compute_priority_buddy(GaimContact *contact) { |
115 GaimBlistNode *bnode; | 115 GaimBlistNode *bnode; |
116 contact->priority = NULL; | 116 contact->priority = NULL; |
117 contact->score = INT_MAX; | |
117 | 118 |
118 for(bnode = ((GaimBlistNode*)contact)->child; bnode; bnode = bnode->next) { | 119 for(bnode = ((GaimBlistNode*)contact)->child; bnode; bnode = bnode->next) { |
119 GaimBuddy *buddy; | 120 GaimBuddy *buddy; |
121 int score = 0; | |
122 | |
120 if(!GAIM_BLIST_NODE_IS_BUDDY(bnode)) | 123 if(!GAIM_BLIST_NODE_IS_BUDDY(bnode)) |
121 continue; | 124 continue; |
122 buddy = (GaimBuddy*)bnode; | 125 buddy = (GaimBuddy*)bnode; |
123 if(!gaim_account_is_connected(buddy->account)) | 126 if(!gaim_account_is_connected(buddy->account)) |
124 continue; | 127 continue; |
125 | 128 |
126 if(!contact->priority) { | 129 if (!GAIM_BUDDY_IS_ONLINE(buddy)) |
130 score += gaim_prefs_get_int("/core/contact/offline_score"); | |
131 if (buddy->uc & UC_UNAVAILABLE) | |
132 score += gaim_prefs_get_int("/core/contact/away_score"); | |
133 if (buddy->idle) | |
134 score += gaim_prefs_get_int("/core/contact/idle_score"); | |
135 | |
136 score += gaim_account_get_int(buddy->account, "score", 0); | |
137 | |
138 if (score < contact->score) { | |
127 contact->priority = buddy; | 139 contact->priority = buddy; |
128 } else if(GAIM_BUDDY_IS_ONLINE(buddy)) { | 140 contact->score = score; |
129 if(!GAIM_BUDDY_IS_ONLINE(contact->priority)) { | 141 } |
142 if (gaim_prefs_get_bool("/core/contact/last_match")) | |
143 if (score == contact->score) | |
130 contact->priority = buddy; | 144 contact->priority = buddy; |
131 } else if(!(buddy->uc & UC_UNAVAILABLE) && !buddy->idle && | |
132 (contact->priority->uc & UC_UNAVAILABLE || | |
133 contact->priority->idle)) { | |
134 contact->priority = buddy; | |
135 } else if(!buddy->idle && contact->priority->idle) { | |
136 contact->priority = buddy; | |
137 } else if(contact->priority->uc & UC_UNAVAILABLE && | |
138 contact->priority->idle && (!(buddy->uc & UC_UNAVAILABLE) || | |
139 !buddy->idle)) { | |
140 contact->priority = buddy; | |
141 } | |
142 } | |
143 } | 145 } |
144 } | 146 } |
145 | 147 |
146 | 148 |
147 /***************************************************************************** | 149 /***************************************************************************** |
745 GaimBlistUiOps *ops; | 747 GaimBlistUiOps *ops; |
746 GaimContact *c = g_new0(GaimContact, 1); | 748 GaimContact *c = g_new0(GaimContact, 1); |
747 ((GaimBlistNode*)c)->type = GAIM_BLIST_CONTACT_NODE; | 749 ((GaimBlistNode*)c)->type = GAIM_BLIST_CONTACT_NODE; |
748 | 750 |
749 c->totalsize = c->currentsize = c->online = 0; | 751 c->totalsize = c->currentsize = c->online = 0; |
752 c->score = INT_MAX; | |
750 | 753 |
751 ops = gaim_blist_get_ui_ops(); | 754 ops = gaim_blist_get_ui_ops(); |
752 if (ops != NULL && ops->new_node != NULL) | 755 if (ops != NULL && ops->new_node != NULL) |
753 ops->new_node((GaimBlistNode *)c); | 756 ops->new_node((GaimBlistNode *)c); |
754 | 757 |