File: | fe-common/irc/fe-events.c |
Location: | line 240, column 20 |
Description: | Value stored to 'nick' is never read |
1 | /* |
2 | fe-events.c : irssi |
3 | |
4 | Copyright (C) 1999-2000 Timo Sirainen |
5 | |
6 | This program is free software; you can redistribute it and/or modify |
7 | it under the terms of the GNU General Public License as published by |
8 | the Free Software Foundation; either version 2 of the License, or |
9 | (at your option) any later version. |
10 | |
11 | This program is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | GNU General Public License for more details. |
15 | |
16 | You should have received a copy of the GNU General Public License along |
17 | with this program; if not, write to the Free Software Foundation, Inc., |
18 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
19 | */ |
20 | |
21 | #include "module.h" |
22 | #include "module-formats.h" |
23 | #include "signals.h" |
24 | #include "misc.h" |
25 | #include "settings.h" |
26 | |
27 | #include "levels.h" |
28 | #include "servers.h" |
29 | #include "servers-redirect.h" |
30 | #include "servers-reconnect.h" |
31 | #include "queries.h" |
32 | #include "ignore.h" |
33 | #include "recode.h" |
34 | |
35 | #include "irc-servers.h" |
36 | #include "irc-channels.h" |
37 | #include "irc-nicklist.h" |
38 | #include "irc-masks.h" |
39 | |
40 | #include "printtext.h" |
41 | #include "fe-queries.h" |
42 | #include "fe-windows.h" |
43 | #include "fe-irc-server.h" |
44 | |
45 | static void event_privmsg(IRC_SERVER_REC *server, const char *data, |
46 | const char *nick, const char *addr) |
47 | { |
48 | char *params, *target, *msg, *recoded; |
49 | |
50 | g_return_if_fail(data != NULL)do{ if (data != ((void *)0)) { } else { g_return_if_fail_warning (((gchar*) 0), __PRETTY_FUNCTION__, "data != NULL"); return; }; }while (0); |
51 | |
52 | params = event_get_params(data, 2 | PARAM_FLAG_GETREST0x00002000, &target, &msg); |
53 | if (nick == NULL((void *)0)) nick = server->real_address; |
54 | if (addr == NULL((void *)0)) addr = ""; |
55 | if (*target == '@' && ischannel(target[1])((target[1]) == '#' || (target[1]) == '&' || (target[1]) == '!' || (target[1]) == '+')) { |
56 | /* Hybrid 6 feature, send msg to all ops in channel */ |
57 | recoded = recode_in(SERVER(server)((SERVER_REC *) module_check_cast(server, __builtin_offsetof( SERVER_REC, type), "SERVER")), msg, target+1); |
58 | signal_emit("message irc op_public", 5, |
59 | server, recoded, nick, addr, |
60 | get_visible_target(server, target+1)); |
61 | } else { |
62 | recoded = recode_in(SERVER(server)((SERVER_REC *) module_check_cast(server, __builtin_offsetof( SERVER_REC, type), "SERVER")), msg, ischannel(*target)((*target) == '#' || (*target) == '&' || (*target) == '!' || (*target) == '+') ? target : nick); |
63 | signal_emit(ischannel(*target)((*target) == '#' || (*target) == '&' || (*target) == '!' || (*target) == '+') ? |
64 | "message public" : "message private", 5, |
65 | server, recoded, nick, addr, |
66 | get_visible_target(server, target)); |
67 | } |
68 | |
69 | g_free(params); |
70 | g_free(recoded); |
71 | } |
72 | |
73 | static void ctcp_action(IRC_SERVER_REC *server, const char *data, |
74 | const char *nick, const char *addr, |
75 | const char *target) |
76 | { |
77 | char *recoded; |
78 | |
79 | g_return_if_fail(data != NULL)do{ if (data != ((void *)0)) { } else { g_return_if_fail_warning (((gchar*) 0), __PRETTY_FUNCTION__, "data != NULL"); return; }; }while (0); |
80 | recoded = recode_in(SERVER(server)((SERVER_REC *) module_check_cast(server, __builtin_offsetof( SERVER_REC, type), "SERVER")), data, target); |
81 | signal_emit("message irc action", 5, |
82 | server, recoded, nick, addr, |
83 | get_visible_target(server, target)); |
84 | g_free(recoded); |
85 | } |
86 | |
87 | static void event_notice(IRC_SERVER_REC *server, const char *data, |
88 | const char *nick, const char *addr) |
89 | { |
90 | char *params, *target, *msg, *recoded; |
91 | |
92 | g_return_if_fail(data != NULL)do{ if (data != ((void *)0)) { } else { g_return_if_fail_warning (((gchar*) 0), __PRETTY_FUNCTION__, "data != NULL"); return; }; }while (0); |
93 | |
94 | params = event_get_params(data, 2 | PARAM_FLAG_GETREST0x00002000, &target, &msg); |
95 | recoded = recode_in(SERVER(server)((SERVER_REC *) module_check_cast(server, __builtin_offsetof( SERVER_REC, type), "SERVER")), msg, target); |
96 | if (nick == NULL((void *)0)) { |
97 | nick = server->real_address == NULL((void *)0) ? |
98 | server->connrec->address : |
99 | server->real_address; |
100 | } |
101 | |
102 | signal_emit("message irc notice", 5, server, recoded, nick, addr, |
103 | get_visible_target(server, target)); |
104 | g_free(params); |
105 | g_free(recoded); |
106 | } |
107 | |
108 | static void event_join(IRC_SERVER_REC *server, const char *data, |
109 | const char *nick, const char *addr) |
110 | { |
111 | char *params, *channel, *tmp; |
112 | |
113 | g_return_if_fail(data != NULL)do{ if (data != ((void *)0)) { } else { g_return_if_fail_warning (((gchar*) 0), __PRETTY_FUNCTION__, "data != NULL"); return; }; }while (0); |
114 | |
115 | params = event_get_params(data, 1, &channel); |
116 | tmp = strchr(channel, 7); /* ^G does something weird.. */ |
117 | if (tmp != NULL((void *)0)) *tmp = '\0'; |
118 | |
119 | signal_emit("message join", 4, server, |
120 | get_visible_target(server, channel), nick, addr); |
121 | g_free(params); |
122 | } |
123 | |
124 | static void event_part(IRC_SERVER_REC *server, const char *data, |
125 | const char *nick, const char *addr) |
126 | { |
127 | char *params, *channel, *reason, *recoded; |
128 | |
129 | g_return_if_fail(data != NULL)do{ if (data != ((void *)0)) { } else { g_return_if_fail_warning (((gchar*) 0), __PRETTY_FUNCTION__, "data != NULL"); return; }; }while (0); |
130 | |
131 | params = event_get_params(data, 2 | PARAM_FLAG_GETREST0x00002000, |
132 | &channel, &reason); |
133 | recoded = recode_in(SERVER(server)((SERVER_REC *) module_check_cast(server, __builtin_offsetof( SERVER_REC, type), "SERVER")), reason, channel); |
134 | signal_emit("message part", 5, server, |
135 | get_visible_target(server, channel), nick, addr, recoded); |
136 | g_free(params); |
137 | g_free(recoded); |
138 | } |
139 | |
140 | static void event_quit(IRC_SERVER_REC *server, const char *data, |
141 | const char *nick, const char *addr) |
142 | { |
143 | char *recoded; |
144 | |
145 | g_return_if_fail(data != NULL)do{ if (data != ((void *)0)) { } else { g_return_if_fail_warning (((gchar*) 0), __PRETTY_FUNCTION__, "data != NULL"); return; }; }while (0); |
146 | |
147 | if (*data == ':') data++; /* quit message */ |
148 | recoded = recode_in(SERVER(server)((SERVER_REC *) module_check_cast(server, __builtin_offsetof( SERVER_REC, type), "SERVER")), data, nick); |
149 | signal_emit("message quit", 4, server, nick, addr, recoded); |
150 | g_free(recoded); |
151 | } |
152 | |
153 | static void event_kick(IRC_SERVER_REC *server, const char *data, |
154 | const char *kicker, const char *addr) |
155 | { |
156 | char *params, *channel, *nick, *reason, *recoded; |
157 | |
158 | g_return_if_fail(data != NULL)do{ if (data != ((void *)0)) { } else { g_return_if_fail_warning (((gchar*) 0), __PRETTY_FUNCTION__, "data != NULL"); return; }; }while (0); |
159 | |
160 | params = event_get_params(data, 3 | PARAM_FLAG_GETREST0x00002000, |
161 | &channel, &nick, &reason); |
162 | recoded = recode_in(SERVER(server)((SERVER_REC *) module_check_cast(server, __builtin_offsetof( SERVER_REC, type), "SERVER")), reason, channel); |
163 | signal_emit("message kick", 6, |
164 | server, get_visible_target(server, channel), |
165 | nick, kicker, addr, recoded); |
166 | g_free(params); |
167 | g_free(recoded); |
168 | } |
169 | |
170 | static void event_kill(IRC_SERVER_REC *server, const char *data, |
171 | const char *nick, const char *addr) |
172 | { |
173 | char *params, *path, *reason; |
174 | |
175 | g_return_if_fail(data != NULL)do{ if (data != ((void *)0)) { } else { g_return_if_fail_warning (((gchar*) 0), __PRETTY_FUNCTION__, "data != NULL"); return; }; }while (0); |
176 | |
177 | params = event_get_params(data, 2 | PARAM_FLAG_GETREST0x00002000, |
178 | NULL((void *)0), &path); |
179 | reason = strstr(path, " ("); |
180 | if (reason == NULL((void *)0) || reason[strlen(reason)-1] != ')') { |
181 | /* weird server, maybe it didn't give path */ |
182 | reason = path; |
183 | path = ""; |
184 | } else { |
185 | /* reason inside (...) */ |
186 | *reason = '\0'; |
187 | reason += 2; |
188 | reason[strlen(reason)-1] = '\0'; |
189 | } |
190 | |
191 | if (addr != NULL((void *)0)) { |
192 | printformat(server, NULL, MSGLEVEL_CRAP, IRCTXT_KILL,printformat_module("fe-common/irc", server, ((void *)0), MSGLEVEL_CRAP , IRCTXT_KILL, nick, addr, reason, path) |
193 | nick, addr, reason, path)printformat_module("fe-common/irc", server, ((void *)0), MSGLEVEL_CRAP , IRCTXT_KILL, nick, addr, reason, path); |
194 | } else { |
195 | printformat(server, NULL, MSGLEVEL_CRAP, IRCTXT_KILL_SERVER,printformat_module("fe-common/irc", server, ((void *)0), MSGLEVEL_CRAP , IRCTXT_KILL_SERVER, nick, reason, path) |
196 | nick, reason, path)printformat_module("fe-common/irc", server, ((void *)0), MSGLEVEL_CRAP , IRCTXT_KILL_SERVER, nick, reason, path); |
197 | } |
198 | |
199 | g_free(params); |
200 | } |
201 | |
202 | static void event_nick(IRC_SERVER_REC *server, const char *data, |
203 | const char *sender, const char *addr) |
204 | { |
205 | char *params, *newnick; |
206 | |
207 | g_return_if_fail(data != NULL)do{ if (data != ((void *)0)) { } else { g_return_if_fail_warning (((gchar*) 0), __PRETTY_FUNCTION__, "data != NULL"); return; }; }while (0); |
208 | |
209 | params = event_get_params(data, 1, &newnick); |
210 | |
211 | /* NOTE: server->nick was already changed in irc/core/irc-nicklist.c */ |
212 | signal_emit(g_strcasecmp(newnick, server->nick) == 0 ? |
213 | "message own_nick" : "message nick", 4, |
214 | server, newnick, sender, addr); |
215 | |
216 | g_free(params); |
217 | } |
218 | |
219 | static void event_mode(IRC_SERVER_REC *server, const char *data, |
220 | const char *nick, const char *addr) |
221 | { |
222 | char *params, *channel, *mode; |
223 | |
224 | g_return_if_fail(data != NULL)do{ if (data != ((void *)0)) { } else { g_return_if_fail_warning (((gchar*) 0), __PRETTY_FUNCTION__, "data != NULL"); return; }; }while (0); |
225 | |
226 | params = event_get_params(data, 2 | PARAM_FLAG_GETREST0x00002000, |
227 | &channel, &mode); |
228 | |
229 | signal_emit("message irc mode", 5, |
230 | server, get_visible_target(server, channel), |
231 | nick, addr, g_strchomp(mode)); |
232 | g_free(params); |
233 | } |
234 | |
235 | static void event_pong(IRC_SERVER_REC *server, const char *data, const char *nick) |
236 | { |
237 | char *params, *host, *reply; |
238 | |
239 | g_return_if_fail(data != NULL)do{ if (data != ((void *)0)) { } else { g_return_if_fail_warning (((gchar*) 0), __PRETTY_FUNCTION__, "data != NULL"); return; }; }while (0); |
240 | if (nick == NULL((void *)0)) nick = server->real_address; |
Value stored to 'nick' is never read | |
241 | |
242 | params = event_get_params(data, 2 | PARAM_FLAG_GETREST0x00002000, &host, &reply); |
243 | printformat(server, NULL, MSGLEVEL_CRAP, IRCTXT_PONG, host, reply)printformat_module("fe-common/irc", server, ((void *)0), MSGLEVEL_CRAP , IRCTXT_PONG, host, reply); |
244 | g_free(params); |
245 | } |
246 | |
247 | static void event_invite(IRC_SERVER_REC *server, const char *data, |
248 | const char *nick, const char *addr) |
249 | { |
250 | char *params, *channel; |
251 | |
252 | g_return_if_fail(data != NULL)do{ if (data != ((void *)0)) { } else { g_return_if_fail_warning (((gchar*) 0), __PRETTY_FUNCTION__, "data != NULL"); return; }; }while (0); |
253 | |
254 | params = event_get_params(data, 2, NULL((void *)0), &channel); |
255 | signal_emit("message invite", 4, |
256 | server, get_visible_target(server, channel), nick, addr); |
257 | g_free(params); |
258 | } |
259 | |
260 | static void event_topic(IRC_SERVER_REC *server, const char *data, |
261 | const char *nick, const char *addr) |
262 | { |
263 | char *params, *channel, *topic, *recoded; |
264 | |
265 | g_return_if_fail(data != NULL)do{ if (data != ((void *)0)) { } else { g_return_if_fail_warning (((gchar*) 0), __PRETTY_FUNCTION__, "data != NULL"); return; }; }while (0); |
266 | |
267 | params = event_get_params(data, 2 | PARAM_FLAG_GETREST0x00002000, |
268 | &channel, &topic); |
269 | recoded = recode_in(SERVER(server)((SERVER_REC *) module_check_cast(server, __builtin_offsetof( SERVER_REC, type), "SERVER")), topic, channel); |
270 | signal_emit("message topic", 5, server, |
271 | get_visible_target(server, channel), recoded, nick, addr); |
272 | g_free(params); |
273 | g_free(recoded); |
274 | } |
275 | |
276 | static void event_error(IRC_SERVER_REC *server, const char *data) |
277 | { |
278 | g_return_if_fail(data != NULL)do{ if (data != ((void *)0)) { } else { g_return_if_fail_warning (((gchar*) 0), __PRETTY_FUNCTION__, "data != NULL"); return; }; }while (0); |
279 | |
280 | if (*data == ':') data++; |
281 | printformat(server, NULL, MSGLEVEL_CRAP, IRCTXT_ERROR, data)printformat_module("fe-common/irc", server, ((void *)0), MSGLEVEL_CRAP , IRCTXT_ERROR, data); |
282 | } |
283 | |
284 | static void event_wallops(IRC_SERVER_REC *server, const char *data, const char *nick, const char *addr) |
285 | { |
286 | g_return_if_fail(data != NULL)do{ if (data != ((void *)0)) { } else { g_return_if_fail_warning (((gchar*) 0), __PRETTY_FUNCTION__, "data != NULL"); return; }; }while (0); |
287 | |
288 | if (*data == ':') data++; |
289 | if (ignore_check(SERVER(server)((SERVER_REC *) module_check_cast(server, __builtin_offsetof( SERVER_REC, type), "SERVER")), nick, addr, NULL((void *)0), data, MSGLEVEL_WALLOPS)) |
290 | return; |
291 | |
292 | if (g_ascii_strncasecmp(data, "\001ACTION ", 8) != 0) |
293 | printformat(server, NULL, MSGLEVEL_WALLOPS, IRCTXT_WALLOPS, nick, data)printformat_module("fe-common/irc", server, ((void *)0), MSGLEVEL_WALLOPS , IRCTXT_WALLOPS, nick, data); |
294 | else { |
295 | /* Action in WALLOP */ |
296 | int len; |
297 | char *tmp; |
298 | |
299 | tmp = g_strdup(data+8); |
300 | len = strlen(tmp); |
301 | if (tmp[len-1] == 1) tmp[len-1] = '\0'; |
302 | printformat(server, NULL, MSGLEVEL_WALLOPS, IRCTXT_ACTION_WALLOPS, nick, tmp)printformat_module("fe-common/irc", server, ((void *)0), MSGLEVEL_WALLOPS , IRCTXT_ACTION_WALLOPS, nick, tmp); |
303 | g_free(tmp); |
304 | } |
305 | } |
306 | |
307 | static void event_silence(IRC_SERVER_REC *server, const char *data, const char *nick, const char *addr) |
308 | { |
309 | g_return_if_fail(data != NULL)do{ if (data != ((void *)0)) { } else { g_return_if_fail_warning (((gchar*) 0), __PRETTY_FUNCTION__, "data != NULL"); return; }; }while (0); |
310 | |
311 | g_return_if_fail(*data == '+' || *data == '-')do{ if (*data == '+' || *data == '-') { } else { g_return_if_fail_warning (((gchar*) 0), __PRETTY_FUNCTION__, "*data == '+' || *data == '-'" ); return; }; }while (0); |
312 | |
313 | printformat(server, NULL, MSGLEVEL_CRAP, *data == '+' ? IRCTXT_SILENCED : IRCTXT_UNSILENCED, data+1)printformat_module("fe-common/irc", server, ((void *)0), MSGLEVEL_CRAP , *data == '+' ? IRCTXT_SILENCED : IRCTXT_UNSILENCED, data+1); |
314 | } |
315 | |
316 | static void channel_sync(CHANNEL_REC *channel) |
317 | { |
318 | g_return_if_fail(channel != NULL)do{ if (channel != ((void *)0)) { } else { g_return_if_fail_warning (((gchar*) 0), __PRETTY_FUNCTION__, "channel != NULL"); return ; }; }while (0); |
319 | |
320 | printformat(channel->server, channel->visible_name,printformat_module("fe-common/irc", channel->server, channel ->visible_name, MSGLEVEL_CLIENTNOTICE|MSGLEVEL_NO_ACT, IRCTXT_CHANNEL_SYNCED , channel->visible_name, (long) (time(((void *)0))-channel ->createtime)) |
321 | MSGLEVEL_CLIENTNOTICE|MSGLEVEL_NO_ACT,printformat_module("fe-common/irc", channel->server, channel ->visible_name, MSGLEVEL_CLIENTNOTICE|MSGLEVEL_NO_ACT, IRCTXT_CHANNEL_SYNCED , channel->visible_name, (long) (time(((void *)0))-channel ->createtime)) |
322 | IRCTXT_CHANNEL_SYNCED, channel->visible_name,printformat_module("fe-common/irc", channel->server, channel ->visible_name, MSGLEVEL_CLIENTNOTICE|MSGLEVEL_NO_ACT, IRCTXT_CHANNEL_SYNCED , channel->visible_name, (long) (time(((void *)0))-channel ->createtime)) |
323 | (long) (time(NULL)-channel->createtime))printformat_module("fe-common/irc", channel->server, channel ->visible_name, MSGLEVEL_CLIENTNOTICE|MSGLEVEL_NO_ACT, IRCTXT_CHANNEL_SYNCED , channel->visible_name, (long) (time(((void *)0))-channel ->createtime)); |
324 | } |
325 | |
326 | static void event_connected(IRC_SERVER_REC *server) |
327 | { |
328 | const char *nick; |
329 | |
330 | g_return_if_fail(server != NULL)do{ if (server != ((void *)0)) { } else { g_return_if_fail_warning (((gchar*) 0), __PRETTY_FUNCTION__, "server != NULL"); return ; }; }while (0); |
331 | |
332 | nick = server->connrec->nick; |
333 | if (g_strcasecmp(server->nick, nick) == 0) |
334 | return; |
335 | |
336 | /* someone has our nick, find out who. */ |
337 | server_redirect_event(server, "whois", 1, nick, TRUE(!(0)), NULL((void *)0), |
338 | "event 311", "nickfind event whois", |
339 | "", "event empty", NULL((void *)0)); |
340 | irc_send_cmdv(server, "WHOIS %s", nick); |
341 | } |
342 | |
343 | static void event_nickfind_whois(IRC_SERVER_REC *server, const char *data) |
344 | { |
345 | char *params, *nick, *user, *host, *realname; |
346 | |
347 | g_return_if_fail(data != NULL)do{ if (data != ((void *)0)) { } else { g_return_if_fail_warning (((gchar*) 0), __PRETTY_FUNCTION__, "data != NULL"); return; }; }while (0); |
348 | |
349 | params = event_get_params(data, 6, NULL((void *)0), &nick, &user, &host, NULL((void *)0), &realname); |
350 | printformat(server, NULL, MSGLEVEL_CLIENTNOTICE, IRCTXT_YOUR_NICK_OWNED, nick, user, host, realname)printformat_module("fe-common/irc", server, ((void *)0), MSGLEVEL_CLIENTNOTICE , IRCTXT_YOUR_NICK_OWNED, nick, user, host, realname); |
351 | g_free(params); |
352 | } |
353 | |
354 | static void event_ban_type_changed(void *ban_typep) |
355 | { |
356 | GString *str; |
357 | int ban_type; |
358 | |
359 | ban_type = GPOINTER_TO_INT(ban_typep)((gint) (ban_typep)); |
360 | |
361 | if (ban_type == 0) { |
362 | printformat(NULL, NULL, MSGLEVEL_CLIENTERROR,printformat_module("fe-common/irc", ((void *)0), ((void *)0), MSGLEVEL_CLIENTERROR, IRCTXT_BANTYPE, "Error, using Normal") |
363 | IRCTXT_BANTYPE, "Error, using Normal")printformat_module("fe-common/irc", ((void *)0), ((void *)0), MSGLEVEL_CLIENTERROR, IRCTXT_BANTYPE, "Error, using Normal"); |
364 | return; |
365 | } |
366 | |
367 | if (ban_type == (IRC_MASK_USER0x02|IRC_MASK_DOMAIN0x08)) { |
368 | printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE,printformat_module("fe-common/irc", ((void *)0), ((void *)0), MSGLEVEL_CLIENTNOTICE, IRCTXT_BANTYPE, "Normal") |
369 | IRCTXT_BANTYPE, "Normal")printformat_module("fe-common/irc", ((void *)0), ((void *)0), MSGLEVEL_CLIENTNOTICE, IRCTXT_BANTYPE, "Normal"); |
370 | } else if (ban_type == (IRC_MASK_HOST0x04|IRC_MASK_DOMAIN0x08)) { |
371 | printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE,printformat_module("fe-common/irc", ((void *)0), ((void *)0), MSGLEVEL_CLIENTNOTICE, IRCTXT_BANTYPE, "Host") |
372 | IRCTXT_BANTYPE, "Host")printformat_module("fe-common/irc", ((void *)0), ((void *)0), MSGLEVEL_CLIENTNOTICE, IRCTXT_BANTYPE, "Host"); |
373 | } else if (ban_type == IRC_MASK_DOMAIN0x08) { |
374 | printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE,printformat_module("fe-common/irc", ((void *)0), ((void *)0), MSGLEVEL_CLIENTNOTICE, IRCTXT_BANTYPE, "Domain") |
375 | IRCTXT_BANTYPE, "Domain")printformat_module("fe-common/irc", ((void *)0), ((void *)0), MSGLEVEL_CLIENTNOTICE, IRCTXT_BANTYPE, "Domain"); |
376 | } else { |
377 | str = g_string_new("Custom:"); |
378 | if (ban_type & IRC_MASK_NICK0x01) |
379 | g_string_append(str, " Nick"); |
380 | if (ban_type & IRC_MASK_USER0x02) |
381 | g_string_append(str, " User"); |
382 | if (ban_type & IRC_MASK_HOST0x04) |
383 | g_string_append(str, " Host"); |
384 | if (ban_type & IRC_MASK_DOMAIN0x08) |
385 | g_string_append(str, " Domain"); |
386 | |
387 | printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE,printformat_module("fe-common/irc", ((void *)0), ((void *)0), MSGLEVEL_CLIENTNOTICE, IRCTXT_BANTYPE, str->str) |
388 | IRCTXT_BANTYPE, str->str)printformat_module("fe-common/irc", ((void *)0), ((void *)0), MSGLEVEL_CLIENTNOTICE, IRCTXT_BANTYPE, str->str); |
389 | g_string_free(str, TRUE(!(0))); |
390 | } |
391 | } |
392 | |
393 | static void sig_whois_event_not_found(IRC_SERVER_REC *server, const char *data) |
394 | { |
395 | char *params, *nick; |
396 | |
397 | g_return_if_fail(data != NULL)do{ if (data != ((void *)0)) { } else { g_return_if_fail_warning (((gchar*) 0), __PRETTY_FUNCTION__, "data != NULL"); return; }; }while (0); |
398 | |
399 | params = event_get_params(data, 2, NULL((void *)0), &nick); |
400 | printformat(server, nick, MSGLEVEL_CRAP, IRCTXT_WHOIS_NOT_FOUND, nick)printformat_module("fe-common/irc", server, nick, MSGLEVEL_CRAP , IRCTXT_WHOIS_NOT_FOUND, nick); |
401 | g_free(params); |
402 | } |
403 | |
404 | static void sig_whowas_event_end(IRC_SERVER_REC *server, const char *data, |
405 | const char *sender, const char *addr) |
406 | { |
407 | char *params, *nick; |
408 | |
409 | g_return_if_fail(data != NULL)do{ if (data != ((void *)0)) { } else { g_return_if_fail_warning (((gchar*) 0), __PRETTY_FUNCTION__, "data != NULL"); return; }; }while (0); |
410 | |
411 | if (server->whowas_found) { |
412 | signal_emit("event 369", 4, server, data, sender, addr); |
413 | return; |
414 | } |
415 | |
416 | params = event_get_params(data, 2, NULL((void *)0), &nick); |
417 | printformat(server, nick, MSGLEVEL_CRAP, IRCTXT_WHOIS_NOT_FOUND, nick)printformat_module("fe-common/irc", server, nick, MSGLEVEL_CRAP , IRCTXT_WHOIS_NOT_FOUND, nick); |
418 | g_free(params); |
419 | } |
420 | |
421 | static void event_received(IRC_SERVER_REC *server, const char *data, |
422 | const char *nick, const char *addr) |
423 | { |
424 | if (!i_isdigit(*data)__isctype(((int) (unsigned char) (*data)), 0x00000400L)) { |
425 | printtext(server, NULL((void *)0), MSGLEVEL_CRAP, "%s", data); |
426 | return; |
427 | } |
428 | |
429 | /* numeric event. */ |
430 | signal_emit("default event numeric", 4, server, data, nick, addr); |
431 | } |
432 | |
433 | void fe_events_init(void) |
434 | { |
435 | signal_add("event privmsg", (SIGNAL_FUNC) event_privmsg)signal_add_full("fe-common/irc", 0, ("event privmsg"), (SIGNAL_FUNC ) ((SIGNAL_FUNC) event_privmsg), ((void *)0)); |
436 | signal_add("ctcp action", (SIGNAL_FUNC) ctcp_action)signal_add_full("fe-common/irc", 0, ("ctcp action"), (SIGNAL_FUNC ) ((SIGNAL_FUNC) ctcp_action), ((void *)0)); |
437 | signal_add("event notice", (SIGNAL_FUNC) event_notice)signal_add_full("fe-common/irc", 0, ("event notice"), (SIGNAL_FUNC ) ((SIGNAL_FUNC) event_notice), ((void *)0)); |
438 | signal_add("event join", (SIGNAL_FUNC) event_join)signal_add_full("fe-common/irc", 0, ("event join"), (SIGNAL_FUNC ) ((SIGNAL_FUNC) event_join), ((void *)0)); |
439 | signal_add("event part", (SIGNAL_FUNC) event_part)signal_add_full("fe-common/irc", 0, ("event part"), (SIGNAL_FUNC ) ((SIGNAL_FUNC) event_part), ((void *)0)); |
440 | signal_add("event quit", (SIGNAL_FUNC) event_quit)signal_add_full("fe-common/irc", 0, ("event quit"), (SIGNAL_FUNC ) ((SIGNAL_FUNC) event_quit), ((void *)0)); |
441 | signal_add("event kick", (SIGNAL_FUNC) event_kick)signal_add_full("fe-common/irc", 0, ("event kick"), (SIGNAL_FUNC ) ((SIGNAL_FUNC) event_kick), ((void *)0)); |
442 | signal_add("event kill", (SIGNAL_FUNC) event_kill)signal_add_full("fe-common/irc", 0, ("event kill"), (SIGNAL_FUNC ) ((SIGNAL_FUNC) event_kill), ((void *)0)); |
443 | signal_add("event nick", (SIGNAL_FUNC) event_nick)signal_add_full("fe-common/irc", 0, ("event nick"), (SIGNAL_FUNC ) ((SIGNAL_FUNC) event_nick), ((void *)0)); |
444 | signal_add("event mode", (SIGNAL_FUNC) event_mode)signal_add_full("fe-common/irc", 0, ("event mode"), (SIGNAL_FUNC ) ((SIGNAL_FUNC) event_mode), ((void *)0)); |
445 | signal_add("event pong", (SIGNAL_FUNC) event_pong)signal_add_full("fe-common/irc", 0, ("event pong"), (SIGNAL_FUNC ) ((SIGNAL_FUNC) event_pong), ((void *)0)); |
446 | signal_add("event invite", (SIGNAL_FUNC) event_invite)signal_add_full("fe-common/irc", 0, ("event invite"), (SIGNAL_FUNC ) ((SIGNAL_FUNC) event_invite), ((void *)0)); |
447 | signal_add("event topic", (SIGNAL_FUNC) event_topic)signal_add_full("fe-common/irc", 0, ("event topic"), (SIGNAL_FUNC ) ((SIGNAL_FUNC) event_topic), ((void *)0)); |
448 | signal_add("event error", (SIGNAL_FUNC) event_error)signal_add_full("fe-common/irc", 0, ("event error"), (SIGNAL_FUNC ) ((SIGNAL_FUNC) event_error), ((void *)0)); |
449 | signal_add("event wallops", (SIGNAL_FUNC) event_wallops)signal_add_full("fe-common/irc", 0, ("event wallops"), (SIGNAL_FUNC ) ((SIGNAL_FUNC) event_wallops), ((void *)0)); |
450 | signal_add("event silence", (SIGNAL_FUNC) event_silence)signal_add_full("fe-common/irc", 0, ("event silence"), (SIGNAL_FUNC ) ((SIGNAL_FUNC) event_silence), ((void *)0)); |
451 | |
452 | signal_add("default event", (SIGNAL_FUNC) event_received)signal_add_full("fe-common/irc", 0, ("default event"), (SIGNAL_FUNC ) ((SIGNAL_FUNC) event_received), ((void *)0)); |
453 | |
454 | signal_add("channel sync", (SIGNAL_FUNC) channel_sync)signal_add_full("fe-common/irc", 0, ("channel sync"), (SIGNAL_FUNC ) ((SIGNAL_FUNC) channel_sync), ((void *)0)); |
455 | signal_add("event connected", (SIGNAL_FUNC) event_connected)signal_add_full("fe-common/irc", 0, ("event connected"), (SIGNAL_FUNC ) ((SIGNAL_FUNC) event_connected), ((void *)0)); |
456 | signal_add("nickfind event whois", (SIGNAL_FUNC) event_nickfind_whois)signal_add_full("fe-common/irc", 0, ("nickfind event whois"), (SIGNAL_FUNC) ((SIGNAL_FUNC) event_nickfind_whois), ((void * )0)); |
457 | signal_add("ban type changed", (SIGNAL_FUNC) event_ban_type_changed)signal_add_full("fe-common/irc", 0, ("ban type changed"), (SIGNAL_FUNC ) ((SIGNAL_FUNC) event_ban_type_changed), ((void *)0)); |
458 | signal_add("whois event not found", (SIGNAL_FUNC) sig_whois_event_not_found)signal_add_full("fe-common/irc", 0, ("whois event not found") , (SIGNAL_FUNC) ((SIGNAL_FUNC) sig_whois_event_not_found), (( void *)0)); |
459 | signal_add("whowas event end", (SIGNAL_FUNC) sig_whowas_event_end)signal_add_full("fe-common/irc", 0, ("whowas event end"), (SIGNAL_FUNC ) ((SIGNAL_FUNC) sig_whowas_event_end), ((void *)0)); |
460 | } |
461 | |
462 | void fe_events_deinit(void) |
463 | { |
464 | signal_remove("event privmsg", (SIGNAL_FUNC) event_privmsg)signal_remove_full(("event privmsg"), (SIGNAL_FUNC) ((SIGNAL_FUNC ) event_privmsg), ((void *)0)); |
465 | signal_remove("ctcp action", (SIGNAL_FUNC) ctcp_action)signal_remove_full(("ctcp action"), (SIGNAL_FUNC) ((SIGNAL_FUNC ) ctcp_action), ((void *)0)); |
466 | signal_remove("event notice", (SIGNAL_FUNC) event_notice)signal_remove_full(("event notice"), (SIGNAL_FUNC) ((SIGNAL_FUNC ) event_notice), ((void *)0)); |
467 | signal_remove("event join", (SIGNAL_FUNC) event_join)signal_remove_full(("event join"), (SIGNAL_FUNC) ((SIGNAL_FUNC ) event_join), ((void *)0)); |
468 | signal_remove("event part", (SIGNAL_FUNC) event_part)signal_remove_full(("event part"), (SIGNAL_FUNC) ((SIGNAL_FUNC ) event_part), ((void *)0)); |
469 | signal_remove("event quit", (SIGNAL_FUNC) event_quit)signal_remove_full(("event quit"), (SIGNAL_FUNC) ((SIGNAL_FUNC ) event_quit), ((void *)0)); |
470 | signal_remove("event kick", (SIGNAL_FUNC) event_kick)signal_remove_full(("event kick"), (SIGNAL_FUNC) ((SIGNAL_FUNC ) event_kick), ((void *)0)); |
471 | signal_remove("event kill", (SIGNAL_FUNC) event_kill)signal_remove_full(("event kill"), (SIGNAL_FUNC) ((SIGNAL_FUNC ) event_kill), ((void *)0)); |
472 | signal_remove("event nick", (SIGNAL_FUNC) event_nick)signal_remove_full(("event nick"), (SIGNAL_FUNC) ((SIGNAL_FUNC ) event_nick), ((void *)0)); |
473 | signal_remove("event mode", (SIGNAL_FUNC) event_mode)signal_remove_full(("event mode"), (SIGNAL_FUNC) ((SIGNAL_FUNC ) event_mode), ((void *)0)); |
474 | signal_remove("event pong", (SIGNAL_FUNC) event_pong)signal_remove_full(("event pong"), (SIGNAL_FUNC) ((SIGNAL_FUNC ) event_pong), ((void *)0)); |
475 | signal_remove("event invite", (SIGNAL_FUNC) event_invite)signal_remove_full(("event invite"), (SIGNAL_FUNC) ((SIGNAL_FUNC ) event_invite), ((void *)0)); |
476 | signal_remove("event topic", (SIGNAL_FUNC) event_topic)signal_remove_full(("event topic"), (SIGNAL_FUNC) ((SIGNAL_FUNC ) event_topic), ((void *)0)); |
477 | signal_remove("event error", (SIGNAL_FUNC) event_error)signal_remove_full(("event error"), (SIGNAL_FUNC) ((SIGNAL_FUNC ) event_error), ((void *)0)); |
478 | signal_remove("event wallops", (SIGNAL_FUNC) event_wallops)signal_remove_full(("event wallops"), (SIGNAL_FUNC) ((SIGNAL_FUNC ) event_wallops), ((void *)0)); |
479 | signal_remove("event silence", (SIGNAL_FUNC) event_silence)signal_remove_full(("event silence"), (SIGNAL_FUNC) ((SIGNAL_FUNC ) event_silence), ((void *)0)); |
480 | |
481 | signal_remove("default event", (SIGNAL_FUNC) event_received)signal_remove_full(("default event"), (SIGNAL_FUNC) ((SIGNAL_FUNC ) event_received), ((void *)0)); |
482 | |
483 | signal_remove("channel sync", (SIGNAL_FUNC) channel_sync)signal_remove_full(("channel sync"), (SIGNAL_FUNC) ((SIGNAL_FUNC ) channel_sync), ((void *)0)); |
484 | signal_remove("event connected", (SIGNAL_FUNC) event_connected)signal_remove_full(("event connected"), (SIGNAL_FUNC) ((SIGNAL_FUNC ) event_connected), ((void *)0)); |
485 | signal_remove("nickfind event whois", (SIGNAL_FUNC) event_nickfind_whois)signal_remove_full(("nickfind event whois"), (SIGNAL_FUNC) (( SIGNAL_FUNC) event_nickfind_whois), ((void *)0)); |
486 | signal_remove("ban type changed", (SIGNAL_FUNC) event_ban_type_changed)signal_remove_full(("ban type changed"), (SIGNAL_FUNC) ((SIGNAL_FUNC ) event_ban_type_changed), ((void *)0)); |
487 | signal_remove("whois event not found", (SIGNAL_FUNC) sig_whois_event_not_found)signal_remove_full(("whois event not found"), (SIGNAL_FUNC) ( (SIGNAL_FUNC) sig_whois_event_not_found), ((void *)0)); |
488 | signal_remove("whowas event end", (SIGNAL_FUNC) sig_whowas_event_end)signal_remove_full(("whowas event end"), (SIGNAL_FUNC) ((SIGNAL_FUNC ) sig_whowas_event_end), ((void *)0)); |
489 | } |