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
27 static void sig_message_public(SERVER_REC *server, const char *msg,
28 const char *nick, const char *address,
31 if (ignore_check(server, nick, address, target, msg, MSGLEVEL_PUBLIC))
35 static void sig_message_private(SERVER_REC *server, const char *msg,
36 const char *nick, const char *address)
38 if (ignore_check(server, nick, address, NULL, msg, MSGLEVEL_MSGS))
42 static void sig_message_join(SERVER_REC *server, const char *channel,
43 const char *nick, const char *address)
45 if (ignore_check(server, nick, address, channel, NULL, MSGLEVEL_JOINS))
49 static void sig_message_part(SERVER_REC *server, const char *channel,
50 const char *nick, const char *address,
53 if (ignore_check(server, nick, address, channel, NULL, MSGLEVEL_PARTS))
57 static void sig_message_quit(SERVER_REC *server, const char *nick,
58 const char *address, const char *reason)
60 if (ignore_check(server, nick, address, NULL, reason, MSGLEVEL_QUITS))
64 static void sig_message_kick(SERVER_REC *server, const char *channel,
65 const char *nick, const char *kicker,
66 const char *address, const char *reason)
68 /* never ignore if you were kicked */
69 if (g_strcasecmp(nick, server->nick) != 0 &&
70 ignore_check(server, kicker, address,
71 channel, reason, MSGLEVEL_KICKS))
75 static void sig_message_nick(SERVER_REC *server, const char *newnick,
76 const char *oldnick, const char *address)
78 if (ignore_check(server, oldnick, address,
79 NULL, NULL, MSGLEVEL_NICKS) ||
80 ignore_check(server, newnick, address,
81 NULL, NULL, MSGLEVEL_NICKS))
85 static void sig_message_own_nick(SERVER_REC *server, const char *newnick,
86 const char *oldnick, const char *address)
88 if (ignore_check(server, oldnick, address, NULL, NULL, MSGLEVEL_NICKS))
92 static void sig_message_invite(SERVER_REC *server, const char *channel,
93 const char *nick, const char *address)
95 if (*channel == '\0' ||
96 ignore_check(server, nick, address,
97 channel, NULL, MSGLEVEL_INVITES))
101 static void sig_message_topic(SERVER_REC *server, const char *channel,
103 const char *nick, const char *address)
105 if (ignore_check(server, nick, address,
106 channel, topic, MSGLEVEL_TOPICS))
110 void fe_ignore_messages_init(void)
112 signal_add_first("message public", (SIGNAL_FUNC) sig_message_public);
113 signal_add_first("message private", (SIGNAL_FUNC) sig_message_private);
114 signal_add_first("message join", (SIGNAL_FUNC) sig_message_join);
115 signal_add_first("message part", (SIGNAL_FUNC) sig_message_part);
116 signal_add_first("message quit", (SIGNAL_FUNC) sig_message_quit);
117 signal_add_first("message kick", (SIGNAL_FUNC) sig_message_kick);
118 signal_add_first("message nick", (SIGNAL_FUNC) sig_message_nick);
119 signal_add_first("message own_nick", (SIGNAL_FUNC) sig_message_own_nick);
120 signal_add_first("message invite", (SIGNAL_FUNC) sig_message_invite);
121 signal_add_first("message topic", (SIGNAL_FUNC) sig_message_topic);
124 void fe_ignore_messages_deinit(void)
126 signal_remove("message public", (SIGNAL_FUNC) sig_message_public);
127 signal_remove("message private", (SIGNAL_FUNC) sig_message_private);
128 signal_remove("message join", (SIGNAL_FUNC) sig_message_join);
129 signal_remove("message part", (SIGNAL_FUNC) sig_message_part);
130 signal_remove("message quit", (SIGNAL_FUNC) sig_message_quit);
131 signal_remove("message kick", (SIGNAL_FUNC) sig_message_kick);
132 signal_remove("message nick", (SIGNAL_FUNC) sig_message_nick);
133 signal_remove("message own_nick", (SIGNAL_FUNC) sig_message_own_nick);
134 signal_remove("message invite", (SIGNAL_FUNC) sig_message_invite);
135 signal_remove("message topic", (SIGNAL_FUNC) sig_message_topic);