summary refs log tree commit diff
path: root/litterbox.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2019-12-28 18:34:12 -0500
committerJune McEnroe <june@causal.agency>2019-12-28 18:34:12 -0500
commit37295ea945f04e1a2cf45dcae24b19da5996b0db (patch)
tree3e6a96c5fc5a1d4c6ada132816713b22da332f20 /litterbox.c
parentRun PRAGMA optimize in dbClose (diff)
downloadlitterbox-37295ea945f04e1a2cf45dcae24b19da5996b0db.tar.gz
litterbox-37295ea945f04e1a2cf45dcae24b19da5996b0db.zip
Don't insert self-messages
Even with NOTICEs litterbox would sometimes receive its own responses,
which would create duplicates in the database, essentially.
Diffstat (limited to '')
-rw-r--r--litterbox.c4
1 files changed, 3 insertions, 1 deletions
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);