# HG changeset patch # User Sadrul Habib Chowdhury # Date 1201112254 0 # Node ID d1b8c8bef05b9f8e45665b01b98d5a84826635b0 # Parent bc2e96c1355639921f86852c444adbfa3de2dff6 Add a meebo-like grouping, where online contacts show up under the default groups. But the offline contacts are grouped under a pseudo 'Offline' group. diff -r bc2e96c13556 -r d1b8c8bef05b finch/plugins/grouping.c --- a/finch/plugins/grouping.c Wed Jan 23 05:16:39 2008 +0000 +++ b/finch/plugins/grouping.c Wed Jan 23 18:17:34 2008 +0000 @@ -132,6 +132,40 @@ }; /** + * Meebo-like Grouping. + */ +static PurpleBlistNode meebo = {.type = PURPLE_BLIST_OTHER_NODE}; +static gpointer meebo_find_parent(PurpleBlistNode *node) +{ + static FinchBlistManager *def = NULL; + if (def == NULL) + def = finch_blist_manager_find("default"); + + if (PURPLE_BLIST_NODE_IS_CONTACT(node)) { + PurpleBuddy *buddy = purple_contact_get_priority_buddy((PurpleContact*)node); + if (buddy && !PURPLE_BUDDY_IS_ONLINE(buddy)) { + GntTree *tree = finch_blist_get_tree(); + if (!g_list_find(gnt_tree_get_rows(tree), &meebo)) { + gnt_tree_add_row_last(tree, &meebo, + gnt_tree_create_row(tree, _("Offline")), NULL); + } + return &meebo; + } + } + return def->find_parent(node); +} + +static FinchBlistManager meebo_group = +{ + "meebo", + N_("Meebo"), + NULL, + meebo_find_parent, + NULL, + {NULL, NULL, NULL, NULL} +}; + +/** * No Grouping. */ static gboolean no_group_can_add_node(PurpleBlistNode *node) @@ -168,6 +202,7 @@ plugin_load(PurplePlugin *plugin) { finch_blist_install_manager(&on_offline); + finch_blist_install_manager(&meebo_group); finch_blist_install_manager(&no_group); return TRUE; } @@ -176,6 +211,7 @@ plugin_unload(PurplePlugin *plugin) { finch_blist_uninstall_manager(&on_offline); + finch_blist_uninstall_manager(&meebo_group); finch_blist_uninstall_manager(&no_group); return TRUE; }