changeset 22188:68d0607ca490

merge of '310bb375db205bf93c93b7bdc96853f6f1832a5d' and '8a26d0d87e727df07df7c70418ce3081d4cf887a'
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Wed, 23 Jan 2008 18:25:45 +0000
parents 5862bb4be826 (current diff) d1b8c8bef05b (diff)
children 4165bcd57486
files
diffstat 1 files changed, 36 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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;
 }