From 37295ea945f04e1a2cf45dcae24b19da5996b0db Mon Sep 17 00:00:00 2001
From: "C. McEnroe" <june@causal.agency>
Date: Sat, 28 Dec 2019 18:34:12 -0500
Subject: Don't insert self-messages

Even with NOTICEs litterbox would sometimes receive its own responses,
which would create duplicates in the database, essentially.
---
 litterbox.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/litterbox.c b/litterbox.c
index 5924680..9cc1bb5 100644
--- a/litterbox.c
+++ b/litterbox.c
@@ -360,12 +360,14 @@ static void handlePrivmsg(struct Message *msg) {
 		type = Action;
 	}
 
+	bool selfMessage = !strcmp(msg->nick, msg->params[0]);
 	if (query && searchQuery && type == Privmsg) {
-		if (searchQuery == Public || !strcmp(msg->nick, msg->params[0])) {
+		if (searchQuery == Public || selfMessage) {
 			querySearch(msg);
 			return;
 		}
 	}
+	if (selfMessage) return;
 
 	insertContext(context, query);
 	insertName(msg);
-- 
cgit 1.4.1