diff options
author | Timo Sirainen <cras@irssi.org> | 2000-06-12 23:27:41 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2000-06-12 23:27:41 +0000 |
commit | dc50f35b752ebeca2cd3fa2990549fa094e8525f (patch) | |
tree | 88cf75624a4c7472b5f392ae4fa3e49ea6ee13b1 /src/irc/flood/flood.c | |
parent | d446fefa32239bb45ff44d5e0792a5c42eef341e (diff) | |
download | irssi-dc50f35b752ebeca2cd3fa2990549fa094e8525f.zip |
Flood detection fixes
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@330 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/irc/flood/flood.c')
-rw-r--r-- | src/irc/flood/flood.c | 35 |
1 files changed, 13 insertions, 22 deletions
diff --git a/src/irc/flood/flood.c b/src/irc/flood/flood.c index 90206b5d..712f14fa 100644 --- a/src/irc/flood/flood.c +++ b/src/irc/flood/flood.c @@ -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) { - int publiclevel; char *params, *target, *text; + int level; g_return_if_fail(data != NULL); g_return_if_fail(server != NULL); - if (nick == NULL || addr == NULL) { - /* don't try to ignore server messages.. */ + if (addr == NULL || g_strcasecmp(nick, server->nick) == 0) return; - } params = event_get_params(data, 2, &target, &text); - if (*text == 1 && g_strncasecmp(text+1, "ACTION", 6) != 0) { - /* CTCP */ - if (!ignore_check(server, nick, addr, target, text, MSGLEVEL_CTCPS)) - 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); - } + level = ischannel(*target) ? MSGLEVEL_PUBLIC : MSGLEVEL_MSGS; + if (addr != NULL && !ignore_check(server, nick, addr, target, text, level)) + flood_newmsg(server, level, nick, addr, target); 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(server != NULL); - if (nick == NULL || addr == NULL) { - /* don't try to ignore server messages.. */ + if (addr == NULL || g_strcasecmp(nick, server->nick) == 0) return; - } params = event_get_params(data, 2, &target, &text); 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) { + int level; + g_return_if_fail(data != NULL); g_return_if_fail(server != NULL); - if (nick == NULL || addr == NULL) { - /* don't try to ignore server messages.. */ + if (addr == NULL || g_strcasecmp(nick, server->nick) == 0) return; - } - if (!ignore_check(server, nick, addr, target, data, MSGLEVEL_CTCPS)) - flood_newmsg(server, MSGLEVEL_CTCPS, nick, addr, target); + level = g_strncasecmp(data, "ACTION ", 7) != 0 ? MSGLEVEL_CTCPS : + (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) |