diff src/protocols/trepia/trepia.c @ 9030:7ab20f829190

[gaim-migrate @ 9806] Siege updated the code for creating right-click menu's for buddies, chats, groups, etc. It uses more stuff from the blist API and less stuff from multi.h. It also combines the code for right-click menus for chats, buddies, etc. (all types of blist nodes). So PRPLs and plugins can easily add right-click menu options to anything in the buddy list in a clean way. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sun, 23 May 2004 17:27:45 +0000
parents 7f456c05b767
children f5fd42679095
line wrap: on
line diff
--- a/src/protocols/trepia/trepia.c	Sun May 23 08:06:38 2004 +0000
+++ b/src/protocols/trepia/trepia.c	Sun May 23 17:27:45 2004 +0000
@@ -34,7 +34,6 @@
 
 /* XXX */
 #include "gaim.h"
-#include "multi.h"
 
 #ifndef _WIN32
 # include <sys/socket.h>
@@ -444,37 +443,38 @@
 }
 
 static void
-trepia_visit_homepage(GaimConnection *gc, const char *who)
+trepia_visit_homepage(GaimBlistNode *node, gpointer data)
 {
+	GaimBuddy *buddy;
+	GaimConnection *gc;
 	TrepiaProfile *profile;
-	GaimBuddy *b;
 	const char *value;
 
-	b = gaim_find_buddy(gaim_connection_get_account(gc), who);
+	g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(node));
+
+	buddy = (GaimBuddy *) node;
+	gc = gaim_account_get_connection(buddy->account);
 	profile = b->proto_data;
+	value = trepia_profile_get_homepage(profile);
 
-	if ((value = trepia_profile_get_homepage(profile)) != NULL)
+	if (value != NULL)
 		gaim_notify_uri(gc, value);
 }
 
 static GList *
-trepia_buddy_menu(GaimConnection *gc, const char *who)
+trepia_blist_node_menu(GaimBlistNode *node)
 {
-	TrepiaProfile *profile;
-	GaimBuddy *b;
-	const char *value = NULL;
 	GList *m = NULL;
-	struct proto_buddy_menu *pbm;
+	GaimBlistNodeACtion *act;
 
-	b = gaim_find_buddy(gaim_connection_get_account(gc), who);
-	profile = b->proto_data;
+	if(GAIM_BLIST_NODE_IS_BUDDY(node)) {
+		TrepiaProfile *profile = buddy->proto_data;
 
-	if ((value = trepia_profile_get_homepage(profile)) != NULL) {
-		pbm = g_new0(struct proto_buddy_menu, 1);
-		pbm->label = _("Visit Homepage");
-		pbm->callback = trepia_visit_homepage;
-		pbm->gc = gc;
-		m = g_list_append(m, pbm);
+		if (trepia_profile_get_homepage(profile) != NULL) {
+			act = gaim_blist_node_action_new(_("Visit Homepage"),
+					trepia_visit_homepage, NULL);
+			m = g_list_append(m, act);
+		}
 	}
 
 	return m;
@@ -1214,7 +1214,7 @@
 	trepia_status_text,
 	trepia_tooltip_text,
 	NULL,
-	trepia_buddy_menu,
+	trepia_blist_node_menu,
 	NULL,
 	trepia_login,
 	trepia_close,