1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
|
/*
fe-ignore-messages.c : irssi
Copyright (C) 2000 Timo Sirainen
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "module.h"
#include "signals.h"
#include "levels.h"
#include "ignore.h"
#include "servers.h"
static void sig_message_public(SERVER_REC *server, const char *msg,
const char *nick, const char *address,
const char *target)
{
if (ignore_check(server, nick, address, target, msg, MSGLEVEL_PUBLIC))
signal_stop();
}
static void sig_message_private(SERVER_REC *server, const char *msg,
const char *nick, const char *address)
{
if (ignore_check(server, nick, address, NULL, msg, MSGLEVEL_MSGS))
signal_stop();
}
static void sig_message_join(SERVER_REC *server, const char *channel,
const char *nick, const char *address)
{
if (ignore_check(server, nick, address, channel, NULL, MSGLEVEL_JOINS))
signal_stop();
}
static void sig_message_part(SERVER_REC *server, const char *channel,
const char *nick, const char *address,
const char *reason)
{
if (ignore_check(server, nick, address, channel, NULL, MSGLEVEL_PARTS))
signal_stop();
}
static void sig_message_quit(SERVER_REC *server, const char *nick,
const char *address, const char *reason)
{
if (ignore_check(server, nick, address, NULL, reason, MSGLEVEL_QUITS))
signal_stop();
}
static void sig_message_kick(SERVER_REC *server, const char *channel,
const char *nick, const char *kicker,
const char *address, const char *reason)
{
/* never ignore if you were kicked */
if (g_strcasecmp(nick, server->nick) != 0 &&
ignore_check(server, kicker, address,
channel, reason, MSGLEVEL_KICKS))
signal_stop();
}
static void sig_message_nick(SERVER_REC *server, const char *newnick,
const char *oldnick, const char *address)
{
if (ignore_check(server, oldnick, address,
NULL, NULL, MSGLEVEL_NICKS) ||
ignore_check(server, newnick, address,
NULL, NULL, MSGLEVEL_NICKS))
signal_stop();
}
static void sig_message_own_nick(SERVER_REC *server, const char *newnick,
const char *oldnick, const char *address)
{
if (ignore_check(server, oldnick, address, NULL, NULL, MSGLEVEL_NICKS))
signal_stop();
}
static void sig_message_invite(SERVER_REC *server, const char *channel,
const char *nick, const char *address)
{
if (*channel == '\0' ||
ignore_check(server, nick, address,
channel, NULL, MSGLEVEL_INVITES))
signal_stop();
}
static void sig_message_topic(SERVER_REC *server, const char *channel,
const char *topic,
const char *nick, const char *address)
{
if (ignore_check(server, nick, address,
channel, topic, MSGLEVEL_TOPICS))
signal_stop();
}
void fe_ignore_messages_init(void)
{
signal_add_first("message public", (SIGNAL_FUNC) sig_message_public);
signal_add_first("message private", (SIGNAL_FUNC) sig_message_private);
signal_add_first("message join", (SIGNAL_FUNC) sig_message_join);
signal_add_first("message part", (SIGNAL_FUNC) sig_message_part);
signal_add_first("message quit", (SIGNAL_FUNC) sig_message_quit);
signal_add_first("message kick", (SIGNAL_FUNC) sig_message_kick);
signal_add_first("message nick", (SIGNAL_FUNC) sig_message_nick);
signal_add_first("message own_nick", (SIGNAL_FUNC) sig_message_own_nick);
signal_add_first("message invite", (SIGNAL_FUNC) sig_message_invite);
signal_add_first("message topic", (SIGNAL_FUNC) sig_message_topic);
}
void fe_ignore_messages_deinit(void)
{
signal_remove("message public", (SIGNAL_FUNC) sig_message_public);
signal_remove("message private", (SIGNAL_FUNC) sig_message_private);
signal_remove("message join", (SIGNAL_FUNC) sig_message_join);
signal_remove("message part", (SIGNAL_FUNC) sig_message_part);
signal_remove("message quit", (SIGNAL_FUNC) sig_message_quit);
signal_remove("message kick", (SIGNAL_FUNC) sig_message_kick);
signal_remove("message nick", (SIGNAL_FUNC) sig_message_nick);
signal_remove("message own_nick", (SIGNAL_FUNC) sig_message_own_nick);
signal_remove("message invite", (SIGNAL_FUNC) sig_message_invite);
signal_remove("message topic", (SIGNAL_FUNC) sig_message_topic);
}
|