im.pidgin.pidgin: 8a26d0d87e727df07df7c70418ce3081d4cf887a

sadrul at pidgin.im sadrul at pidgin.im
Wed Jan 23 13:30:49 EST 2008


-----------------------------------------------------------------
Revision: 8a26d0d87e727df07df7c70418ce3081d4cf887a
Ancestor: 38789a886cd9ac8d6739a5a4171c2fc2be571497
Author: sadrul at pidgin.im
Date: 2008-01-23T18:17:34
Branch: im.pidgin.pidgin

Modified files:
        finch/plugins/grouping.c

ChangeLog: 

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.

-------------- next part --------------
============================================================
--- finch/plugins/grouping.c	baa0f5351d3843aa27231f475613c32840b0fd6d
+++ finch/plugins/grouping.c	cdbfdfbf9e0b7b6a137a41566f5ca4b4abb757f3
@@ -132,6 +132,40 @@ static FinchBlistManager on_offline =
 };
 
 /**
+ * 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)
 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)
 plugin_unload(PurplePlugin *plugin)
 {
 	finch_blist_uninstall_manager(&on_offline);
+	finch_blist_uninstall_manager(&meebo_group);
 	finch_blist_uninstall_manager(&no_group);
 	return TRUE;
 }


More information about the Commits mailing list