comparison 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
comparison
equal deleted inserted replaced
9029:697e169dac12 9030:7ab20f829190
32 #include "md5.h" 32 #include "md5.h"
33 #include "profile.h" 33 #include "profile.h"
34 34
35 /* XXX */ 35 /* XXX */
36 #include "gaim.h" 36 #include "gaim.h"
37 #include "multi.h"
38 37
39 #ifndef _WIN32 38 #ifndef _WIN32
40 # include <sys/socket.h> 39 # include <sys/socket.h>
41 # include <sys/ioctl.h> 40 # include <sys/ioctl.h>
42 # include <netinet/in.h> 41 # include <netinet/in.h>
442 441
443 return m; 442 return m;
444 } 443 }
445 444
446 static void 445 static void
447 trepia_visit_homepage(GaimConnection *gc, const char *who) 446 trepia_visit_homepage(GaimBlistNode *node, gpointer data)
448 { 447 {
448 GaimBuddy *buddy;
449 GaimConnection *gc;
449 TrepiaProfile *profile; 450 TrepiaProfile *profile;
450 GaimBuddy *b;
451 const char *value; 451 const char *value;
452 452
453 b = gaim_find_buddy(gaim_connection_get_account(gc), who); 453 g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(node));
454
455 buddy = (GaimBuddy *) node;
456 gc = gaim_account_get_connection(buddy->account);
454 profile = b->proto_data; 457 profile = b->proto_data;
455 458 value = trepia_profile_get_homepage(profile);
456 if ((value = trepia_profile_get_homepage(profile)) != NULL) 459
460 if (value != NULL)
457 gaim_notify_uri(gc, value); 461 gaim_notify_uri(gc, value);
458 } 462 }
459 463
460 static GList * 464 static GList *
461 trepia_buddy_menu(GaimConnection *gc, const char *who) 465 trepia_blist_node_menu(GaimBlistNode *node)
462 { 466 {
463 TrepiaProfile *profile;
464 GaimBuddy *b;
465 const char *value = NULL;
466 GList *m = NULL; 467 GList *m = NULL;
467 struct proto_buddy_menu *pbm; 468 GaimBlistNodeACtion *act;
468 469
469 b = gaim_find_buddy(gaim_connection_get_account(gc), who); 470 if(GAIM_BLIST_NODE_IS_BUDDY(node)) {
470 profile = b->proto_data; 471 TrepiaProfile *profile = buddy->proto_data;
471 472
472 if ((value = trepia_profile_get_homepage(profile)) != NULL) { 473 if (trepia_profile_get_homepage(profile) != NULL) {
473 pbm = g_new0(struct proto_buddy_menu, 1); 474 act = gaim_blist_node_action_new(_("Visit Homepage"),
474 pbm->label = _("Visit Homepage"); 475 trepia_visit_homepage, NULL);
475 pbm->callback = trepia_visit_homepage; 476 m = g_list_append(m, act);
476 pbm->gc = gc; 477 }
477 m = g_list_append(m, pbm);
478 } 478 }
479 479
480 return m; 480 return m;
481 } 481 }
482 482
1212 trepia_list_icon, 1212 trepia_list_icon,
1213 trepia_list_emblems, 1213 trepia_list_emblems,
1214 trepia_status_text, 1214 trepia_status_text,
1215 trepia_tooltip_text, 1215 trepia_tooltip_text,
1216 NULL, 1216 NULL,
1217 trepia_buddy_menu, 1217 trepia_blist_node_menu,
1218 NULL, 1218 NULL,
1219 trepia_login, 1219 trepia_login,
1220 trepia_close, 1220 trepia_close,
1221 trepia_send_im, 1221 trepia_send_im,
1222 NULL, 1222 NULL,