From: Mark D. <the...@us...> - 2004-05-23 17:28:32
|
Update of /cvsroot/gaim/gaim/src/protocols/irc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1398/src/protocols/irc Modified Files: irc.c irc.h Log Message: 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. Index: irc.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/protocols/irc/irc.c,v retrieving revision 1.216 retrieving revision 1.217 diff -u -d -p -r1.216 -r1.217 --- irc.c 22 May 2004 17:33:33 -0000 1.216 +++ irc.c 23 May 2004 17:27:43 -0000 1.217 @@ -25,15 +25,16 @@ #include "internal.h" -#include "plugin.h" #include "accountopt.h" -#include "multi.h" -#include "prpl.h" +#include "blist.h" #include "conversation.h" -#include "notify.h" #include "debug.h" -#include "blist.h" +#include "multi.h" +#include "notify.h" +#include "prpl.h" +#include "plugin.h" #include "util.h" + #include "irc.h" static void irc_buddy_append(char *name, struct irc_buddy *ib, GString *string); @@ -143,16 +144,31 @@ static GList *irc_actions(GaimPlugin *pl return list; } -static GList *irc_buddy_menu(GaimConnection *gc, const char *who) + +static void irc_dccsend_send_ask_menu(GaimBlistNode *node, gpointer data) +{ + GaimBuddy *buddy; + GaimConnection *gc; + + g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(node)); + + buddy = (GaimBuddy *) node; + gc =gaim_account_get_connection(buddy->account); + + irc_dccsend_send_ask(gc, buddy->name); +} + + +static GList *irc_blist_node_menu(GaimBlistNode *node) { GList *m = NULL; - struct proto_buddy_menu *pbm; - - pbm = g_new0(struct proto_buddy_menu, 1); - pbm->label = _("Send File"); - pbm->callback = irc_dccsend_send_ask; - pbm->gc = gc; - m = g_list_append(m, pbm); + GaimBlistNodeAction *act; + + if(GAIM_BLIST_NODE_IS_BUDDY(node)) { + act = gaim_blist_node_action_new(_("Send File"), + irc_dccsend_send_ask_menu, NULL); + m = g_list_append(m, act); + } return m; } @@ -545,7 +561,7 @@ static GaimPluginProtocolInfo prpl_info NULL, NULL, irc_away_states, - irc_buddy_menu, + irc_blist_node_menu, irc_chat_join_info, irc_login, irc_close, @@ -589,7 +605,6 @@ static GaimPluginProtocolInfo prpl_info NULL, irc_roomlist_get_list, irc_roomlist_cancel, - NULL, NULL }; Index: irc.h =================================================================== RCS file: /cvsroot/gaim/gaim/src/protocols/irc/irc.h,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -p -r1.8 -r1.9 --- irc.h 30 Mar 2004 17:44:39 -0000 1.8 +++ irc.h 23 May 2004 17:27:43 -0000 1.9 @@ -25,7 +25,6 @@ #include <glib.h> -#include "multi.h" #include "roomlist.h" #define IRC_DEFAULT_SERVER "irc.freenode.net" |