about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2021-04-02 17:32:47 -0400
committerJune McEnroe <june@causal.agency>2021-04-02 17:32:47 -0400
commitb02569e16e4643e65d73c3eb17deb7e3f529fe50 (patch)
treea5c981ea961d1b5568a6e834b7c3680745a30089
parentAllow interspersing flags and config files (diff)
downloadlitterbox-b02569e16e4643e65d73c3eb17deb7e3f529fe50.tar.gz
litterbox-b02569e16e4643e65d73c3eb17deb7e3f529fe50.zip
Skip STATUSMSG prefixes
This feature is rarely used, so just skip STATUSMSG prefixes in the
target so events use the right context.
-rw-r--r--litterbox.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/litterbox.c b/litterbox.c
index c3bc46e..cd7227b 100644
--- a/litterbox.c
+++ b/litterbox.c
@@ -128,6 +128,7 @@ static int searchLimit = 10;
 static char *self;
 static char *network;
 static char *chanTypes;
+static char *statusmsg;
 static char *prefixes;
 static char *prefixModes;
 static char *listModes;
@@ -182,6 +183,8 @@ static void handleReplyISupport(struct Message *msg) {
 			set(&network, msg->params[i]);
 		} else if (!strcmp(key, "CHANTYPES")) {
 			set(&chanTypes, msg->params[i]);
+		} else if (!strcmp(key, "STATUSMSG")) {
+			set(&statusmsg, msg->params[i]);
 		} else if (!strcmp(key, "PREFIX")) {
 			strsep(&msg->params[i], "(");
 			char *modes = strsep(&msg->params[i], ")");
@@ -429,6 +432,7 @@ static void handlePrivmsg(struct Message *msg) {
 
 	bool query = true;
 	const char *context = msg->params[0];
+	if (statusmsg) context += strspn(context, statusmsg);
 	if (strchr(chanTypes, context[0])) query = false;
 	if (!strcmp(context, self)) context = msg->nick;