# HG changeset patch # User Sadrul Habib Chowdhury # Date 1201112745 0 # Node ID 68d0607ca490fdec79302472920fa969fc3f172b # Parent 5862bb4be826f8eb0309c28a31e2ba35abed3c58# Parent d1b8c8bef05b9f8e45665b01b98d5a84826635b0 merge of '310bb375db205bf93c93b7bdc96853f6f1832a5d' and '8a26d0d87e727df07df7c70418ce3081d4cf887a' diff -r 5862bb4be826 -r 68d0607ca490 finch/plugins/grouping.c --- a/finch/plugins/grouping.c Wed Jan 23 09:22:28 2008 +0000 +++ b/finch/plugins/grouping.c Wed Jan 23 18:25:45 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; }