Mercurial > pidgin.yaz
annotate plugins/events.c @ 6439:650e9b73ba38
[gaim-migrate @ 6947]
"Even if the conversion was successful, this may be less than len if there were
partial characters at the end of the input."
committer: Tailor Script <tailor@pidgin.im>
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Tue, 12 Aug 2003 05:02:56 +0000 |
parents | 8f94cce8faa5 |
children |
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" |
6020 | 12 |
13 #include <stdio.h> | |
534 | 14 |
6020 | 15 #include "gtkplugin.h" |
16 #include "connection.h" | |
17 #include "conversation.h" | |
18 #include "internal.h" | |
19 | |
20 static void evt_signon(GaimConnection *gc, void *data) | |
779
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
21 { |
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
22 printf("event_signon\n"); |
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
23 } |
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
24 |
6020 | 25 static void evt_signoff(GaimConnection *gc, void *data) |
779
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
26 { |
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
27 printf("event_signoff\n"); |
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
28 } |
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
29 |
6020 | 30 static void evt_away(GaimConnection *gc, char *state, char *message, void *data) |
779
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
31 { |
6020 | 32 printf("event_away: %s %s %s\n", gaim_account_get_username(gaim_connection_get_account(gc)), |
33 state, message); | |
779
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
34 } |
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
35 |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
808
diff
changeset
|
36 static void evt_back(void *data) |
779
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 printf("event_back\n"); |
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
39 } |
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
40 |
6020 | 41 static void evt_im_recv(GaimConnection *gc, char **who, char **what, guint *flags, void *data) |
534 | 42 { |
779
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
43 printf("event_im_recv: %s %s\n", *who, *what); |
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
44 } |
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
45 |
6020 | 46 static void evt_im_send(GaimConnection *gc, char *who, char **what, void *data) |
779
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 printf("event_im_send: %s %s\n", who, *what); |
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
49 } |
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
50 |
6020 | 51 static void evt_buddy_signon(GaimConnection *gc, char *who, void *data) |
779
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 printf("event_buddy_signon: %s\n", who); |
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
54 } |
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
55 |
6020 | 56 static void evt_buddy_signoff(GaimConnection *gc, char *who, void *data) |
779
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 printf("event_buddy_signoff: %s\n", who); |
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
59 } |
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
60 |
6020 | 61 static void evt_buddy_away(GaimConnection *gc, char *who, void *data) |
779
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
62 { |
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
63 printf("event_buddy_away: %s\n", who); |
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
64 } |
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
65 |
6020 | 66 static void evt_buddy_back(GaimConnection *gc, char *who, void *data) |
779
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
67 { |
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
68 printf("event_buddy_back: %s\n", who); |
534 | 69 } |
70 | |
6020 | 71 static void evt_buddy_idle(GaimConnection *gc, char *who, void *data) |
5090 | 72 { |
73 printf("event_buddy_idle: %s\n", who); | |
74 } | |
75 | |
6020 | 76 static void evt_buddy_unidle(GaimConnection *gc, char *who, void *data) |
5090 | 77 { |
78 printf("event_buddy_unidle: %s\n", who); | |
79 } | |
80 | |
81 static void evt_blist_update(void *data) | |
82 { | |
83 printf("event_blist_update\n"); | |
84 } | |
85 | |
6020 | 86 static void evt_chat_invited(GaimConnection *gc, char *who, char *room, char *message, void *data) |
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 printf("event_chat_invited: %s %s %s\n", who, room, message); |
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
89 } |
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
90 |
6020 | 91 static void evt_chat_join(GaimConnection *gc, int id, void *data) |
534 | 92 { |
5090 | 93 printf("event_chat_join: %d\n", id); |
779
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
94 } |
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
95 |
6020 | 96 static void evt_chat_leave(GaimConnection *gc, int id, void *data) |
779
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
97 { |
5090 | 98 printf("event_chat_leave: %d\n", id); |
779
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
99 } |
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
100 |
6020 | 101 static void evt_chat_buddy_join(GaimConnection *gc, int id, char *who, void *data) |
779
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
102 { |
5090 | 103 printf("event_chat_buddy_join: %d %s\n", id, who); |
534 | 104 } |
105 | |
6020 | 106 static void evt_chat_buddy_leave(GaimConnection *gc, int id, char *who, void *data) |
534 | 107 { |
5090 | 108 printf("event_chat_buddy_leave: %d %s\n", id, who); |
779
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
109 } |
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
110 |
6020 | 111 static void evt_chat_recv(GaimConnection *gc, int id, char *who, char *text, void *data) |
779
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
112 { |
5090 | 113 printf("event_chat_recv: %d %s %s\n", id, who, text); |
534 | 114 } |
115 | |
6020 | 116 static void evt_chat_send(GaimConnection *gc, int id, char **what, void *data) |
779
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
117 { |
5090 | 118 printf("event_chat_send: %d %s\n", id, *what); |
779
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
119 } |
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
120 |
6020 | 121 static void evt_warned(GaimConnection *gc, char *who, int level, void *data) |
534 | 122 { |
779
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
123 printf("event_warned: %s %d\n", who, level); |
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
124 } |
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
125 |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
808
diff
changeset
|
126 static void evt_error(int error, void *data) |
779
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
127 { |
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
128 printf("event_error: %d\n", error); |
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
129 } |
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
130 |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
808
diff
changeset
|
131 static void evt_quit(void *data) |
779
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
132 { |
1823a4af82d3
[gaim-migrate @ 789]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
534
diff
changeset
|
133 printf("event_quit\n"); |
534 | 134 } |
135 | |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
808
diff
changeset
|
136 static void evt_new_conversation(char *who, void *data) |
808
9d61f3d01046
[gaim-migrate @ 818]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
779
diff
changeset
|
137 { |
9d61f3d01046
[gaim-migrate @ 818]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
779
diff
changeset
|
138 printf("event_new_conversation: %s\n", who); |
9d61f3d01046
[gaim-migrate @ 818]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
779
diff
changeset
|
139 } |
9d61f3d01046
[gaim-migrate @ 818]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
779
diff
changeset
|
140 |
6020 | 141 static void evt_set_info(GaimConnection *gc, char *info, void *data) |
5090 | 142 { |
143 printf("event_set_info: %s\n", info); | |
144 } | |
145 | |
146 static void evt_draw_menu(GtkWidget *menu, char *name, void *data) | |
147 { | |
148 printf("event_draw_menu: %s\n", name); | |
149 } | |
150 | |
6020 | 151 static void evt_im_displayed_sent(GaimConnection *gc, char *who, char **what, void *data) |
5090 | 152 { |
153 printf("event_im_displayed_sent: %s %s\n", who, *what); | |
154 } | |
155 | |
6020 | 156 static void evt_im_displayed_rcvd(GaimConnection *gc, char *who, char *what, guint32 flags, time_t time, void *data) |
5090 | 157 { |
5255 | 158 printf("event_im_displayed_rcvd: %s %s %u %u\n", who, what, flags, time); |
5090 | 159 } |
160 | |
6020 | 161 static void evt_chat_send_invite(GaimConnection *gc, int id, char *who, char **msg, void *data) |
5090 | 162 { |
163 printf("event_chat_send_invite: %d %s %s\n", id, who, *msg); | |
164 } | |
165 | |
6020 | 166 static void evt_got_typing(GaimConnection *gc, char *who, void *data) |
5090 | 167 { |
168 printf("event_got_typing: %s\n", who); | |
169 } | |
170 | |
6020 | 171 static void evt_del_conversation(GaimConversation *c, void *data) |
5090 | 172 { |
173 printf("event_del_conversation\n"); | |
174 } | |
175 | |
6020 | 176 static void evt_connecting(GaimAccount *u, void *data) |
5090 | 177 { |
178 printf("event_connecting\n"); | |
179 } | |
180 | |
6020 | 181 static void evt_change(GaimConversation *c) |
182 { | |
183 printf("event_conversation_switch\n"); | |
184 } | |
5255 | 185 |
186 /* | |
187 * EXPORTED FUNCTIONS | |
188 */ | |
189 | |
190 static gboolean | |
191 plugin_load(GaimPlugin *plugin) | |
534 | 192 { |
5255 | 193 gaim_signal_connect(plugin, event_signon, evt_signon, NULL); |
194 gaim_signal_connect(plugin, event_signoff, evt_signoff, NULL); | |
195 gaim_signal_connect(plugin, event_away, evt_away, NULL); | |
196 gaim_signal_connect(plugin, event_back, evt_back, NULL); | |
197 gaim_signal_connect(plugin, event_im_recv, evt_im_recv, NULL); | |
198 gaim_signal_connect(plugin, event_im_send, evt_im_send, NULL); | |
199 gaim_signal_connect(plugin, event_buddy_signon, evt_buddy_signon, NULL); | |
200 gaim_signal_connect(plugin, event_buddy_signoff, evt_buddy_signoff, NULL); | |
201 gaim_signal_connect(plugin, event_buddy_away, evt_buddy_away, NULL); | |
202 gaim_signal_connect(plugin, event_buddy_back, evt_buddy_back, NULL); | |
203 gaim_signal_connect(plugin, event_chat_invited, evt_chat_invited, NULL); | |
204 gaim_signal_connect(plugin, event_chat_join, evt_chat_join, NULL); | |
205 gaim_signal_connect(plugin, event_chat_leave, evt_chat_leave, NULL); | |
206 gaim_signal_connect(plugin, event_chat_buddy_join, evt_chat_buddy_join, NULL); | |
207 gaim_signal_connect(plugin, event_chat_buddy_leave, evt_chat_buddy_leave, NULL); | |
208 gaim_signal_connect(plugin, event_chat_recv, evt_chat_recv, NULL); | |
209 gaim_signal_connect(plugin, event_chat_send, evt_chat_send, NULL); | |
210 gaim_signal_connect(plugin, event_warned, evt_warned, NULL); | |
211 gaim_signal_connect(plugin, event_error, evt_error, NULL); | |
212 gaim_signal_connect(plugin, event_quit, evt_quit, NULL); | |
213 gaim_signal_connect(plugin, event_new_conversation, evt_new_conversation, NULL); | |
214 gaim_signal_connect(plugin, event_set_info, evt_set_info, NULL); | |
215 gaim_signal_connect(plugin, event_draw_menu, evt_draw_menu, NULL); | |
216 gaim_signal_connect(plugin, event_im_displayed_sent, evt_im_displayed_sent, NULL); | |
217 gaim_signal_connect(plugin, event_im_displayed_rcvd, evt_im_displayed_rcvd, NULL); | |
218 gaim_signal_connect(plugin, event_chat_send_invite, evt_chat_send_invite, NULL); | |
219 gaim_signal_connect(plugin, event_got_typing, evt_got_typing, NULL); | |
220 gaim_signal_connect(plugin, event_del_conversation, evt_del_conversation, NULL); | |
221 gaim_signal_connect(plugin, event_connecting, evt_connecting, NULL); | |
6020 | 222 gaim_signal_connect(plugin, event_conversation_switch, evt_change, NULL); |
5255 | 223 return TRUE; |
534 | 224 } |
225 | |
5255 | 226 static GaimPluginInfo info = |
227 { | |
228 2, /**< api_version */ | |
229 GAIM_PLUGIN_STANDARD, /**< type */ | |
230 NULL, /**< ui_requirement */ | |
231 0, /**< flags */ | |
232 NULL, /**< dependencies */ | |
233 GAIM_PRIORITY_DEFAULT, /**< priority */ | |
234 | |
235 EVENTTEST_PLUGIN_ID, /**< id */ | |
236 N_("Event Test"), /**< name */ | |
237 VERSION, /**< version */ | |
238 /** summary */ | |
239 N_("Test to see that all events are working properly."), | |
240 /** description */ | |
241 N_("Test to see that all events are working properly."), | |
242 "Eric Warmenhoven <eric@warmenhoven.org>", /**< author */ | |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6063
diff
changeset
|
243 GAIM_WEBSITE, /**< homepage */ |
5255 | 244 |
245 plugin_load, /**< load */ | |
246 NULL, /**< unload */ | |
247 NULL, /**< destroy */ | |
248 | |
249 NULL, /**< ui_info */ | |
250 NULL /**< extra_info */ | |
251 }; | |
252 | |
253 static void | |
5920
7d385de2f9cd
[gaim-migrate @ 6360]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
254 init_plugin(GaimPlugin *plugin) |
5255 | 255 { |
3551 | 256 } |
257 | |
6063 | 258 GAIM_INIT_PLUGIN(eventtester, init_plugin, info) |