Mercurial > pidgin.yaz
diff src/protocols/gg/gg.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 | 7a8aa87164ae |
line wrap: on
line diff
--- a/src/protocols/gg/gg.c Sun May 23 08:06:38 2004 +0000 +++ b/src/protocols/gg/gg.c Sun May 23 17:27:45 2004 +0000 @@ -1,6 +1,6 @@ /* * gaim - Gadu-Gadu Protocol Plugin - * $Id: gg.c 9791 2004-05-22 17:33:38Z lschiere $ + * $Id: gg.c 9806 2004-05-23 17:27:45Z thekingant $ * * Copyright (C) 2001 Arkadiusz Mi¶kiewicz <misiek@pld.ORG.PL> * @@ -26,8 +26,8 @@ #include "account.h" #include "accountopt.h" +#include "blist.h" #include "debug.h" -#include "multi.h" #include "notify.h" #include "proxy.h" #include "prpl.h" @@ -244,27 +244,35 @@ } /* Enhance these functions, more options and such stuff */ -static GList *agg_buddy_menu(GaimConnection *gc, const char *who) +static GList *agg_buddy_menu(GaimBuddy *buddy) { GList *m = NULL; - struct proto_buddy_menu *pbm; - GaimBuddy *b = gaim_find_buddy(gc->account, who); + GaimBlistNodeAction *act; + static char buf[AGG_BUF_LEN]; + g_snprintf(buf, sizeof(buf), _("Status: %s"), get_away_text(buddy->uc)); - if (!b) { - return m; - } - - pbm = g_new0(struct proto_buddy_menu, 1); - g_snprintf(buf, sizeof(buf), _("Status: %s"), get_away_text(b->uc)); - pbm->label = buf; - pbm->callback = NULL; - pbm->gc = gc; - m = g_list_append(m, pbm); + /* um... this seems silly. since in this pass, I'm only converting + over the menu building, I'm not going to mess with it though */ + /* XXX: shouldn't this be in the tooltip instead? */ + act = gaim_blist_node_action_new(buf, NULL, NULL); + m = g_list_append(m, act); return m; } + +static GList * +agg_blist_node_menu(GaimBlistNode *node) +{ + if(GAIM_BLIST_NODE_IS_BUDDY(node)) { + return agg_buddy_menu((GaimBuddy *) node); + } else { + return NULL; + } +} + + static void agg_load_buddy_list(GaimConnection *gc, char *buddylist) { struct agg_data *gd = (struct agg_data *)gc->proto_data; @@ -1530,7 +1538,7 @@ NULL, NULL, agg_away_states, - agg_buddy_menu, + agg_blist_node_menu, NULL, agg_login, agg_close, @@ -1575,7 +1583,6 @@ NULL, NULL, NULL, - NULL }; static GaimPluginInfo info = @@ -1587,7 +1594,7 @@ NULL, /**< dependencies */ GAIM_PRIORITY_DEFAULT, /**< priority */ - "prpl-gg", /**< id */ + "prpl-gg", /**< id */ "Gadu-Gadu", /**< name */ VERSION, /**< version */ /** summary */ @@ -1613,9 +1620,9 @@ GaimAccountOption *option; option = gaim_account_option_string_new(_("Nick"), "nick", - "Gadu-Gadu User"); + "Gadu-Gadu User"); prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, - option); + option); my_protocol = plugin; }