1
0
mirror of https://github.com/irssi/irssi.git synced 2024-12-04 14:46:39 -05:00

Flood detection fixes

git-svn-id: http://svn.irssi.org/repos/irssi/trunk@330 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2000-06-12 23:27:41 +00:00 committed by cras
parent d446fefa32
commit dc50f35b75

View File

@ -189,29 +189,20 @@ static void flood_newmsg(IRC_SERVER_REC *server, int level, const char *nick, co
static void flood_privmsg(const char *data, IRC_SERVER_REC *server, const char *nick, const char *addr) static void flood_privmsg(const char *data, IRC_SERVER_REC *server, const char *nick, const char *addr)
{ {
int publiclevel;
char *params, *target, *text; char *params, *target, *text;
int level;
g_return_if_fail(data != NULL); g_return_if_fail(data != NULL);
g_return_if_fail(server != NULL); g_return_if_fail(server != NULL);
if (nick == NULL || addr == NULL) { if (addr == NULL || g_strcasecmp(nick, server->nick) == 0)
/* don't try to ignore server messages.. */
return; return;
}
params = event_get_params(data, 2, &target, &text); params = event_get_params(data, 2, &target, &text);
if (*text == 1 && g_strncasecmp(text+1, "ACTION", 6) != 0) { level = ischannel(*target) ? MSGLEVEL_PUBLIC : MSGLEVEL_MSGS;
/* CTCP */ if (addr != NULL && !ignore_check(server, nick, addr, target, text, level))
if (!ignore_check(server, nick, addr, target, text, MSGLEVEL_CTCPS)) flood_newmsg(server, level, nick, addr, target);
flood_newmsg(server, MSGLEVEL_CTCPS, nick, addr, target);
} else {
publiclevel = ischannel(*target) ? MSGLEVEL_PUBLIC : MSGLEVEL_MSGS;
if (addr != NULL && !ignore_check(server, nick, addr, target, text, publiclevel))
flood_newmsg(server, publiclevel, nick, addr, target);
}
g_free(params); g_free(params);
} }
@ -223,10 +214,8 @@ static void flood_notice(const char *data, IRC_SERVER_REC *server, const char *n
g_return_if_fail(data != NULL); g_return_if_fail(data != NULL);
g_return_if_fail(server != NULL); g_return_if_fail(server != NULL);
if (nick == NULL || addr == NULL) { if (addr == NULL || g_strcasecmp(nick, server->nick) == 0)
/* don't try to ignore server messages.. */
return; return;
}
params = event_get_params(data, 2, &target, &text); params = event_get_params(data, 2, &target, &text);
if (!ignore_check(server, nick, addr, target, text, MSGLEVEL_NOTICES)) if (!ignore_check(server, nick, addr, target, text, MSGLEVEL_NOTICES))
@ -237,16 +226,18 @@ static void flood_notice(const char *data, IRC_SERVER_REC *server, const char *n
static void flood_ctcp(const char *data, IRC_SERVER_REC *server, const char *nick, const char *addr, const char *target) static void flood_ctcp(const char *data, IRC_SERVER_REC *server, const char *nick, const char *addr, const char *target)
{ {
int level;
g_return_if_fail(data != NULL); g_return_if_fail(data != NULL);
g_return_if_fail(server != NULL); g_return_if_fail(server != NULL);
if (nick == NULL || addr == NULL) { if (addr == NULL || g_strcasecmp(nick, server->nick) == 0)
/* don't try to ignore server messages.. */
return; return;
}
if (!ignore_check(server, nick, addr, target, data, MSGLEVEL_CTCPS)) level = g_strncasecmp(data, "ACTION ", 7) != 0 ? MSGLEVEL_CTCPS :
flood_newmsg(server, MSGLEVEL_CTCPS, nick, addr, target); (ischannel(*target) ? MSGLEVEL_PUBLIC : MSGLEVEL_MSGS);
if (!ignore_check(server, nick, addr, target, data, level))
flood_newmsg(server, level, nick, addr, target);
} }
static void read_settings(void) static void read_settings(void)