1
0
mirror of https://github.com/irssi/irssi.git synced 2024-10-13 05:03:45 -04:00

Moved ignore to core.

git-svn-id: http://svn.irssi.org/repos/irssi/trunk@725 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2000-10-09 23:40:18 +00:00 committed by cras
parent 77fcb9de52
commit 3c78d95614
9 changed files with 29 additions and 26 deletions

View File

@ -22,6 +22,7 @@ libcore_a_SOURCES = \
chat-protocols.c \
chatnets.c \
core.c \
ignore.c \
levels.c \
line-split.c \
log.c \
@ -62,6 +63,7 @@ noinst_HEADERS = \
chat-protocols.h \
chatnets.h \
core.h \
ignore.h \
levels.h \
line-split.h \
log.h \

View File

@ -33,6 +33,7 @@
#include "commands.h"
#include "log.h"
#include "rawlog.h"
#include "ignore.h"
#include "special-vars.h"
#include "channels.h"
@ -57,6 +58,7 @@ void core_init(void)
chat_protocols_init();
chatnets_init();
ignore_init();
servers_init();
log_init();
rawlog_init();
@ -84,6 +86,7 @@ void core_deinit(void)
rawlog_deinit();
log_deinit();
servers_deinit();
ignore_deinit();
chatnets_deinit();
chat_protocols_deinit();

View File

