Mercurial > pidgin.yaz
annotate plugins/signals-test.c @ 6660:48a31082bf5f
[gaim-migrate @ 7185]
Patch from Kevin Strange to make executable pounces workon windows.
committer: Tailor Script <tailor@pidgin.im>
author | Herman Bloggs <hermanator12002@yahoo.com> |
---|---|
date | Sun, 31 Aug 2003 18:00:38 +0000 |
parents | e74e378e86bf |
children | d77e99c55b40 |
rev | line source |
---|---|
6485 | 1 /* |
2 * Signals test plugin. | |
3 * | |
4 * Copyright (C) 2003 Christian Hammond. | |
5 * | |
6 * This program is free software; you can redistribute it and/or | |
7 * modify it under the terms of the GNU General Public License as | |
8 * published by the Free Software Foundation; either version 2 of the | |
9 * License, or (at your option) any later version. | |
10 * | |
11 * This program is distributed in the hope that it will be useful, but | |
12 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 * General Public License for more details. | |
15 * | |
16 * You should have received a copy of the GNU General Public License | |
17 * along with this program; if not, write to the Free Software | |
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | |
19 * 02111-1307, USA. | |
20 */ | |
21 #define SIGNAL_TEST_PLUGIN_ID "core-signals-test" | |
22 | |
23 #include <stdio.h> | |
24 | |
25 #include "internal.h" | |
26 #include "connection.h" | |
27 #include "conversation.h" | |
28 #include "core.h" | |
29 #include "debug.h" | |
30 #include "signals.h" | |
31 | |
32 /************************************************************************** | |
33 * Account subsystem signal callbacks | |
34 **************************************************************************/ | |
35 static void | |
36 account_connecting_cb(GaimAccount *account, void *data) | |
37 { | |
38 gaim_debug(GAIM_DEBUG_MISC, "signals test", "account-connecting (%s)\n", | |
39 gaim_account_get_username(account)); | |
40 } | |
41 | |
42 static void | |
43 account_away_cb(GaimAccount *account, const char *state, | |
44 const char *message, void *data) | |
45 { | |
46 gaim_debug(GAIM_DEBUG_MISC, "signals test", | |
47 "account-away (%s, %s, %s)\n", | |
48 gaim_account_get_username(account), state, message); | |
49 } | |
50 | |
51 static void | |
52 account_setting_info_cb(GaimAccount *account, const char *info, void *data) | |
53 { | |
54 gaim_debug(GAIM_DEBUG_MISC, "signals test", | |
55 "account-setting-info (%s, %s)\n", | |
56 gaim_account_get_username(account), info); | |
57 } | |
58 | |
59 static void | |
60 account_set_info_cb(GaimAccount *account, const char *info, void *data) | |
61 { | |
62 gaim_debug(GAIM_DEBUG_MISC, "signals test", | |
63 "account-set-info (%s, %s)\n", | |
64 gaim_account_get_username(account), info); | |
65 } | |
66 | |
67 static void | |
68 account_warned_cb(GaimAccount *account, const char *warner, int level, | |
69 void *data) | |
70 { | |
71 gaim_debug(GAIM_DEBUG_MISC, "signals test", | |
72 "account-warned (%s, %s, %d)\n", | |
73 gaim_account_get_username(account), warner, level); | |
74 } | |
75 | |
76 /************************************************************************** | |
77 * Buddy List subsystem signal callbacks | |
78 **************************************************************************/ | |
79 static void | |
80 buddy_away_cb(struct buddy *buddy, void *data) | |
81 { | |
82 gaim_debug(GAIM_DEBUG_MISC, "signals test", | |
83 "buddy-away (%s)\n", buddy->name); | |
84 } | |
85 | |
86 static void | |
87 buddy_back_cb(struct buddy *buddy, void *data) | |
88 { | |
89 gaim_debug(GAIM_DEBUG_MISC, "signals test", | |
90 "buddy-back (%s)\n", buddy->name); | |
91 } | |
92 | |
93 static void | |
94 buddy_idle_cb(struct buddy *buddy, void *data) | |
95 { | |
96 gaim_debug(GAIM_DEBUG_MISC, "signals test", | |
97 "buddy-idle (%s)\n", buddy->name); | |
98 } | |
99 | |
100 static void | |
101 buddy_unidle_cb(struct buddy *buddy, void *data) | |
102 { | |
103 gaim_debug(GAIM_DEBUG_MISC, "signals test", | |
104 "buddy-unidle (%s)\n", buddy->name); | |
105 } | |
106 | |
107 static void | |
108 buddy_signed_on_cb(struct buddy *buddy, void *data) | |
109 { | |
110 gaim_debug(GAIM_DEBUG_MISC, "signals test", | |
111 "buddy-signed-on (%s)\n", buddy->name); | |
112 } | |
113 | |
114 static void | |
115 buddy_signed_off_cb(struct buddy *buddy, void *data) | |
116 { | |
117 gaim_debug(GAIM_DEBUG_MISC, "signals test", | |
118 "buddy-signed-off (%s)\n", buddy->name); | |
119 } | |
120 | |
121 /************************************************************************** | |
122 * Connection subsystem signal callbacks | |
123 **************************************************************************/ | |
124 static void | |
125 signing_on_cb(GaimConnection *gc, void *data) | |
126 { | |
127 gaim_debug(GAIM_DEBUG_MISC, "signals test", | |
128 "signing-on (%s)\n", | |
129 gaim_account_get_username(gaim_connection_get_account(gc))); | |
130 } | |
131 | |
132 static void | |
133 signed_on_cb(GaimConnection *gc, void *data) | |
134 { | |
135 gaim_debug(GAIM_DEBUG_MISC, "signals test", | |
136 "signed-on (%s)\n", | |
137 gaim_account_get_username(gaim_connection_get_account(gc))); | |
138 } | |
139 | |
140 static void | |
141 signing_off_cb(GaimConnection *gc, void *data) | |
142 { | |
143 gaim_debug(GAIM_DEBUG_MISC, "signals test", | |
144 "signing-off (%s)\n", | |
145 gaim_account_get_username(gaim_connection_get_account(gc))); | |
146 } | |
147 | |
148 static void | |
149 signed_off_cb(GaimConnection *gc, void *data) | |
150 { | |
151 gaim_debug(GAIM_DEBUG_MISC, "signals test", | |
152 "signed-off (%s)\n", | |
153 gaim_account_get_username(gaim_connection_get_account(gc))); | |
154 } | |
155 | |
156 /************************************************************************** | |
157 * Conversation subsystem signal callbacks | |
158 **************************************************************************/ | |
159 static gboolean | |
160 displaying_im_msg_cb(GaimConversation *conv, char **buffer, void *data) | |
161 { | |
162 gaim_debug(GAIM_DEBUG_MISC, "signals test", | |
163 "displaying-im-msg (%s, %s)\n", | |
164 gaim_conversation_get_name(conv), *buffer); | |
165 | |
166 return FALSE; | |
167 } | |
168 | |
169 static void | |
170 displayed_im_msg_cb(GaimConversation *conv, const char *buffer, void *data) | |
171 { | |
172 gaim_debug(GAIM_DEBUG_MISC, "signals test", | |
173 "displayed-im-msg (%s, %s)\n", | |
174 gaim_conversation_get_name(conv), buffer); | |
175 } | |
176 | |
177 static gboolean | |
6509 | 178 sending_im_msg_cb(GaimAccount *account, char *recipient, char **buffer, void *data) |
6485 | 179 { |
180 gaim_debug(GAIM_DEBUG_MISC, "signals test", | |
6509 | 181 "sending-im-msg (%s, %s, %s)\n", |
182 gaim_account_get_username(account), recipient, | |
183 *buffer); | |
6485 | 184 |
185 return FALSE; | |
186 } | |
187 | |
188 static void | |
6509 | 189 sent_im_msg_cb(GaimAccount *account, const char *recipient, const char *buffer, void *data) |
6485 | 190 { |
191 gaim_debug(GAIM_DEBUG_MISC, "signals test", | |
6509 | 192 "sent-im-msg (%s, %s, %s)\n", |
193 gaim_account_get_username(account), | |
194 recipient, buffer); | |
6485 | 195 } |
196 | |
197 static gboolean | |
6509 | 198 received_im_msg_cb(GaimAccount *account, char **sender, char **buffer, |
199 int *flags, void *data) | |
6485 | 200 { |
201 gaim_debug(GAIM_DEBUG_MISC, "signals test", | |
6509 | 202 "received-im-msg (%s, %s, %s, %d)\n", |
203 gaim_account_get_username(account), *sender, *buffer, *flags); | |
6485 | 204 |
205 return FALSE; | |
206 } | |
207 | |
208 static gboolean | |
209 displaying_chat_msg_cb(GaimConversation *conv, char **buffer, void *data) | |
210 { | |
211 gaim_debug(GAIM_DEBUG_MISC, "signals test", | |
212 "displaying-chat-msg (%s, %s)\n", | |
213 gaim_conversation_get_name(conv), *buffer); | |
214 | |
6486
fab81e4b885c
[gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
215 return FALSE; |
6485 | 216 } |
217 | |
218 static void | |
219 displayed_chat_msg_cb(GaimConversation *conv, const char *buffer, void *data) | |
220 { | |
221 gaim_debug(GAIM_DEBUG_MISC, "signals test", | |
222 "displayed-chat-msg (%s, %s)\n", | |
223 gaim_conversation_get_name(conv), buffer); | |
224 } | |
225 | |
226 static gboolean | |
6509 | 227 sending_chat_msg_cb(GaimAccount *account, char **buffer, int id, void *data) |
6485 | 228 { |
229 gaim_debug(GAIM_DEBUG_MISC, "signals test", | |
6509 | 230 "sending-chat-msg (%s, %s, %d)\n", |
231 gaim_account_get_username(account), *buffer, id); | |
6485 | 232 |
233 return FALSE; | |
234 } | |
235 | |
236 static void | |
6509 | 237 sent_chat_msg_cb(GaimAccount *account, const char *buffer, int id, void *data) |
6485 | 238 { |
239 gaim_debug(GAIM_DEBUG_MISC, "signals test", | |
6509 | 240 "sent-chat-msg (%s, %s, %d)\n", |
241 gaim_account_get_username(account), buffer, id); | |
6485 | 242 } |
243 | |
244 static gboolean | |
6509 | 245 received_chat_msg_cb(GaimAccount *account, char **sender, char **buffer, |
246 int id, void *data) | |
6485 | 247 { |
248 gaim_debug(GAIM_DEBUG_MISC, "signals test", | |
6509 | 249 "received-chat-msg (%s, %s, %s, %s, %d)\n", |
250 gaim_account_get_username(account), *sender, *buffer, id); | |
6485 | 251 |
252 return FALSE; | |
253 } | |
254 | |
255 static void | |
256 conversation_switching_cb(GaimConversation *old_conv, | |
257 GaimConversation *new_conv, void *data) | |
258 { | |
259 gaim_debug(GAIM_DEBUG_MISC, "signals test", | |
260 "conversation-switching (%s, %s)\n", | |
261 gaim_conversation_get_name(old_conv), | |
262 gaim_conversation_get_name(new_conv)); | |
263 } | |
264 | |
265 static void | |
266 conversation_switched_cb(GaimConversation *old_conv, | |
267 GaimConversation *new_conv, void *data) | |
268 { | |
269 gaim_debug(GAIM_DEBUG_MISC, "signals test", | |
270 "conversation-switched (%s, %s)\n", | |
271 gaim_conversation_get_name(old_conv), | |
272 gaim_conversation_get_name(new_conv)); | |
273 } | |
274 | |
275 static void | |
276 conversation_created_cb(GaimConversation *conv, void *data) | |
277 { | |
278 gaim_debug(GAIM_DEBUG_MISC, "signals test", | |
279 "conversation-created (%s)\n", | |
280 gaim_conversation_get_name(conv)); | |
281 } | |
282 | |
283 static void | |
284 deleting_conversation_cb(GaimConversation *conv, void *data) | |
285 { | |
286 gaim_debug(GAIM_DEBUG_MISC, "signals test", | |
287 "deleting-conversation (%s)\n", | |
288 gaim_conversation_get_name(conv)); | |
289 } | |
290 | |
291 static void | |
292 buddy_typing_cb(GaimConversation *conv, void *data) | |
293 { | |
294 gaim_debug(GAIM_DEBUG_MISC, "signals test", | |
295 "buddy-typing (%s)\n", | |
296 gaim_conversation_get_name(conv)); | |
297 } | |
298 | |
299 static void | |
300 chat_buddy_joining_cb(GaimConversation *conv, const char *user, void *data) | |
301 { | |
302 gaim_debug(GAIM_DEBUG_MISC, "signals test", | |
303 "chat-buddy-joining (%s, %s)\n", | |
304 gaim_conversation_get_name(conv), user); | |
305 } | |
306 | |
307 static void | |
308 chat_buddy_joined_cb(GaimConversation *conv, const char *user, void *data) | |
309 { | |
310 gaim_debug(GAIM_DEBUG_MISC, "signals test", | |
311 "chat-buddy-joined (%s, %s)\n", | |
312 gaim_conversation_get_name(conv), user); | |
313 } | |
314 | |
315 static void | |
316 chat_buddy_leaving_cb(GaimConversation *conv, const char *user, | |
317 const char *reason, void *data) | |
318 { | |
319 gaim_debug(GAIM_DEBUG_MISC, "signals test", | |
320 "chat-buddy-leaving (%s, %s, %s)\n", | |
321 gaim_conversation_get_name(conv), user, reason); | |
322 } | |
323 | |
324 static void | |
325 chat_buddy_left_cb(GaimConversation *conv, const char *user, | |
326 const char *reason, void *data) | |
327 { | |
328 gaim_debug(GAIM_DEBUG_MISC, "signals test", | |
329 "chat-buddy-left (%s, %s, %s)\n", | |
330 gaim_conversation_get_name(conv), user, reason); | |
331 } | |
332 | |
333 static void | |
334 chat_inviting_user_cb(GaimConversation *conv, const char *name, | |
335 const char *reason, void *data) | |
336 { | |
337 gaim_debug(GAIM_DEBUG_MISC, "signals test", | |
338 "chat-inviting-user (%s, %s, %s)\n", | |
339 gaim_conversation_get_name(conv), name, reason); | |
340 } | |
341 | |
342 static void | |
343 chat_invited_user_cb(GaimConversation *conv, const char *name, | |
344 const char *reason, void *data) | |
345 { | |
346 gaim_debug(GAIM_DEBUG_MISC, "signals test", | |
347 "chat-invited-user (%s, %s, %s)\n", | |
348 gaim_conversation_get_name(conv), name, reason); | |
349 } | |
350 | |
351 static void | |
352 chat_invited_cb(GaimAccount *account, const char *inviter, | |
353 const char *room_name, const char *message, void *data) | |
354 { | |
355 gaim_debug(GAIM_DEBUG_MISC, "signals test", | |
356 "chat-invited (%s, %s, %s, %s)\n", | |
357 gaim_account_get_username(account), inviter, | |
358 room_name, message); | |
359 } | |
360 | |
361 static void | |
362 chat_joined_cb(GaimConversation *conv, void *data) | |
363 { | |
364 gaim_debug(GAIM_DEBUG_MISC, "signals test", | |
365 "chat-joined (%s)\n", | |
366 gaim_conversation_get_name(conv)); | |
367 } | |
368 | |
369 static void | |
370 chat_left_cb(GaimConversation *conv, void *data) | |
371 { | |
372 gaim_debug(GAIM_DEBUG_MISC, "signals test", | |
373 "chat-left (%s)\n", | |
374 gaim_conversation_get_name(conv)); | |
375 } | |
376 | |
377 /************************************************************************** | |
378 * Core signal callbacks | |
379 **************************************************************************/ | |
380 static void | |
381 quitting_cb(void *data) | |
382 { | |
383 gaim_debug(GAIM_DEBUG_MISC, "signals test", | |
384 "quitting ()\n"); | |
385 } | |
386 | |
387 /************************************************************************** | |
388 * Plugin stuff | |
389 **************************************************************************/ | |
390 static gboolean | |
391 plugin_load(GaimPlugin *plugin) | |
392 { | |
393 void *core_handle = gaim_get_core(); | |
394 void *blist_handle = gaim_blist_get_handle(); | |
395 void *conn_handle = gaim_connections_get_handle(); | |
396 void *conv_handle = gaim_conversations_get_handle(); | |
397 void *accounts_handle = gaim_accounts_get_handle(); | |
398 | |
399 /* Accounts subsystem signals */ | |
400 gaim_signal_connect(accounts_handle, "account-connecting", | |
401 plugin, GAIM_CALLBACK(account_connecting_cb), NULL); | |
402 gaim_signal_connect(accounts_handle, "account-away", | |
403 plugin, GAIM_CALLBACK(account_away_cb), NULL); | |
404 gaim_signal_connect(accounts_handle, "account-setting-info", | |
405 plugin, GAIM_CALLBACK(account_setting_info_cb), NULL); | |
406 gaim_signal_connect(accounts_handle, "account-set-info", | |
407 plugin, GAIM_CALLBACK(account_set_info_cb), NULL); | |
408 gaim_signal_connect(accounts_handle, "account-warned", | |
409 plugin, GAIM_CALLBACK(account_warned_cb), NULL); | |
410 | |
411 /* Buddy List subsystem signals */ | |
412 gaim_signal_connect(blist_handle, "buddy-away", | |
413 plugin, GAIM_CALLBACK(buddy_away_cb), NULL); | |
414 gaim_signal_connect(blist_handle, "buddy-back", | |
415 plugin, GAIM_CALLBACK(buddy_back_cb), NULL); | |
416 gaim_signal_connect(blist_handle, "buddy-idle", | |
417 plugin, GAIM_CALLBACK(buddy_idle_cb), NULL); | |
418 gaim_signal_connect(blist_handle, "buddy-unidle", | |
419 plugin, GAIM_CALLBACK(buddy_unidle_cb), NULL); | |
420 gaim_signal_connect(blist_handle, "buddy-signed-on", | |
421 plugin, GAIM_CALLBACK(buddy_signed_on_cb), NULL); | |
422 gaim_signal_connect(blist_handle, "buddy-signed-off", | |
423 plugin, GAIM_CALLBACK(buddy_signed_off_cb), NULL); | |
424 | |
425 /* Connection subsystem signals */ | |
426 gaim_signal_connect(conn_handle, "signing-on", | |
427 plugin, GAIM_CALLBACK(signing_on_cb), NULL); | |
428 gaim_signal_connect(conn_handle, "signed-on", | |
429 plugin, GAIM_CALLBACK(signed_on_cb), NULL); | |
430 gaim_signal_connect(conn_handle, "signing-off", | |
431 plugin, GAIM_CALLBACK(signing_off_cb), NULL); | |
432 gaim_signal_connect(conn_handle, "signed-off", | |
433 plugin, GAIM_CALLBACK(signed_off_cb), NULL); | |
434 | |
435 /* Conversations subsystem signals */ | |
436 gaim_signal_connect(conv_handle, "displaying-im-msg", | |
437 plugin, GAIM_CALLBACK(displaying_im_msg_cb), NULL); | |
6489 | 438 gaim_signal_connect(conv_handle, "displayed-im-msg", |
6485 | 439 plugin, GAIM_CALLBACK(displayed_im_msg_cb), NULL); |
440 gaim_signal_connect(conv_handle, "sending-im-msg", | |
441 plugin, GAIM_CALLBACK(sending_im_msg_cb), NULL); | |
442 gaim_signal_connect(conv_handle, "sent-im-msg", | |
443 plugin, GAIM_CALLBACK(sent_im_msg_cb), NULL); | |
444 gaim_signal_connect(conv_handle, "received-im-msg", | |
445 plugin, GAIM_CALLBACK(received_im_msg_cb), NULL); | |
446 gaim_signal_connect(conv_handle, "displaying-chat-msg", | |
447 plugin, GAIM_CALLBACK(displaying_chat_msg_cb), NULL); | |
448 gaim_signal_connect(conv_handle, "displayed-chat-msg", | |
449 plugin, GAIM_CALLBACK(displayed_chat_msg_cb), NULL); | |
450 gaim_signal_connect(conv_handle, "sending-chat-msg", | |
451 plugin, GAIM_CALLBACK(sending_chat_msg_cb), NULL); | |
452 gaim_signal_connect(conv_handle, "sent-chat-msg", | |
453 plugin, GAIM_CALLBACK(sent_chat_msg_cb), NULL); | |
454 gaim_signal_connect(conv_handle, "received-chat-msg", | |
455 plugin, GAIM_CALLBACK(received_chat_msg_cb), NULL); | |
456 gaim_signal_connect(conv_handle, "conversation-switching", | |
457 plugin, GAIM_CALLBACK(conversation_switching_cb), NULL); | |
458 gaim_signal_connect(conv_handle, "conversation-switched", | |
459 plugin, GAIM_CALLBACK(conversation_switched_cb), NULL); | |
460 gaim_signal_connect(conv_handle, "conversation-created", | |
461 plugin, GAIM_CALLBACK(conversation_created_cb), NULL); | |
462 gaim_signal_connect(conv_handle, "deleting-conversation", | |
463 plugin, GAIM_CALLBACK(deleting_conversation_cb), NULL); | |
464 gaim_signal_connect(conv_handle, "buddy-typing", | |
465 plugin, GAIM_CALLBACK(buddy_typing_cb), NULL); | |
466 gaim_signal_connect(conv_handle, "chat-buddy-joining", | |
467 plugin, GAIM_CALLBACK(chat_buddy_joining_cb), NULL); | |
468 gaim_signal_connect(conv_handle, "chat-buddy-joined", | |
469 plugin, GAIM_CALLBACK(chat_buddy_joined_cb), NULL); | |
470 gaim_signal_connect(conv_handle, "chat-buddy-leaving", | |
471 plugin, GAIM_CALLBACK(chat_buddy_leaving_cb), NULL); | |
472 gaim_signal_connect(conv_handle, "chat-buddy-left", | |
473 plugin, GAIM_CALLBACK(chat_buddy_left_cb), NULL); | |
474 gaim_signal_connect(conv_handle, "chat-inviting-user", | |
475 plugin, GAIM_CALLBACK(chat_inviting_user_cb), NULL); | |
476 gaim_signal_connect(conv_handle, "chat-invited-user", | |
477 plugin, GAIM_CALLBACK(chat_invited_user_cb), NULL); | |
478 gaim_signal_connect(conv_handle, "chat-invited", | |
479 plugin, GAIM_CALLBACK(chat_invited_cb), NULL); | |
480 gaim_signal_connect(conv_handle, "chat-joined", | |
481 plugin, GAIM_CALLBACK(chat_joined_cb), NULL); | |
482 gaim_signal_connect(conv_handle, "chat-left", | |
483 plugin, GAIM_CALLBACK(chat_left_cb), NULL); | |
484 | |
485 /* Core signals */ | |
486 gaim_signal_connect(core_handle, "quitting", | |
487 plugin, GAIM_CALLBACK(quitting_cb), NULL); | |
488 | |
489 return TRUE; | |
490 } | |
491 | |
492 static GaimPluginInfo info = | |
493 { | |
494 2, /**< api_version */ | |
495 GAIM_PLUGIN_STANDARD, /**< type */ | |
496 NULL, /**< ui_requirement */ | |
497 0, /**< flags */ | |
498 NULL, /**< dependencies */ | |
499 GAIM_PRIORITY_DEFAULT, /**< priority */ | |
500 | |
501 SIGNAL_TEST_PLUGIN_ID, /**< id */ | |
502 N_("Signals Test"), /**< name */ | |
503 VERSION, /**< version */ | |
504 /** summary */ | |
505 N_("Test to see that all signals are working properly."), | |
506 /** description */ | |
507 N_("Test to see that all signals are working properly."), | |
508 "Christian Hammond <chipx86@gnupdate.org>", /**< author */ | |
509 GAIM_WEBSITE, /**< homepage */ | |
510 | |
511 plugin_load, /**< load */ | |
512 NULL, /**< unload */ | |
513 NULL, /**< destroy */ | |
514 | |
515 NULL, /**< ui_info */ | |
516 NULL /**< extra_info */ | |
517 }; | |
518 | |
519 static void | |
520 init_plugin(GaimPlugin *plugin) | |
521 { | |
522 } | |
523 | |
524 GAIM_INIT_PLUGIN(signalstest, init_plugin, info) |