Mercurial > pidgin
comparison src/protocols/toc/toc.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 | cde9fb3546ed |
comparison
equal
deleted
inserted
replaced
9029:697e169dac12 | 9030:7ab20f829190 |
---|---|
23 #include "account.h" | 23 #include "account.h" |
24 #include "accountopt.h" | 24 #include "accountopt.h" |
25 #include "conversation.h" | 25 #include "conversation.h" |
26 #include "debug.h" | 26 #include "debug.h" |
27 #include "prpl.h" | 27 #include "prpl.h" |
28 #include "multi.h" | |
29 #include "notify.h" | 28 #include "notify.h" |
30 #include "proxy.h" | 29 #include "proxy.h" |
31 #include "request.h" | 30 #include "request.h" |
32 #include "util.h" | 31 #include "util.h" |
33 | 32 |
1117 g_snprintf(buf, MSG_LEN, "toc_get_info %s", gaim_normalize(gc->account, name)); | 1116 g_snprintf(buf, MSG_LEN, "toc_get_info %s", gaim_normalize(gc->account, name)); |
1118 sflap_send(gc, buf, -1, TYPE_DATA); | 1117 sflap_send(gc, buf, -1, TYPE_DATA); |
1119 } | 1118 } |
1120 | 1119 |
1121 /* Should be implemented as an Account Action? */ | 1120 /* Should be implemented as an Account Action? */ |
1122 static void toc_get_dir(GaimConnection *gc, const char *name) | 1121 static void toc_get_dir(GaimBlistNode *node, gpointer data) |
1123 { | 1122 { |
1123 GaimBuddy *buddy; | |
1124 GaimConnection *gc; | |
1124 char buf[BUF_LEN * 2]; | 1125 char buf[BUF_LEN * 2]; |
1125 g_snprintf(buf, MSG_LEN, "toc_get_dir %s", gaim_normalize(gc->account, name)); | 1126 |
1127 g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(node)); | |
1128 | |
1129 buddy = (GaimBuddy *) node; | |
1130 gc = gaim_acount_get_connection(buddy->account); | |
1131 | |
1132 g_snprintf(buf, MSG_LEN, "toc_get_dir %s", | |
1133 gaim_normalize(buddy->account, buddy->name)); | |
1126 sflap_send(gc, buf, -1, TYPE_DATA); | 1134 sflap_send(gc, buf, -1, TYPE_DATA); |
1127 } | 1135 } |
1128 | 1136 |
1129 #if 0 | 1137 #if 0 |
1130 /* Should be implemented as an Account Action */ | 1138 /* Should be implemented as an Account Action */ |
1398 *sw = emblems[1]; | 1406 *sw = emblems[1]; |
1399 *nw = emblems[2]; | 1407 *nw = emblems[2]; |
1400 *ne = emblems[3]; | 1408 *ne = emblems[3]; |
1401 } | 1409 } |
1402 | 1410 |
1403 static GList *toc_buddy_menu(GaimConnection *gc, const char *who) | 1411 static GList *toc_blist_node_menu(GaimBlistNode *node) |
1404 { | 1412 { |
1405 GList *m = NULL; | 1413 GList *m = NULL; |
1406 struct proto_buddy_menu *pbm; | 1414 GaimBlistNodeAction *act; |
1407 | 1415 |
1408 pbm = g_new0(struct proto_buddy_menu, 1); | 1416 if(GAIM_BLIST_NODE_IS_BUDDY(node)) { |
1409 pbm->label = _("Get Dir Info"); | 1417 act = gaim_blist_node_action_new(_("Get Dir Info"), |
1410 pbm->callback = toc_get_dir; | 1418 toc_get_dir, NULL); |
1411 pbm->gc = gc; | 1419 m = g_list_append(m, act); |
1412 m = g_list_append(m, pbm); | 1420 } |
1413 | 1421 |
1414 return m; | 1422 return m; |
1415 } | 1423 } |
1416 | 1424 |
1417 static void toc_add_permit(GaimConnection *gc, const char *who) | 1425 static void toc_add_permit(GaimConnection *gc, const char *who) |
2101 toc_list_icon, | 2109 toc_list_icon, |
2102 toc_list_emblems, | 2110 toc_list_emblems, |
2103 NULL, | 2111 NULL, |
2104 NULL, | 2112 NULL, |
2105 toc_away_states, | 2113 toc_away_states, |
2106 toc_buddy_menu, | 2114 toc_blist_node_menu, |
2107 toc_chat_info, | 2115 toc_chat_info, |
2108 toc_login, | 2116 toc_login, |
2109 toc_close, | 2117 toc_close, |
2110 toc_send_im, | 2118 toc_send_im, |
2111 toc_set_info, | 2119 toc_set_info, |
2145 NULL, | 2153 NULL, |
2146 NULL, | 2154 NULL, |
2147 NULL, | 2155 NULL, |
2148 NULL, | 2156 NULL, |
2149 NULL, | 2157 NULL, |
2150 NULL, | |
2151 NULL | 2158 NULL |
2152 }; | 2159 }; |
2153 | 2160 |
2154 static GaimPluginInfo info = | 2161 static GaimPluginInfo info = |
2155 { | 2162 { |