summaryrefslogtreecommitdiff
path: root/src/irc/dcc/dcc.c
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2001-11-19 20:16:24 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2001-11-19 20:16:24 +0000
commit5bcb8251f5350a4ebdd68ec3b1d7bf8015946d80 (patch)
treed9d61f0effbb04ac7c9e54de5166a9f05ae76160 /src/irc/dcc/dcc.c
parent207916412882ddfa83be6a40ddc739c9d3032839 (diff)
downloadirssi-5bcb8251f5350a4ebdd68ec3b1d7bf8015946d80.zip
Ignoring CTCPs shouldn't ignore DCC CTCPs, we're checking DCC level for
ignoring them now. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2094 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/irc/dcc/dcc.c')
-rw-r--r--src/irc/dcc/dcc.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/irc/dcc/dcc.c b/src/irc/dcc/dcc.c
index 651e8678..b586a51e 100644
--- a/src/irc/dcc/dcc.c
+++ b/src/irc/dcc/dcc.c
@@ -25,6 +25,8 @@
#include "line-split.h"
#include "misc.h"
#include "settings.h"
+#include "ignore.h"
+#include "levels.h"
#include "irc-servers.h"
@@ -283,6 +285,32 @@ static void sig_server_nick_changed(IRC_SERVER_REC *server)
}
}
+/* handle emitting "ctcp msg dcc" signal - don't use it directly because
+ with /IGNORE * CTCPS we'd be ignored */
+static void ctcp_msg(IRC_SERVER_REC *server, const char *data,
+ const char *nick, const char *addr, const char *target)
+{
+ if (g_strncasecmp(data, "dcc ", 4) != 0)
+ return;
+ data += 4;
+
+ signal_emit("ctcp msg dcc", 5, server, data, nick, addr, target);
+ signal_stop();
+}
+
+/* handle emitting "ctcp reply dcc" signal - don't use it directly because
+ with /IGNORE * CTCPS we'd be ignored */
+static void ctcp_reply(IRC_SERVER_REC *server, const char *data,
+ const char *nick, const char *addr, const char *target)
+{
+ if (g_strncasecmp(data, "dcc ", 4) != 0)
+ return;
+ data += 4;
+
+ signal_emit("ctcp reply dcc", 5, server, data, nick, addr, target);
+ signal_stop();
+}
+
/* Handle incoming DCC CTCP messages - either from IRC server or DCC chat */
static void ctcp_msg_dcc(IRC_SERVER_REC *server, const char *data,
const char *nick, const char *addr,
@@ -290,6 +318,9 @@ static void ctcp_msg_dcc(IRC_SERVER_REC *server, const char *data,
{
char *args, *str;
+ if (ignore_check(SERVER(server), nick, addr, target, data, MSGLEVEL_DCC))
+ return;
+
str = g_strconcat("ctcp msg dcc ", data, NULL);
args = strchr(str+13, ' ');
if (args != NULL) *args++ = '\0'; else args = "";
@@ -309,6 +340,9 @@ static void ctcp_reply_dcc(IRC_SERVER_REC *server, const char *data,
{
char *args, *str;
+ if (ignore_check(SERVER(server), nick, addr, target, data, MSGLEVEL_DCC))
+ return;
+
str = g_strconcat("ctcp reply dcc ", data, NULL);
args = strchr(str+15, ' ');
if (args != NULL) *args++ = '\0'; else args = "";
@@ -466,6 +500,8 @@ void irc_dcc_init(void)
signal_add("server connected", (SIGNAL_FUNC) sig_server_connected);
signal_add("server disconnected", (SIGNAL_FUNC) sig_server_disconnected);
signal_add("server nick changed", (SIGNAL_FUNC) sig_server_nick_changed);
+ signal_add("ctcp msg", (SIGNAL_FUNC) ctcp_msg);
+ signal_add("ctcp reply", (SIGNAL_FUNC) ctcp_reply);
signal_add("ctcp msg dcc", (SIGNAL_FUNC) ctcp_msg_dcc);
signal_add("ctcp reply dcc", (SIGNAL_FUNC) ctcp_reply_dcc);
signal_add("ctcp reply dcc reject", (SIGNAL_FUNC) ctcp_reply_dcc_reject);
@@ -496,6 +532,8 @@ void irc_dcc_deinit(void)
signal_remove("server connected", (SIGNAL_FUNC) sig_server_connected);
signal_remove("server disconnected", (SIGNAL_FUNC) sig_server_disconnected);
signal_remove("server nick changed", (SIGNAL_FUNC) sig_server_nick_changed);
+ signal_remove("ctcp msg", (SIGNAL_FUNC) ctcp_msg);
+ signal_remove("ctcp reply", (SIGNAL_FUNC) ctcp_reply);
signal_remove("ctcp msg dcc", (SIGNAL_FUNC) ctcp_msg_dcc);
signal_remove("ctcp reply dcc", (SIGNAL_FUNC) ctcp_reply_dcc);
signal_remove("ctcp reply dcc reject", (SIGNAL_FUNC) ctcp_reply_dcc_reject);