Mercurial > pidgin.yaz
annotate plugins/events.c @ 5644:213e999fa5cc
[gaim-migrate @ 6058]
Added a generic function for creating and automatically filling a drop-down
with a list of loaded protocols plugins, and used it in the new account
editor.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Sun, 01 Jun 2003 23:14:31 +0000 |
parents | c0baa01cdeda |
children | dae79aefac8d |
rev | line source |
---|---|
5255 | 1 /* events.c |
534 | 2 * |
3 * test every callback, print to stdout | |
4 * | |
2130
50c7a704ee56
[gaim-migrate @ 2140]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1404
diff
changeset
|
5 * by EW |
534 | 6 * |
7 * GPL and all that jazz | |
8 * | |
9 */ | |
10 | |
5255 | 11 #define EVENTTEST_PLUGIN_ID "core-eventtest" |
534 | 12 #include "gaim.h" |
13 | |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
808
diff
changeset
|
14 static void evt_signon(struct gaim_connection *gc, void *data) |
779
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
15 { |
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
16 printf("event_signon\n"); |
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
17 } |
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
18 |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
808
diff
changeset
|
19 static void evt_signoff(struct gaim_connection *gc, void *data) |
779
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
20 { |
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
21 printf("event_signoff\n"); |
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
22 } |
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
23 |
1404
96e93119268d
[gaim-migrate @ 1414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1047
diff
changeset
|
24 static void evt_away(struct gaim_connection *gc, char *state, char *message, void *data) |
779
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
25 { |
1404
96e93119268d
[gaim-migrate @ 1414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1047
diff
changeset
|
26 printf("event_away: %s %s %s\n", gc->username, state, message); |
779
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
27 } |
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
28 |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
808
diff
changeset
|
29 static void evt_back(void *data) |
779
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
30 { |
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
31 printf("event_back\n"); |
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
32 } |
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
33 |
5090 | 34 static void evt_im_recv(struct gaim_connection *gc, char **who, char **what, guint *flags, void *data) |
534 | 35 { |
779
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
36 printf("event_im_recv: %s %s\n", *who, *what); |
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
37 } |
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
38 |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
808
diff
changeset
|
39 static void evt_im_send(struct gaim_connection *gc, char *who, char **what, void *data) |
779
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
40 { |
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
41 printf("event_im_send: %s %s\n", who, *what); |
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
42 } |
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
43 |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
808
diff
changeset
|
44 static void evt_buddy_signon(struct gaim_connection *gc, char *who, void *data) |
779
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
45 { |
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
46 printf("event_buddy_signon: %s\n", who); |
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
47 } |
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
48 |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
808
diff
changeset
|
49 static void evt_buddy_signoff(struct gaim_connection *gc, char *who, void *data) |
779
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
50 { |
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
51 printf("event_buddy_signoff: %s\n", who); |
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
52 } |
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
53 |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
808
diff
changeset
|
54 static void evt_buddy_away(struct gaim_connection *gc, char *who, void *data) |
779
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
55 { |
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
56 printf("event_buddy_away: %s\n", who); |
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
57 } |
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
58 |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
808
diff
changeset
|
59 static void evt_buddy_back(struct gaim_connection *gc, char *who, void *data) |
779
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
60 { |
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
61 printf("event_buddy_back: %s\n", who); |
534 | 62 } |
63 | |
5090 | 64 static void evt_buddy_idle(struct gaim_connection *gc, char *who, void *data) |
65 { | |
66 printf("event_buddy_idle: %s\n", who); | |
67 } | |
68 | |
69 static void evt_buddy_unidle(struct gaim_connection *gc, char *who, void *data) | |
70 { | |
71 printf("event_buddy_unidle: %s\n", who); | |
72 } | |
73 | |
74 static void evt_blist_update(void *data) | |
75 { | |
76 printf("event_blist_update\n"); | |
77 } | |
78 | |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
808
diff
changeset
|
79 static void evt_chat_invited(struct gaim_connection *gc, char *who, char *room, char *message, void *data) |
779
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
80 { |
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
81 printf("event_chat_invited: %s %s %s\n", who, room, message); |
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
82 } |
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
83 |
5090 | 84 static void evt_chat_join(struct gaim_connection *gc, int id, void *data) |
534 | 85 { |
5090 | 86 printf("event_chat_join: %d\n", id); |
779
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
87 } |
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
88 |
5090 | 89 static void evt_chat_leave(struct gaim_connection *gc, int id, void *data) |
779
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
90 { |
5090 | 91 printf("event_chat_leave: %d\n", id); |
779
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
92 } |
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
93 |
5090 | 94 static void evt_chat_buddy_join(struct gaim_connection *gc, int id, char *who, void *data) |
779
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
95 { |
5090 | 96 printf("event_chat_buddy_join: %d %s\n", id, who); |
534 | 97 } |
98 | |
5090 | 99 static void evt_chat_buddy_leave(struct gaim_connection *gc, int id, char *who, void *data) |
534 | 100 { |
5090 | 101 printf("event_chat_buddy_leave: %d %s\n", id, who); |
779
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
102 } |
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
103 |
5090 | 104 static void evt_chat_recv(struct gaim_connection *gc, int id, char *who, char *text, void *data) |
779
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
105 { |
5090 | 106 printf("event_chat_recv: %d %s %s\n", id, who, text); |
534 | 107 } |
108 | |
5090 | 109 static void evt_chat_send(struct gaim_connection *gc, int id, char **what, void *data) |
779
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
110 { |
5090 | 111 printf("event_chat_send: %d %s\n", id, *what); |
779
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
112 } |
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
113 |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
808
diff
changeset
|
114 static void evt_warned(struct gaim_connection *gc, char *who, int level, void *data) |
534 | 115 { |
779
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
116 printf("event_warned: %s %d\n", who, level); |
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
117 } |
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
118 |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
808
diff
changeset
|
119 static void evt_error(int error, void *data) |
779
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
120 { |
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
121 printf("event_error: %d\n", error); |
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
122 } |
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
123 |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
808
diff
changeset
|
124 static void evt_quit(void *data) |
779
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
125 { |
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
126 printf("event_quit\n"); |
534 | 127 } |
128 | |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
808
diff
changeset
|
129 static void evt_new_conversation(char *who, void *data) |
808
9d61f3d01046
[gaim-migrate @ 818]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
779
diff
changeset
|
130 { |
9d61f3d01046
[gaim-migrate @ 818]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
779
diff
changeset
|
131 printf("event_new_conversation: %s\n", who); |
9d61f3d01046
[gaim-migrate @ 818]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
779
diff
changeset
|
132 } |
9d61f3d01046
[gaim-migrate @ 818]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
779
diff
changeset
|
133 |
5090 | 134 static void evt_set_info(struct gaim_connection *gc, char *info, void *data) |
135 { | |
136 printf("event_set_info: %s\n", info); | |
137 } | |
138 | |
139 static void evt_draw_menu(GtkWidget *menu, char *name, void *data) | |
140 { | |
141 printf("event_draw_menu: %s\n", name); | |
142 } | |
143 | |
144 static void evt_im_displayed_sent(struct gaim_connection *gc, char *who, char **what, void *data) | |
145 { | |
146 printf("event_im_displayed_sent: %s %s\n", who, *what); | |
147 } | |
148 | |
149 static void evt_im_displayed_rcvd(struct gaim_connection *gc, char *who, char *what, guint32 flags, time_t time, void *data) | |
150 { | |
5255 | 151 printf("event_im_displayed_rcvd: %s %s %u %u\n", who, what, flags, time); |
5090 | 152 } |
153 | |
154 static void evt_chat_send_invite(struct gaim_connection *gc, int id, char *who, char **msg, void *data) | |
155 { | |
156 printf("event_chat_send_invite: %d %s %s\n", id, who, *msg); | |
157 } | |
158 | |
159 static evt_got_typing(struct gaim_connection *gc, char *who, void *data) | |
160 { | |
161 printf("event_got_typing: %s\n", who); | |
162 } | |
163 | |
5255 | 164 static evt_del_conversation(struct gaim_conversation *c, void *data) |
5090 | 165 { |
166 printf("event_del_conversation\n"); | |
167 } | |
168 | |
169 static evt_connecting(struct gaim_account *u, void *data) | |
170 { | |
171 printf("event_connecting\n"); | |
172 } | |
173 | |
5255 | 174 |
175 /* | |
176 * EXPORTED FUNCTIONS | |
177 */ | |
178 | |
179 static gboolean | |
180 plugin_load(GaimPlugin *plugin) | |
534 | 181 { |
5255 | 182 gaim_signal_connect(plugin, event_signon, evt_signon, NULL); |
183 gaim_signal_connect(plugin, event_signoff, evt_signoff, NULL); | |
184 gaim_signal_connect(plugin, event_away, evt_away, NULL); | |
185 gaim_signal_connect(plugin, event_back, evt_back, NULL); | |
186 gaim_signal_connect(plugin, event_im_recv, evt_im_recv, NULL); | |
187 gaim_signal_connect(plugin, event_im_send, evt_im_send, NULL); | |
188 gaim_signal_connect(plugin, event_buddy_signon, evt_buddy_signon, NULL); | |
189 gaim_signal_connect(plugin, event_buddy_signoff, evt_buddy_signoff, NULL); | |
190 gaim_signal_connect(plugin, event_buddy_away, evt_buddy_away, NULL); | |
191 gaim_signal_connect(plugin, event_buddy_back, evt_buddy_back, NULL); | |
192 gaim_signal_connect(plugin, event_chat_invited, evt_chat_invited, NULL); | |
193 gaim_signal_connect(plugin, event_chat_join, evt_chat_join, NULL); | |
194 gaim_signal_connect(plugin, event_chat_leave, evt_chat_leave, NULL); | |
195 gaim_signal_connect(plugin, event_chat_buddy_join, evt_chat_buddy_join, NULL); | |
196 gaim_signal_connect(plugin, event_chat_buddy_leave, evt_chat_buddy_leave, NULL); | |
197 gaim_signal_connect(plugin, event_chat_recv, evt_chat_recv, NULL); | |
198 gaim_signal_connect(plugin, event_chat_send, evt_chat_send, NULL); | |
199 gaim_signal_connect(plugin, event_warned, evt_warned, NULL); | |
200 gaim_signal_connect(plugin, event_error, evt_error, NULL); | |
201 gaim_signal_connect(plugin, event_quit, evt_quit, NULL); | |
202 gaim_signal_connect(plugin, event_new_conversation, evt_new_conversation, NULL); | |
203 gaim_signal_connect(plugin, event_set_info, evt_set_info, NULL); | |
204 gaim_signal_connect(plugin, event_draw_menu, evt_draw_menu, NULL); | |
205 gaim_signal_connect(plugin, event_im_displayed_sent, evt_im_displayed_sent, NULL); | |
206 gaim_signal_connect(plugin, event_im_displayed_rcvd, evt_im_displayed_rcvd, NULL); | |
207 gaim_signal_connect(plugin, event_chat_send_invite, evt_chat_send_invite, NULL); | |
208 gaim_signal_connect(plugin, event_got_typing, evt_got_typing, NULL); | |
209 gaim_signal_connect(plugin, event_del_conversation, evt_del_conversation, NULL); | |
210 gaim_signal_connect(plugin, event_connecting, evt_connecting, NULL); | |
211 | |
212 return TRUE; | |
534 | 213 } |
214 | |
5255 | 215 static GaimPluginInfo info = |
216 { | |
217 2, /**< api_version */ | |
218 GAIM_PLUGIN_STANDARD, /**< type */ | |
219 NULL, /**< ui_requirement */ | |
220 0, /**< flags */ | |
221 NULL, /**< dependencies */ | |
222 GAIM_PRIORITY_DEFAULT, /**< priority */ | |
223 | |
224 EVENTTEST_PLUGIN_ID, /**< id */ | |
225 N_("Event Test"), /**< name */ | |
226 VERSION, /**< version */ | |
227 /** summary */ | |
228 N_("Test to see that all events are working properly."), | |
229 /** description */ | |
230 N_("Test to see that all events are working properly."), | |
231 "Eric Warmenhoven <eric@warmenhoven.org>", /**< author */ | |
232 WEBSITE, /**< homepage */ | |
233 | |
234 plugin_load, /**< load */ | |
235 NULL, /**< unload */ | |
236 NULL, /**< destroy */ | |
237 | |
238 NULL, /**< ui_info */ | |
239 NULL /**< extra_info */ | |
240 }; | |
241 | |
242 static void | |
243 __init_plugin(GaimPlugin *plugin) | |
244 { | |
3551 | 245 } |
246 | |
5255 | 247 GAIM_INIT_PLUGIN(eventtester, __init_plugin, info); |