comparison src/protocols/novell/novell.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 67421e0dc497
children 54fb1f466953
comparison
equal deleted inserted replaced
9029:697e169dac12 9030:7ab20f829190
1517 1517
1518 g_slist_free(parms); 1518 g_slist_free(parms);
1519 } 1519 }
1520 1520
1521 static void 1521 static void
1522 _initiate_conference_cb(GaimConnection *gc, const char *who) 1522 _initiate_conference_cb(GaimBlistNode *node, gpointer ignored)
1523 { 1523 {
1524 GaimBuddy *buddy;
1525 GaimConnection *gc;
1526
1524 NMUser *user; 1527 NMUser *user;
1525 const char *conf_name; 1528 const char *conf_name;
1526 GaimConversation *chat = NULL; 1529 GaimConversation *chat = NULL;
1527 NMUserRecord *user_record; 1530 NMUserRecord *user_record;
1528 NMConference *conference; 1531 NMConference *conference;
1529 1532
1533 g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(node));
1534
1535 buddy = (GaimBuddy *) node;
1536 gc = gaim_account_get_connection(buddy->account);
1537
1530 user = gc->proto_data; 1538 user = gc->proto_data;
1531 if (user == NULL) 1539 if (user == NULL)
1532 return; 1540 return;
1533 1541
1534 /* We should already have a userrecord for the buddy */ 1542 /* We should already have a userrecord for the buddy */
1535 user_record = nm_find_user_record(user, who); 1543 user_record = nm_find_user_record(user, buddy->name);
1536 if (user_record == NULL) 1544 if (user_record == NULL)
1537 return; 1545 return;
1538 1546
1539 conf_name = _get_conference_name(++user->conference_count); 1547 conf_name = _get_conference_name(++user->conference_count);
1540 chat = serv_got_joined_chat(gc, user->conference_count, conf_name); 1548 chat = serv_got_joined_chat(gc, user->conference_count, conf_name);
3272 break; 3280 break;
3273 } 3281 }
3274 } 3282 }
3275 3283
3276 static GList * 3284 static GList *
3277 novell_buddy_menu(GaimConnection *gc, const char *who) 3285 novell_blist_node_menu(GaimBlistNode *node)
3278 { 3286 {
3279 GList *list = NULL; 3287 GList *list = NULL;
3280 struct proto_buddy_menu *pbm; 3288 GaimBlistNodeAction *act;
3281 3289
3282 pbm = g_new0(struct proto_buddy_menu, 1); 3290 if(GAIM_BLIST_NODE_IS_BUDDY(node)) {
3283 pbm->label = _("Initiate _Chat"); 3291 act = gaim_blist_node_action_new(_("Initiate _Chat"),
3284 pbm->callback = _initiate_conference_cb; 3292 _initiate_conference_cb, NULL);
3285 pbm->gc = gc; 3293 list = g_list_append(list, act);
3286 list = g_list_append(list, pbm); 3294 }
3287 3295
3288 return list; 3296 return list;
3289 } 3297 }
3290 3298
3291 static GaimPluginProtocolInfo prpl_info = { 3299 static GaimPluginProtocolInfo prpl_info = {
3296 novell_list_icon, 3304 novell_list_icon,
3297 novell_list_emblems, 3305 novell_list_emblems,
3298 novell_status_text, 3306 novell_status_text,
3299 novell_tooltip_text, 3307 novell_tooltip_text,
3300 novell_away_states, 3308 novell_away_states,
3301 novell_buddy_menu, 3309 novell_blist_node_menu,
3302 NULL, /* chat_info */ 3310 NULL, /* chat_info */
3303 novell_login, 3311 novell_login,
3304 novell_close, 3312 novell_close,
3305 novell_send_im, 3313 novell_send_im,
3306 NULL, /* set_info */ 3314 NULL, /* set_info */
3335 NULL, /* buddy_free */ 3343 NULL, /* buddy_free */
3336 novell_convo_closed, 3344 novell_convo_closed,
3337 NULL, /* normalize */ 3345 NULL, /* normalize */
3338 NULL, /* set_buddy_icon */ 3346 NULL, /* set_buddy_icon */
3339 novell_remove_group, 3347 novell_remove_group,
3348 NULL,
3349 NULL,
3350 NULL,
3351 NULL,
3352 NULL,
3340 NULL 3353 NULL
3341 }; 3354 };
3342 3355
3343 static GaimPluginInfo info = { 3356 static GaimPluginInfo info = {
3344 GAIM_PLUGIN_API_VERSION, /**< api_version */ 3357 GAIM_PLUGIN_API_VERSION, /**< api_version */