comparison src/protocols/irc/irc.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 933a19e3a6b3
comparison
equal deleted inserted replaced
9029:697e169dac12 9030:7ab20f829190
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 */ 24 */
25 25
26 #include "internal.h" 26 #include "internal.h"
27 27
28 #include "accountopt.h"
29 #include "blist.h"
30 #include "conversation.h"
31 #include "debug.h"
32 #include "multi.h"
33 #include "notify.h"
34 #include "prpl.h"
28 #include "plugin.h" 35 #include "plugin.h"
29 #include "accountopt.h"
30 #include "multi.h"
31 #include "prpl.h"
32 #include "conversation.h"
33 #include "notify.h"
34 #include "debug.h"
35 #include "blist.h"
36 #include "util.h" 36 #include "util.h"
37
37 #include "irc.h" 38 #include "irc.h"
38 39
39 static void irc_buddy_append(char *name, struct irc_buddy *ib, GString *string); 40 static void irc_buddy_append(char *name, struct irc_buddy *ib, GString *string);
40 41
41 static const char *irc_blist_icon(GaimAccount *a, GaimBuddy *b); 42 static const char *irc_blist_icon(GaimAccount *a, GaimBuddy *b);
141 list = g_list_append(list, act); 142 list = g_list_append(list, act);
142 143
143 return list; 144 return list;
144 } 145 }
145 146
146 static GList *irc_buddy_menu(GaimConnection *gc, const char *who) 147
148 static void irc_dccsend_send_ask_menu(GaimBlistNode *node, gpointer data)
149 {
150 GaimBuddy *buddy;
151 GaimConnection *gc;
152
153 g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(node));
154
155 buddy = (GaimBuddy *) node;
156 gc =gaim_account_get_connection(buddy->account);
157
158 irc_dccsend_send_ask(gc, buddy->name);
159 }
160
161
162 static GList *irc_blist_node_menu(GaimBlistNode *node)
147 { 163 {
148 GList *m = NULL; 164 GList *m = NULL;
149 struct proto_buddy_menu *pbm; 165 GaimBlistNodeAction *act;
150 166
151 pbm = g_new0(struct proto_buddy_menu, 1); 167 if(GAIM_BLIST_NODE_IS_BUDDY(node)) {
152 pbm->label = _("Send File"); 168 act = gaim_blist_node_action_new(_("Send File"),
153 pbm->callback = irc_dccsend_send_ask; 169 irc_dccsend_send_ask_menu, NULL);
154 pbm->gc = gc; 170 m = g_list_append(m, act);
155 m = g_list_append(m, pbm); 171 }
156 172
157 return m; 173 return m;
158 } 174 }
159 175
160 static GList *irc_chat_join_info(GaimConnection *gc) 176 static GList *irc_chat_join_info(GaimConnection *gc)
543 irc_blist_icon, 559 irc_blist_icon,
544 irc_blist_emblems, 560 irc_blist_emblems,
545 NULL, 561 NULL,
546 NULL, 562 NULL,
547 irc_away_states, 563 irc_away_states,
548 irc_buddy_menu, 564 irc_blist_node_menu,
549 irc_chat_join_info, 565 irc_chat_join_info,
550 irc_login, 566 irc_login,
551 irc_close, 567 irc_close,
552 irc_im_send, 568 irc_im_send,
553 NULL, 569 NULL,
587 NULL, /* get_cb_real_name */ 603 NULL, /* get_cb_real_name */
588 NULL, 604 NULL,
589 NULL, 605 NULL,
590 irc_roomlist_get_list, 606 irc_roomlist_get_list,
591 irc_roomlist_cancel, 607 irc_roomlist_cancel,
592 NULL,
593 NULL 608 NULL
594 }; 609 };
595 610
596 611
597 static GaimPluginInfo info = 612 static GaimPluginInfo info =