summary refs log tree commit diff
path: root/ignore.c
diff options
context:
space:
mode:
authorC. McEnroe2020-07-06 22:40:30 -0400
committerC. McEnroe2020-07-06 22:41:22 -0400
commitcb84983dd1b93d3d382600e95543a73bdc7b4428 (patch)
tree3ba4a5c499f08880bcbae9c08d58688be8606dfb /ignore.c
parent529028fe4a2973aaae466c294b43d8d59f380f9d (diff)
Add message to ignore patterns
Diffstat (limited to 'ignore.c')
-rw-r--r--ignore.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/ignore.c b/ignore.c
index 29a681e..f91b089 100644
--- a/ignore.c
+++ b/ignore.c
@@ -46,10 +46,12 @@ const char *ignoreAdd(const char *pattern) {
 	}
 	char **dest = &ignore.patterns[ignore.len++];
 	if (!ex && !sp) {
-		asprintf(dest, "%s!*@* * *", pattern);
+		asprintf(dest, "%s!*@* * * *", pattern);
 	} else if (sp < 1) {
-		asprintf(dest, "%s * *", pattern);
+		asprintf(dest, "%s * * *", pattern);
 	} else if (sp < 2) {
+		asprintf(dest, "%s * *", pattern);
+	} else if (sp < 3) {
 		asprintf(dest, "%s *", pattern);
 	} else {
 		*dest = strdup(pattern);
@@ -72,8 +74,9 @@ bool ignoreRemove(const char *pattern) {
 enum Heat ignoreCheck(enum Heat heat, uint id, const struct Message *msg) {
 	char match[512];
 	snprintf(
-		match, sizeof(match), "%s!%s@%s %s %s",
-		msg->nick, msg->user, msg->host, msg->cmd, idNames[id]
+		match, sizeof(match), "%s!%s@%s %s %s %s",
+		msg->nick, msg->user, msg->host,
+		msg->cmd, idNames[id], (msg->params[1] ?: "")
 	);
 	for (size_t i = 0; i < ignore.len; ++i) {
 		if (fnmatch(ignore.patterns[i], match, FNM_CASEFOLD)) continue;