@ -25,21 +25,20 @@
#include "lib-config/iconfig.h"
#include "settings.h"
#include "irc.h"
#include "irc-masks.h"
#include "irc-servers.h"
#include "irc-channels.h"
#include "irc-nicklist.h"
#include "masks.h"
#include "servers.h"
#include "channels.h"
#include "nicklist.h"
#include "ignore.h"
GSList *ignores;
/* check if `text' contains ignored nick at the start of the line. */
static int ignore_check_replies(IGNORE_REC *rec, IRC_SERVER_REC *server,
static int ignore_check_replies(IGNORE_REC *rec, SERVER_REC *server,
const char *channel, const char *text)
{
IRC_CHANNEL_REC *chanrec;
CHANNEL_REC *chanrec;
GSList *nicks, *tmp;
g_return_val_if_fail(rec != NULL, FALSE);
@ -47,16 +46,16 @@ static int ignore_check_replies(IGNORE_REC *rec, IRC_SERVER_REC *server,
g_return_val_if_fail(channel != NULL, FALSE);
g_return_val_if_fail(text != NULL, FALSE);
chanrec = irc_channel_find(server, channel);
chanrec = channel_find(server, channel);
if (chanrec == NULL) return FALSE;
nicks = nicklist_find_multiple(CHANNEL(chanrec), rec->mask);
nicks = nicklist_find_multiple(chanrec, rec->mask);
if (nicks == NULL) return FALSE;
for (tmp = nicks; tmp != NULL; tmp = tmp->next) {
NICK_REC *nick = tmp->data;
if (nick_match_msg(SERVER(server), text, nick->nick))
if (nick_match_msg(server, text, nick->nick))
return TRUE;
}
g_slist_free(nicks);
@ -64,7 +63,7 @@ static int ignore_check_replies(IGNORE_REC *rec, IRC_SERVER_REC *server,
return FALSE;
}
int ignore_check(IRC_SERVER_REC *server, const char *nick, const char *host,
int ignore_check(SERVER_REC *server, const char *nick, const char *host,
const char *channel, const char *text, int level)
{
GSList *tmp;
@ -86,7 +85,7 @@ int ignore_check(IRC_SERVER_REC *server, const char *nick, const char *host,
/* channel list */
if (rec->channels != NULL) {
if (channel == NULL || !ischannel(*channel))
if (channel == NULL || !server->ischannel(*channel))
continue;
if (strarray_find(rec->channels, channel) == -1)
continue;
@ -103,7 +102,7 @@ int ignore_check(IRC_SERVER_REC *server, const char *nick, const char *host,
ok = ((host == NULL || *host == '\0')) ?
match_wildcards(rec->mask, nick) :
mask_match_address(SERVER(server), rec->mask, nick, host);
mask_match_address(server, rec->mask, nick, host);
if (!ok) {
/* nick didn't match, but maybe this is a reply to nick? */
if (!rec->replies || channel == NULL || text == NULL ||
@ -114,7 +113,10 @@ int ignore_check(IRC_SERVER_REC *server, const char *nick, const char *host,
/* pattern */
patt_len = 0;
if (rec->pattern != NULL && text != NULL) {
if (rec->pattern != NULL) {
if (text == NULL)
continue;
if (!mask_len && !best_mask) {
patt_len = strlen(rec->pattern);
if (patt_len <= best_patt) continue;

View File

@ -20,7 +20,7 @@ typedef struct {
extern GSList *ignores;
int ignore_check(IRC_SERVER_REC *server, const char *nick, const char *host,
int ignore_check(SERVER_REC *server, const char *nick, const char *host,
const char *channel, const char *text, int level);
IGNORE_REC *ignore_find(const char *servertag, const char *mask, char **channels);

View File

@ -11,7 +11,6 @@ libirc_core_a_SOURCES = \
channels-query.c \
channel-events.c \
channel-rejoin.c \
ignore.c \
irc.c \
irc-core.c \
irc-channels.c \
@ -37,7 +36,6 @@ libirc_core_a_SOURCES = \
noinst_HEADERS = \
bans.h \
ctcp.h \
ignore.h \
irc.h \
irc-channels.h \
irc-chatnets.h \

View File

@ -128,7 +128,8 @@ static void sig_channel_destroyed(IRC_CHANNEL_REC *channel)
{
g_return_if_fail(channel != NULL);
if (channel->server != NULL && !channel->synced)
if (IS_IRC_CHANNEL(channel) && channel->server != NULL &&
!channel->synced)
channel_query_remove_all(channel);
}

View File

@ -120,7 +120,7 @@ static void ctcp_msg(const char *data, IRC_SERVER_REC *server,
{
char *args, *str;
if (ignore_check(server, nick, addr, target, data, MSGLEVEL_CTCPS))
if (ignore_check(SERVER(server), nick, addr, target, data, MSGLEVEL_CTCPS))
return;
str = g_strconcat("ctcp msg ", data, NULL);
@ -140,7 +140,7 @@ static void ctcp_reply(const char *data, IRC_SERVER_REC *server,
{
char *args, *str;
if (ignore_check(server, nick, addr, target, data, MSGLEVEL_CTCPS))
if (ignore_check(SERVER(server), nick, addr, target, data, MSGLEVEL_CTCPS))
return;
str = g_strconcat("ctcp reply ", data, NULL);

View File

@ -27,7 +27,6 @@
#include "irc-queries.h"
#include "ctcp.h"
#include "ignore.h"
#include "irc.h"
#include "netsplit.h"
@ -71,7 +70,6 @@ void irc_core_init(void)
irc_irc_init();
lag_init();
netsplit_init();
ignore_init();
irc_rawlog_init();
irc_special_vars_init();
irc_log_init();
@ -82,7 +80,6 @@ void irc_core_deinit(void)
irc_log_deinit();
irc_special_vars_deinit();
irc_rawlog_deinit();
ignore_deinit();
netsplit_deinit();
lag_deinit();
irc_commands_deinit();

View File

@ -211,7 +211,7 @@ static void flood_privmsg(const char *data, IRC_SERVER_REC *server, const char *
params = event_get_params(data, 2, &target, &text);
level = ischannel(*target) ? MSGLEVEL_PUBLIC : MSGLEVEL_MSGS;
if (addr != NULL && !ignore_check(server, nick, addr, target, text, level))
if (addr != NULL && !ignore_check(SERVER(server), nick, addr, target, text, level))
flood_newmsg(server, level, nick, addr, target);
g_free(params);
@ -228,7 +228,7 @@ static void flood_notice(const char *data, IRC_SERVER_REC *server, const char *n
return;
params = event_get_params(data, 2, &target, &text);
if (!ignore_check(server, nick, addr, target, text, MSGLEVEL_NOTICES))
if (!ignore_check(SERVER(server), nick, addr, target, text, MSGLEVEL_NOTICES))
flood_newmsg(server, MSGLEVEL_NOTICES, nick, addr, target);
g_free(params);
@ -246,7 +246,7 @@ static void flood_ctcp(const char *data, IRC_SERVER_REC *server, const char *nic
level = g_strncasecmp(data, "ACTION ", 7) != 0 ? MSGLEVEL_CTCPS :
(ischannel(*target) ? MSGLEVEL_PUBLIC : MSGLEVEL_MSGS);
if (!ignore_check(server, nick, addr, target, data, level))
if (!ignore_check(SERVER(server), nick, addr, target, data, level))
flood_newmsg(server, level, nick, addr, target);
}