Mercurial > pidgin
annotate plugins/events.c @ 5150:9a19c0a1e1be
[gaim-migrate @ 5514]
fix the bug where being forced to change your nick when you sign on to IRC
causes you to not be able to join any chats.
committer: Tailor Script <tailor@pidgin.im>
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Thu, 17 Apr 2003 23:40:37 +0000 |
parents | 4596276f5b12 |
children | fefad67de2c7 |
rev | line source |
---|---|
534 | 1 /* tester.c |
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 | |
11 #define GAIM_PLUGINS | |
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 { | |
151 printf("event_im_displayed_rcvd: %s %s %s %s\n", who, what, flags, time); | |
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 | |
164 static evt_del_conversation(struct conversation *c, void *data) | |
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 | |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
808
diff
changeset
|
174 char *gaim_plugin_init(GModule *h) |
534 | 175 { |
5090 | 176 gaim_signal_connect(h, event_signon, evt_signon, NULL); |
177 gaim_signal_connect(h, event_signoff, evt_signoff, NULL); | |
178 gaim_signal_connect(h, event_away, evt_away, NULL); | |
179 gaim_signal_connect(h, event_back, evt_back, NULL); | |
180 gaim_signal_connect(h, event_im_recv, evt_im_recv, NULL); | |
181 gaim_signal_connect(h, event_im_send, evt_im_send, NULL); | |
182 gaim_signal_connect(h, event_buddy_signon, evt_buddy_signon, NULL); | |
183 gaim_signal_connect(h, event_buddy_signoff, evt_buddy_signoff, NULL); | |
184 gaim_signal_connect(h, event_buddy_away, evt_buddy_away, NULL); | |
185 gaim_signal_connect(h, event_buddy_back, evt_buddy_back, NULL); | |
186 gaim_signal_connect(h, event_chat_invited, evt_chat_invited, NULL); | |
187 gaim_signal_connect(h, event_chat_join, evt_chat_join, NULL); | |
188 gaim_signal_connect(h, event_chat_leave, evt_chat_leave, NULL); | |
189 gaim_signal_connect(h, event_chat_buddy_join, evt_chat_buddy_join, NULL); | |
190 gaim_signal_connect(h, event_chat_buddy_leave, evt_chat_buddy_leave, NULL); | |
191 gaim_signal_connect(h, event_chat_recv, evt_chat_recv, NULL); | |
192 gaim_signal_connect(h, event_chat_send, evt_chat_send, NULL); | |
193 gaim_signal_connect(h, event_warned, evt_warned, NULL); | |
194 gaim_signal_connect(h, event_error, evt_error, NULL); | |
195 gaim_signal_connect(h, event_quit, evt_quit, NULL); | |
196 gaim_signal_connect(h, event_new_conversation, evt_new_conversation, NULL); | |
197 gaim_signal_connect(h, event_set_info, evt_set_info, NULL); | |
198 gaim_signal_connect(h, event_draw_menu, evt_draw_menu, NULL); | |
199 gaim_signal_connect(h, event_im_displayed_sent, evt_im_displayed_sent, NULL); | |
200 gaim_signal_connect(h, event_im_displayed_rcvd, evt_im_displayed_rcvd, NULL); | |
201 gaim_signal_connect(h, event_chat_send_invite, evt_chat_send_invite, NULL); | |
202 gaim_signal_connect(h, event_got_typing, evt_got_typing, NULL); | |
203 gaim_signal_connect(h, event_del_conversation, evt_del_conversation, NULL); | |
204 gaim_signal_connect(h, event_connecting, evt_connecting, NULL); | |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
808
diff
changeset
|
205 return NULL; |
534 | 206 } |
207 | |
3551 | 208 struct gaim_plugin_description desc; |
209 struct gaim_plugin_description *gaim_plugin_desc() { | |
210 desc.api_version = PLUGIN_API_VERSION; | |
211 desc.name = g_strdup("Event Tester"); | |
212 desc.version = g_strdup(VERSION); | |
213 desc.description = g_strdup("Test to see that all plugin events are working properly."); | |
214 desc.authors = g_strdup("Eric Warmehoven <eric@warmenhoven.org>"); | |
215 desc.url = g_strdup(WEBSITE); | |
216 return &desc; | |
217 } | |
218 | |
534 | 219 char *name() |
220 { | |
221 return "Event Test"; | |
222 } | |
223 | |
224 char *description() | |
225 { | |
226 return "Test to see that all events are working properly."; | |
227 } |