summaryrefslogtreecommitdiff
path: root/src/irc/flood
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2000-06-12 22:57:53 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2000-06-12 22:57:53 +0000
commit18f3c74d68e79f5962000770fca9e663bf1b1c23 (patch)
treef16183cc068553da6080a481a5c83c14c97b7bd5 /src/irc/flood
parent919abb2c6f8339e160a59b8ddcacfd403772379d (diff)
downloadirssi-18f3c74d68e79f5962000770fca9e663bf1b1c23.zip
CTCP msgs/replies stops the "event privmsg" or "event notice" signals now
so you don't have to check for them anymore (unless you use signal_add_first()..). /WINDOW MOVE command had some bugs. CTCP reply to some channel didn't display the channel name. Several code cleanups. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@327 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/irc/flood')
-rw-r--r--src/irc/flood/flood.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/src/irc/flood/flood.c b/src/irc/flood/flood.c
index 3e66afa6..90206b5d 100644
--- a/src/irc/flood/flood.c
+++ b/src/irc/flood/flood.c
@@ -195,7 +195,7 @@ static void flood_privmsg(const char *data, IRC_SERVER_REC *server, const char *
g_return_if_fail(data != NULL);
g_return_if_fail(server != NULL);
- if (nick == NULL) {
+ if (nick == NULL || addr == NULL) {
/* don't try to ignore server messages.. */
return;
}
@@ -223,18 +223,32 @@ 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) {
+ if (nick == NULL || addr == NULL) {
/* don't try to ignore server messages.. */
return;
}
params = event_get_params(data, 2, &target, &text);
- if (addr != NULL && !ignore_check(server, nick, addr, target, text, MSGLEVEL_NOTICES))
- flood_newmsg(server, MSGLEVEL_NOTICES | ischannel(*target) ? MSGLEVEL_PUBLIC : MSGLEVEL_MSGS, nick, addr, target);
+ if (!ignore_check(server, nick, addr, target, text, MSGLEVEL_NOTICES))
+ flood_newmsg(server, MSGLEVEL_NOTICES, nick, addr, target);
g_free(params);
}
+static void flood_ctcp(const char *data, IRC_SERVER_REC *server, const char *nick, const char *addr, const char *target)
+{
+ g_return_if_fail(data != NULL);
+ g_return_if_fail(server != NULL);
+
+ if (nick == NULL || addr == NULL) {
+ /* don't try to ignore server messages.. */
+ return;
+ }
+
+ if (!ignore_check(server, nick, addr, target, data, MSGLEVEL_CTCPS))
+ flood_newmsg(server, MSGLEVEL_CTCPS, nick, addr, target);
+}
+
static void read_settings(void)
{
int time;
@@ -255,6 +269,8 @@ static void read_settings(void)
flood_tag = g_timeout_add(time, (GSourceFunc) flood_timeout, NULL);
signal_add("event privmsg", (SIGNAL_FUNC) flood_privmsg);
signal_add("event notice", (SIGNAL_FUNC) flood_notice);
+ signal_add("ctcp msg", (SIGNAL_FUNC) flood_ctcp);
+ signal_add("ctcp reply", (SIGNAL_FUNC) flood_ctcp);
}
}
@@ -280,6 +296,8 @@ void irc_flood_deinit(void)
g_source_remove(flood_tag);
signal_remove("event privmsg", (SIGNAL_FUNC) flood_privmsg);
signal_remove("event notice", (SIGNAL_FUNC) flood_notice);
+ signal_remove("ctcp msg", (SIGNAL_FUNC) flood_ctcp);
+ signal_remove("ctcp reply", (SIGNAL_FUNC) flood_ctcp);
}
signal_remove("setup changed", (SIGNAL_FUNC) read_settings);