New silcconfig library and server parser. Merged silc-newconfig-final.patch.
[silc.git] / apps / irssi / src / fe-common / core / fe-messages.c
1 /*
2  fe-messages.c : irssi
3
4     Copyright (C) 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
17     along with this program; if not, write to the Free Software
18     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19 */
20
21 #include "module.h"
22 #include "module-formats.h"
23 #include "signals.h"
24 #include "commands.h"
25 #include "levels.h"
26 #include "misc.h"
27 #include "special-vars.h"
28 #include "settings.h"
29
30 #include "servers.h"
31 #include "channels.h"
32 #include "nicklist.h"
33 #include "ignore.h"
34
35 #include "window-items.h"
36 #include "fe-queries.h"
37 #include "hilight-text.h"
38 #include "printtext.h"
39
40 #define ishighalnum(c) ((unsigned char) (c) >= 128 || i_isalnum(c))
41
42 static GHashTable *printnicks;
43
44 /* convert _underlined_ and *bold* words (and phrases) to use real
45    underlining or bolding */
46 char *expand_emphasis(WI_ITEM_REC *item, const char *text)
47 {
48         GString *str;
49         char *ret;
50         int pos;
51
52         g_return_val_if_fail(text != NULL, NULL);
53
54         str = g_string_new(text);
55
56         for (pos = 0; pos < str->len; pos++) {
57                 char type, *bgn, *end;
58
59                 bgn = str->str + pos;
60
61                 if (*bgn == '*') 
62                         type = 2; /* bold */
63                 else if (*bgn == '_') 
64                         type = 31; /* underlined */
65                 else
66                         continue;
67
68                 /* check that the beginning marker starts a word, and
69                    that the matching end marker ends a word */
70                 if ((pos > 0 && !i_isspace(bgn[-1])) || !ishighalnum(bgn[1]))
71                         continue;
72                 if ((end = strchr(bgn+1, *bgn)) == NULL)
73                         continue;
74                 if (!ishighalnum(end[-1]) || ishighalnum(end[1]) ||
75                     end[1] == type || end[1] == '*' || end[1] == '_')
76                         continue;
77
78                 if (IS_CHANNEL(item)) {
79                         /* check that this isn't a _nick_, we don't want to
80                            use emphasis on them. */
81                         int found;
82                         char c;
83
84                         c = end[1];
85                         end[1] = '\0';
86                         found = nicklist_find(CHANNEL(item), bgn) != NULL;
87                         end[1] = c;
88                         if (found) continue;
89                 }
90
91                 /* allow only *word* emphasis, not *multiple words* */
92                 if (!settings_get_bool("emphasis_multiword")) {
93                         char *c;
94                         for (c = bgn+1; c != end; c++) {
95                                 if (!ishighalnum(*c))
96                                         break;
97                         }
98                         if (c != end) continue;
99                 }
100
101                 if (settings_get_bool("emphasis_replace")) {
102                         *bgn = *end = type;
103                         pos += (end-bgn);
104                 } else {
105                         g_string_insert_c(str, pos, type);
106                         pos += (end - bgn) + 2;
107                         g_string_insert_c(str, pos++, type);
108                 }
109         }
110
111         ret = str->str;
112         g_string_free(str, FALSE);
113         return ret;
114 }
115
116 static char *channel_get_nickmode_rec(NICK_REC *nickrec)
117 {
118         char *emptystr;
119
120         if (!settings_get_bool("show_nickmode"))
121                 return "";
122
123         emptystr = settings_get_bool("show_nickmode_empty") ? " " : "";
124
125         return nickrec == NULL ? emptystr :
126                 nickrec->op ? "@" :
127                 nickrec->halfop ? "%" :
128                 nickrec->voice ? "+" :
129                 emptystr;
130 }
131
132 char *channel_get_nickmode(CHANNEL_REC *channel, const char *nick)
133 {
134         g_return_val_if_fail(nick != NULL, NULL);
135
136         return channel_get_nickmode_rec(channel == NULL ? NULL :
137                                         nicklist_find(channel, nick));
138 }
139
140 static void sig_message_public(SERVER_REC *server, const char *msg,
141                                const char *nick, const char *address,
142                                const char *target, NICK_REC *nickrec)
143 {
144         CHANNEL_REC *chanrec;
145         const char *nickmode, *printnick;
146         int for_me, print_channel, level;
147         char *color, *freemsg = NULL;
148
149         /* NOTE: this may return NULL if some channel is just closed with
150            /WINDOW CLOSE and server still sends the few last messages */
151         chanrec = channel_find(server, target);
152         if (nickrec == NULL && chanrec != NULL)
153                 nickrec = nicklist_find(chanrec, nick);
154
155         for_me = nick_match_msg(chanrec, msg, server->nick);
156         color = for_me ? NULL :
157                 hilight_match_nick(server, target, nick, address, MSGLEVEL_PUBLIC, msg);
158
159         print_channel = chanrec == NULL ||
160                 !window_item_is_active((WI_ITEM_REC *) chanrec);
161         if (!print_channel && settings_get_bool("print_active_channel") &&
162             window_item_window((WI_ITEM_REC *) chanrec)->items->next != NULL)
163                 print_channel = TRUE;
164
165         level = MSGLEVEL_PUBLIC;
166         if (for_me || color != NULL)
167                 level |= MSGLEVEL_HILIGHT;
168
169         if (settings_get_bool("emphasis"))
170                 msg = freemsg = expand_emphasis((WI_ITEM_REC *) chanrec, msg);
171
172         /* get nick mode & nick what to print the msg with
173            (in case there's multiple identical nicks) */
174         nickmode = channel_get_nickmode_rec(nickrec);
175         printnick = nickrec == NULL ? nick :
176                 g_hash_table_lookup(printnicks, nickrec);
177         if (printnick == NULL)
178                 printnick = nick;
179
180         if (!print_channel) {
181                 /* message to active channel in window */
182                 if (color != NULL) {
183                         /* highlighted nick */
184                         printformat(server, target, level,
185                                     TXT_PUBMSG_HILIGHT,
186                                     color, printnick, msg, nickmode);
187                 } else {
188                         printformat(server, target, level,
189                                     for_me ? TXT_PUBMSG_ME : TXT_PUBMSG,
190                                     printnick, msg, nickmode);
191                 }
192         } else {
193                 /* message to not existing/active channel */
194                 if (color != NULL) {
195                         /* highlighted nick */
196                         printformat(server, target, level,
197                                     TXT_PUBMSG_HILIGHT_CHANNEL,
198                                     color, printnick, target, msg, nickmode);
199                 } else {
200                         printformat(server, target, level,
201                                     for_me ? TXT_PUBMSG_ME_CHANNEL :
202                                     TXT_PUBMSG_CHANNEL,
203                                     printnick, target, msg, nickmode);
204                 }
205         }
206
207         g_free_not_null(freemsg);
208         g_free_not_null(color);
209 }
210
211 static void sig_message_private(SERVER_REC *server, const char *msg,
212                                 const char *nick, const char *address)
213 {
214         QUERY_REC *query;
215         char *freemsg = NULL;
216
217         query = query_find(server, nick);
218
219         if (settings_get_bool("emphasis"))
220                 msg = freemsg = expand_emphasis((WI_ITEM_REC *) query, msg);
221
222         printformat(server, nick, MSGLEVEL_MSGS,
223                     query == NULL ? TXT_MSG_PRIVATE :
224                     TXT_MSG_PRIVATE_QUERY, nick, address, msg);
225
226         g_free_not_null(freemsg);
227 }
228
229 static void print_own_channel_message(SERVER_REC *server, CHANNEL_REC *channel,
230                                       const char *target, const char *msg)
231 {
232         WINDOW_REC *window;
233         const char *nickmode;
234         char *freemsg = NULL;
235         int print_channel;
236
237         nickmode = channel_get_nickmode(channel, server->nick);
238
239         window = channel == NULL ? NULL :
240                 window_item_window((WI_ITEM_REC *) channel);
241
242         print_channel = window == NULL ||
243                 window->active != (WI_ITEM_REC *) channel;
244
245         if (!print_channel && settings_get_bool("print_active_channel") &&
246             window != NULL && g_slist_length(window->items) > 1)
247                 print_channel = TRUE;
248
249         if (settings_get_bool("emphasis"))
250                 msg = freemsg = expand_emphasis((WI_ITEM_REC *) channel, msg);
251
252         if (!print_channel) {
253                 printformat(server, target, MSGLEVEL_PUBLIC | MSGLEVEL_NOHILIGHT | MSGLEVEL_NO_ACT,
254                             TXT_OWN_MSG, server->nick, msg, nickmode);
255         } else {
256                 printformat(server, target, MSGLEVEL_PUBLIC | MSGLEVEL_NOHILIGHT | MSGLEVEL_NO_ACT,
257                             TXT_OWN_MSG_CHANNEL, server->nick, target, msg, nickmode);
258         }
259
260         g_free_not_null(freemsg);
261 }
262
263 static void sig_message_own_public(SERVER_REC *server, const char *msg,
264                                    const char *target)
265 {
266         CHANNEL_REC *channel;
267
268         g_return_if_fail(server != NULL);
269         g_return_if_fail(msg != NULL);
270
271         channel = channel_find(server, target);
272         print_own_channel_message(server, channel, target, msg);
273 }
274
275 static void sig_message_own_private(SERVER_REC *server, const char *msg,
276                                     const char *target, const char *origtarget)
277 {
278         QUERY_REC *query;
279         char *freemsg = NULL;
280
281         g_return_if_fail(server != NULL);
282         g_return_if_fail(msg != NULL);
283
284         if (target == NULL) {
285                 /* this should only happen if some special target failed and
286                    we should display some error message. currently the special
287                    targets are only ',' and '.'. */
288                 g_return_if_fail(strcmp(origtarget, ",") == 0 ||
289                                  strcmp(origtarget, ".") == 0);
290
291                 printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE,
292                             *origtarget == ',' ? TXT_NO_MSGS_GOT :
293                             TXT_NO_MSGS_SENT);
294                 signal_stop();
295                 return;
296         }
297
298         query = privmsg_get_query(server, target, TRUE, MSGLEVEL_MSGS);
299
300         if (settings_get_bool("emphasis"))
301                 msg = freemsg = expand_emphasis((WI_ITEM_REC *) query, msg);
302
303         printformat(server, target,
304                     MSGLEVEL_MSGS | MSGLEVEL_NOHILIGHT | MSGLEVEL_NO_ACT,
305                     query == NULL ? TXT_OWN_MSG_PRIVATE :
306                     TXT_OWN_MSG_PRIVATE_QUERY, target, msg, server->nick);
307
308         g_free_not_null(freemsg);
309 }
310
311 static void sig_message_join(SERVER_REC *server, const char *channel,
312                              const char *nick, const char *address)
313 {
314         printformat(server, channel, MSGLEVEL_JOINS,
315                     TXT_JOIN, nick, address, channel);
316 }
317
318 static void sig_message_part(SERVER_REC *server, const char *channel,
319                              const char *nick, const char *address,
320                              const char *reason)
321 {
322         printformat(server, channel, MSGLEVEL_PARTS,
323                     TXT_PART, nick, address, channel, reason);
324 }
325
326 static void sig_message_quit(SERVER_REC *server, const char *nick,
327                              const char *address, const char *reason)
328 {
329         WINDOW_REC *window;
330         GString *chans;
331         GSList *tmp, *windows;
332         char *print_channel;
333         int once, count;
334
335         if (ignore_check(server, nick, address, NULL, reason, MSGLEVEL_QUITS))
336                 return;
337
338         print_channel = NULL;
339         once = settings_get_bool("show_quit_once");
340
341         count = 0; windows = NULL;
342         chans = g_string_new(NULL);
343         for (tmp = server->channels; tmp != NULL; tmp = tmp->next) {
344                 CHANNEL_REC *rec = tmp->data;
345
346                 if (!nicklist_find(rec, nick))
347                         continue;
348
349                 if (ignore_check(server, nick, address, rec->name,
350                                  reason, MSGLEVEL_QUITS)) {
351                         count++;
352                         continue;
353                 }
354
355                 if (print_channel == NULL ||
356                     active_win->active == (WI_ITEM_REC *) rec)
357                         print_channel = rec->name;
358
359                 if (once)
360                         g_string_sprintfa(chans, "%s,", rec->name);
361                 else {
362                         window = window_item_window((WI_ITEM_REC *) rec);
363                         if (g_slist_find(windows, window) == NULL) {
364                                 windows = g_slist_append(windows, window);
365                                 printformat(server, rec->name, MSGLEVEL_QUITS,
366                                             TXT_QUIT, nick, address, reason,
367                                             rec->name);
368                         }
369                 }
370                 count++;
371         }
372         g_slist_free(windows);
373
374         if (!once) {
375                 /* check if you had query with the nick and
376                    display the quit there too */
377                 QUERY_REC *query = query_find(server, nick);
378                 if (query != NULL) {
379                         printformat(server, nick, MSGLEVEL_QUITS,
380                                     TXT_QUIT, nick, address, reason, "");
381                 }
382         }
383
384         if (once || count == 0) {
385                 if (chans->len > 0)
386                         g_string_truncate(chans, chans->len-1);
387                 printformat(server, print_channel, MSGLEVEL_QUITS,
388                             count <= 1 ? TXT_QUIT : TXT_QUIT_ONCE,
389                             nick, address, reason, chans->str);
390         }
391         g_string_free(chans, TRUE);
392 }
393
394 static void sig_message_kick(SERVER_REC *server, const char *channel,
395                              const char *nick, const char *kicker,
396                              const char *address, const char *reason)
397 {
398         printformat(server, channel, MSGLEVEL_KICKS,
399                     TXT_KICK, nick, channel, kicker, reason);
400 }
401
402 static void print_nick_change_channel(SERVER_REC *server, const char *channel,
403                                       const char *newnick, const char *oldnick,
404                                       const char *address,
405                                       int ownnick)
406 {
407         int level;
408
409         if (ignore_check(server, oldnick, address,
410                          channel, newnick, MSGLEVEL_NICKS))
411                 return;
412
413         level = MSGLEVEL_NICKS;
414         if (ownnick) level |= MSGLEVEL_NO_ACT;
415
416         printformat(server, channel, level,
417                     ownnick ? TXT_YOUR_NICK_CHANGED : TXT_NICK_CHANGED,
418                     oldnick, newnick, channel);
419 }
420
421 static void print_nick_change(SERVER_REC *server, const char *newnick,
422                               const char *oldnick, const char *address,
423                               int ownnick)
424 {
425         GSList *tmp, *windows;
426         int msgprint;
427
428         msgprint = FALSE;
429
430         /* Print to each channel/query where the nick is.
431            Don't print more than once to the same window. */
432         windows = NULL;
433         for (tmp = server->channels; tmp != NULL; tmp = tmp->next) {
434                 CHANNEL_REC *channel = tmp->data;
435                 WINDOW_REC *window =
436                         window_item_window((WI_ITEM_REC *) channel);
437
438                 if (nicklist_find(channel, newnick) == NULL ||
439                     g_slist_find(windows, window) != NULL)
440                         continue;
441
442                 windows = g_slist_append(windows, window);
443                 print_nick_change_channel(server, channel->name, newnick,
444                                           oldnick, address, ownnick);
445                 msgprint = TRUE;
446         }
447
448         g_slist_free(windows);
449
450         if (!msgprint && ownnick) {
451                 printformat(server, NULL, MSGLEVEL_NICKS,
452                             TXT_YOUR_NICK_CHANGED, oldnick, newnick, "");
453         }
454 }
455
456 static void sig_message_nick(SERVER_REC *server, const char *newnick,
457                              const char *oldnick, const char *address)
458 {
459         print_nick_change(server, newnick, oldnick, address, FALSE);
460 }
461
462 static void sig_message_own_nick(SERVER_REC *server, const char *newnick,
463                                  const char *oldnick, const char *address)
464 {
465         if (!settings_get_bool("show_own_nickchange_once"))
466                 print_nick_change(server, newnick, oldnick, address, TRUE);
467         else {
468                 printformat(server, NULL, MSGLEVEL_NICKS,
469                             TXT_YOUR_NICK_CHANGED, oldnick, newnick, "");
470         }
471 }
472
473 static void sig_message_invite(SERVER_REC *server, const char *channel,
474                                const char *nick, const char *address)
475 {
476         char *str;
477
478         str = show_lowascii(channel);
479         printformat(server, NULL, MSGLEVEL_INVITES,
480                     TXT_INVITE, nick, str);
481         g_free(str);
482 }
483
484 static void sig_message_topic(SERVER_REC *server, const char *channel,
485                               const char *topic,
486                               const char *nick, const char *address)
487 {
488         printformat(server, channel, MSGLEVEL_TOPICS,
489                     *topic != '\0' ? TXT_NEW_TOPIC : TXT_TOPIC_UNSET,
490                     nick, channel, topic);
491 }
492
493 static int printnick_exists(NICK_REC *first, NICK_REC *ignore,
494                             const char *nick)
495 {
496         char *printnick;
497
498         while (first != NULL) {
499                 if (first != ignore) {
500                         printnick = g_hash_table_lookup(printnicks, first);
501                         if (printnick != NULL && strcmp(printnick, nick) == 0)
502                                 return TRUE;
503                 }
504
505                 first = first->next;
506         }
507
508         return FALSE;
509 }
510
511 static NICK_REC *printnick_find_original(NICK_REC *nick)
512 {
513         while (nick != NULL) {
514                 if (g_hash_table_lookup(printnicks, nick) == NULL)
515                         return nick;
516
517                 nick = nick->next;
518         }
519
520         return NULL;
521 }
522
523 static void sig_nicklist_new(CHANNEL_REC *channel, NICK_REC *nick)
524 {
525         NICK_REC *firstnick;
526         GString *newnick;
527         char *nickhost, *p;
528         int n;
529
530         if (nick->host == NULL)
531                 return;
532
533         firstnick = g_hash_table_lookup(channel->nicks, nick->nick);
534         if (firstnick->next == NULL)
535                 return;
536
537         if (nick == channel->ownnick) {
538                 /* own nick is being added, might be a nick change and
539                    someone else having the original nick already in use.. */
540                 nick = printnick_find_original(firstnick->next);
541                 if (nick == NULL)
542                         return; /* nope, we have it */
543         }
544
545         /* identical nick already exists, have to change it somehow.. */
546         p = strchr(nick->host, '@');
547         if (p == NULL) p = nick->host; else p++;
548
549         nickhost = g_strdup_printf("%s@%s", nick->nick, p);
550         p = strchr(nickhost+strlen(nick->nick), '.');
551         if (p != NULL) *p = '\0';
552
553         if (!printnick_exists(firstnick, nick, nickhost)) {
554                 /* use nick@host */
555                 g_hash_table_insert(printnicks, nick, nickhost);
556                 return;
557         }
558
559         newnick = g_string_new(NULL);
560         n = 2;
561         do {
562                 g_string_sprintf(newnick, "%s%d", nickhost, n);
563                 n++;
564         } while (printnick_exists(firstnick, nick, newnick->str));
565
566         g_hash_table_insert(printnicks, nick, newnick->str);
567         g_string_free(newnick, FALSE);
568         g_free(nickhost);
569 }
570
571 static void sig_nicklist_remove(CHANNEL_REC *channel, NICK_REC *nick)
572 {
573         char *nickname;
574
575         nickname = g_hash_table_lookup(printnicks, nick);
576         if (nickname != NULL) {
577                 g_free(nickname);
578                 g_hash_table_remove(printnicks, nick);
579         }
580 }
581
582 static void sig_nicklist_changed(CHANNEL_REC *channel, NICK_REC *nick)
583 {
584         sig_nicklist_remove(channel, nick);
585         sig_nicklist_new(channel, nick);
586 }
587
588 static void sig_channel_joined(CHANNEL_REC *channel)
589 {
590         NICK_REC *nick;
591         char *nickname;
592
593         /* channel->ownnick is set at this point - check if our own nick
594            has been changed, if it was set it back to the original nick and
595            change the previous original to something else */
596
597         nickname = g_hash_table_lookup(printnicks, channel->ownnick);
598         if (nickname == NULL)
599                 return;
600
601         g_free(nickname);
602         g_hash_table_remove(printnicks, channel->ownnick);
603
604         /* our own nick is guaranteed to be the first in list */
605         nick = channel->ownnick->next;
606         while (nick != NULL) {
607                 if (g_hash_table_lookup(printnicks, nick) == NULL) {
608                         sig_nicklist_new(channel, nick);
609                         break;
610                 }
611                 nick = nick->next;
612         }
613 }
614
615 static void g_hash_free_value(void *key, void *value)
616 {
617         g_free(value);
618 }
619
620 void fe_messages_init(void)
621 {
622         printnicks = g_hash_table_new((GHashFunc) g_direct_hash,
623                                       (GCompareFunc) g_direct_equal);
624
625         settings_add_bool("lookandfeel", "emphasis", TRUE);
626         settings_add_bool("lookandfeel", "emphasis_replace", FALSE);
627         settings_add_bool("lookandfeel", "emphasis_multiword", FALSE);
628         settings_add_bool("lookandfeel", "show_nickmode", TRUE);
629         settings_add_bool("lookandfeel", "show_nickmode_empty", TRUE);
630         settings_add_bool("lookandfeel", "print_active_channel", FALSE);
631         settings_add_bool("lookandfeel", "show_quit_once", FALSE);
632         settings_add_bool("lookandfeel", "show_own_nickchange_once", FALSE);
633
634         signal_add_last("message public", (SIGNAL_FUNC) sig_message_public);
635         signal_add_last("message private", (SIGNAL_FUNC) sig_message_private);
636         signal_add_last("message own_public", (SIGNAL_FUNC) sig_message_own_public);
637         signal_add_last("message own_private", (SIGNAL_FUNC) sig_message_own_private);
638         signal_add_last("message join", (SIGNAL_FUNC) sig_message_join);
639         signal_add_last("message part", (SIGNAL_FUNC) sig_message_part);
640         signal_add_last("message quit", (SIGNAL_FUNC) sig_message_quit);
641         signal_add_last("message kick", (SIGNAL_FUNC) sig_message_kick);
642         signal_add_last("message nick", (SIGNAL_FUNC) sig_message_nick);
643         signal_add_last("message own_nick", (SIGNAL_FUNC) sig_message_own_nick);
644         signal_add_last("message invite", (SIGNAL_FUNC) sig_message_invite);
645         signal_add_last("message topic", (SIGNAL_FUNC) sig_message_topic);
646
647         signal_add("nicklist new", (SIGNAL_FUNC) sig_nicklist_new);
648         signal_add("nicklist remove", (SIGNAL_FUNC) sig_nicklist_remove);
649         signal_add("nicklist changed", (SIGNAL_FUNC) sig_nicklist_changed);
650         signal_add("nicklist host changed", (SIGNAL_FUNC) sig_nicklist_new);
651         signal_add("channel joined", (SIGNAL_FUNC) sig_channel_joined);
652 }
653
654 void fe_messages_deinit(void)
655 {
656         g_hash_table_foreach(printnicks, (GHFunc) g_hash_free_value, NULL);
657         g_hash_table_destroy(printnicks);
658
659         signal_remove("message public", (SIGNAL_FUNC) sig_message_public);
660         signal_remove("message private", (SIGNAL_FUNC) sig_message_private);
661         signal_remove("message own_public", (SIGNAL_FUNC) sig_message_own_public);
662         signal_remove("message own_private", (SIGNAL_FUNC) sig_message_own_private);
663         signal_remove("message join", (SIGNAL_FUNC) sig_message_join);
664         signal_remove("message part", (SIGNAL_FUNC) sig_message_part);
665         signal_remove("message quit", (SIGNAL_FUNC) sig_message_quit);
666         signal_remove("message kick", (SIGNAL_FUNC) sig_message_kick);
667         signal_remove("message nick", (SIGNAL_FUNC) sig_message_nick);
668         signal_remove("message own_nick", (SIGNAL_FUNC) sig_message_own_nick);
669         signal_remove("message invite", (SIGNAL_FUNC) sig_message_invite);
670         signal_remove("message topic", (SIGNAL_FUNC) sig_message_topic);
671
672         signal_remove("nicklist new", (SIGNAL_FUNC) sig_nicklist_new);
673         signal_remove("nicklist remove", (SIGNAL_FUNC) sig_nicklist_remove);
674         signal_remove("nicklist changed", (SIGNAL_FUNC) sig_nicklist_changed);
675         signal_remove("nicklist host changed", (SIGNAL_FUNC) sig_nicklist_new);
676         signal_remove("channel joined", (SIGNAL_FUNC) sig_channel_joined);
677 }