2 fe-ignore-messages.c : irssi
4 Copyright (C) 2000 Timo Sirainen
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.
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.
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
26 static void sig_message_public(SERVER_REC *server, const char *msg,
27 const char *nick, const char *address,
30 if (ignore_check(server, nick, address, target, msg, MSGLEVEL_PUBLIC))
34 static void sig_message_private(SERVER_REC *server, const char *msg,
35 const char *nick, const char *address)
37 if (ignore_check(server, nick, address, NULL, msg, MSGLEVEL_MSGS))
41 static void sig_message_join(SERVER_REC *server, const char *channel,
42 const char *nick, const char *address)
44 if (ignore_check(server, nick, address, channel, NULL, MSGLEVEL_JOINS))
48 static void sig_message_part(SERVER_REC *server, const char *channel,
49 const char *nick, const char *address,
52 if (ignore_check(server, nick, address, channel, NULL, MSGLEVEL_PARTS))
56 static void sig_message_quit(SERVER_REC *server, const char *nick,
57 const char *address, const char *reason)
59 if (ignore_check(server, nick, address, NULL, reason, MSGLEVEL_QUITS))
63 static void sig_message_kick(SERVER_REC *server, const char *channel,
64 const char *nick, const char *kicker,
65 const char *address, const char *reason)
67 if (ignore_check(server, kicker, address,
68 channel, reason, MSGLEVEL_KICKS))
72 static void sig_message_nick(SERVER_REC *server, const char *newnick,
73 const char *oldnick, const char *address)
75 if (ignore_check(server, oldnick, address,
76 NULL, NULL, MSGLEVEL_NICKS) ||
77 ignore_check(server, newnick, address,
78 NULL, NULL, MSGLEVEL_NICKS))
82 static void sig_message_own_nick(SERVER_REC *server, const char *newnick,
83 const char *oldnick, const char *address)
85 if (ignore_check(server, oldnick, address, NULL, NULL, MSGLEVEL_NICKS))
89 static void sig_message_invite(SERVER_REC *server, const char *channel,
90 const char *nick, const char *address)
92 if (*channel == '\0' ||
93 ignore_check(server, nick, address,
94 channel, NULL, MSGLEVEL_INVITES))
98 static void sig_message_topic(SERVER_REC *server, const char *channel,
100 const char *nick, const char *address)
102 if (ignore_check(server, nick, address,
103 channel, topic, MSGLEVEL_TOPICS))
107 void fe_ignore_messages_init(void)
109 signal_add_first("message public", (SIGNAL_FUNC) sig_message_public);
110 signal_add_first("message private", (SIGNAL_FUNC) sig_message_private);
111 signal_add_first("message join", (SIGNAL_FUNC) sig_message_join);
112 signal_add_first("message part", (SIGNAL_FUNC) sig_message_part);
113 signal_add_first("message quit", (SIGNAL_FUNC) sig_message_quit);
114 signal_add_first("message kick", (SIGNAL_FUNC) sig_message_kick);
115 signal_add_first("message nick", (SIGNAL_FUNC) sig_message_nick);
116 signal_add_first("message own_nick", (SIGNAL_FUNC) sig_message_own_nick);
117 signal_add_first("message invite", (SIGNAL_FUNC) sig_message_invite);
118 signal_add_first("message topic", (SIGNAL_FUNC) sig_message_topic);
121 void fe_ignore_messages_deinit(void)
123 signal_remove("message public", (SIGNAL_FUNC) sig_message_public);
124 signal_remove("message private", (SIGNAL_FUNC) sig_message_private);
125 signal_remove("message join", (SIGNAL_FUNC) sig_message_join);
126 signal_remove("message part", (SIGNAL_FUNC) sig_message_part);
127 signal_remove("message quit", (SIGNAL_FUNC) sig_message_quit);
128 signal_remove("message kick", (SIGNAL_FUNC) sig_message_kick);
129 signal_remove("message nick", (SIGNAL_FUNC) sig_message_nick);
130 signal_remove("message own_nick", (SIGNAL_FUNC) sig_message_own_nick);
131 signal_remove("message invite", (SIGNAL_FUNC) sig_message_invite);
132 signal_remove("message topic", (SIGNAL_FUNC) sig_message_topic);