Mercurial > pidgin.yaz
diff src/blist.c @ 12112:875f59f9c0bb
[gaim-migrate @ 14412]
A better interface for iterating the buddy list from none other than Sadrul
committer: Tailor Script <tailor@pidgin.im>
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Wed, 16 Nov 2005 08:27:17 +0000 |
parents | d0662345799b |
children | 1504d878be54 |
line wrap: on
line diff
--- a/src/blist.c Wed Nov 16 06:07:42 2005 +0000 +++ b/src/blist.c Wed Nov 16 08:27:17 2005 +0000 @@ -710,6 +710,33 @@ ops->set_visible(gaimbuddylist, show); } +static GaimBlistNode *get_next_node(GaimBlistNode *node, gboolean godeep) +{ + if (node == NULL) + return NULL; + + if (godeep && node->child) + return node->child; + + if (node->next) + return node->next; + + return get_next_node(node->parent, FALSE); +} + +GaimBlistNode *gaim_blist_node_next(GaimBlistNode *node, gboolean offline) +{ + GaimBlistNode *ret = node; + + do + { + ret = get_next_node(ret, TRUE); + } while (ret && !offline && GAIM_BLIST_NODE_IS_BUDDY(ret) && + !gaim_account_is_connected(gaim_buddy_get_account((GaimBuddy *)ret))); + + return ret; +} + void gaim_blist_update_buddy_status(GaimBuddy *buddy, GaimStatus *old_status) {