about summary refs log tree commit diff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--client.c30
1 files changed, 17 insertions, 13 deletions
diff --git a/client.c b/client.c
index 088691a..57895a5 100644
--- a/client.c
+++ b/client.c
@@ -354,6 +354,10 @@ static int wordcmp(const char *line, size_t i, const char *word) {
 		line += strcspn(line, " ");
 		if (*line) line++;
 	}
+	if (line[0] == ':') {
+		line += strcspn(line, " ");
+		if (*line) line++;
+	}
 	while (i--) {
 		line += strcspn(line, " ");
 		if (*line) line++;
@@ -408,42 +412,42 @@ static regex_t *compile(regex_t *regex, const char *pattern) {
 typedef const char *Filter(const char *line);
 
 static const char *filterAccountNotify(const char *line) {
-	return (wordcmp(line, 1, "ACCOUNT") ? line : NULL);
+	return (wordcmp(line, 0, "ACCOUNT") ? line : NULL);
 }
 
 static const char *filterAwayNotify(const char *line) {
-	return (wordcmp(line, 1, "AWAY") ? line : NULL);
+	return (wordcmp(line, 0, "AWAY") ? line : NULL);
 }
 
 static const char *filterChghost(const char *line) {
-	return (wordcmp(line, 1, "CHGHOST") ? line : NULL);
+	return (wordcmp(line, 0, "CHGHOST") ? line : NULL);
 }
 
 static const char *filterExtendedJoin(const char *line) {
-	if (wordcmp(line, 1, "JOIN")) return line;
+	if (wordcmp(line, 0, "JOIN")) return line;
 	static regex_t regex;
 	static char buf[MessageCap];
 	return snip(buf, sizeof(buf), line, compile(&regex, "(JOIN [^ ]+).+"));
 }
 
 static const char *filterInviteNotify(const char *line) {
-	if (wordcmp(line, 1, "INVITE")) return line;
-	return (wordcmp(line, 2, stateNick()) ? NULL : line);
+	if (wordcmp(line, 0, "INVITE")) return line;
+	return (wordcmp(line, 1, stateNick()) ? NULL : line);
 }
 
 static const char *filterMessageTags(const char *line) {
-	return (wordcmp(line, 1, "TAGMSG") ? line : NULL);
+	return (wordcmp(line, 0, "TAGMSG") ? line : NULL);
 }
 
 static const char *filterMultiPrefix(const char *line) {
 	static char buf[MessageCap];
-	if (!wordcmp(line, 1, "352")) {
+	if (!wordcmp(line, 0, "352")) {
 		static regex_t regex;
 		return snip(
 			buf, sizeof(buf), line,
 			compile(&regex, "( [HG][*]?[~!@%&+])[~!@%&+]+")
 		);
-	} else if (!wordcmp(line, 1, "353")) {
+	} else if (!wordcmp(line, 0, "353")) {
 		static regex_t regex;
 		return snip(
 			buf, sizeof(buf), line,
@@ -455,7 +459,7 @@ static const char *filterMultiPrefix(const char *line) {
 }
 
 static const char *filterUserhostInNames(const char *line) {
-	if (wordcmp(line, 1, "353")) return line;
+	if (wordcmp(line, 0, "353")) return line;
 	static regex_t regex;
 	static char buf[MessageCap];
 	return snip(
@@ -496,14 +500,14 @@ void clientConsume(struct Client *client) {
 	const char *line = ringPeek(&time, client->consumer);
 	if (!line) return;
 
+	if (stateCaps & TagCaps && !(client->caps & TagCaps)) {
+		line = filterTags(line);
+	}
 	enum Cap diff = client->caps ^ stateCaps;
 	for (size_t i = 0; line && i < ARRAY_LEN(Filters); ++i) {
 		if (!Filters[i]) continue;
 		if (diff & (1 << i)) line = Filters[i](line);
 	}
-	if (stateCaps & TagCaps && !(client->caps & TagCaps)) {
-		if (line) line = filterTags(line);
-	}
 	if (!line) {
 		ringConsume(NULL, client->consumer);
 		return;
gmsg'> 2020-02-26Add Fierce Femmes and Notorious LiarsJune McEnroe 2020-02-23Add This Is How You Lose the Time WarJune McEnroe 2020-02-22Add See Ya LaterJune McEnroe 2020-02-20Remove wiki scriptJune McEnroe Wikipedia seems to have removed the one-sentence extracts from the opensearch results. Too bad. It's not a wiki script, what we need is a command that fetches single-sentence summaries of articles on Wikipedia. 2020-02-19Add The Obelisk GateJune McEnroe 2020-02-17Add Four Tet — HandsJune McEnroe One from the cafe that caught my attention. 2020-02-12Simplify macOS notify-sendJune McEnroe 2020-02-12Add imbox and notemap to pageJune McEnroe 2020-02-12Collapse simple linksJune McEnroe 2020-02-12Move catgirl up the pageJune McEnroe 2020-02-12Update catgirl pty grabJune McEnroe 2020-02-12Link to cgit /about pages where appropriateJune McEnroe 2020-02-11Separate LINKS from BINS for html to workJune McEnroe 2020-02-11Add margin to Bl-bullet itemsJune McEnroe 2020-02-10Match URLs inside parens or with paired parens insideJune McEnroe 2020-02-10Duplicate effective URL before passing it back to curlJune McEnroe Apparently sometimes it didn't like receiving its own internal storage to parse again. Understandable. 2020-02-09Add To Be Taught, If FortunateJune McEnroe 2020-02-04Add The Future of Another TimelineJune McEnroe Wow. One of the best I've read. 2020-01-31Reorganize the Makefile for the umpteenth timeJune McEnroe Broke out LDLIBS for each bin, and made everything more uniform. 2020-01-28Change scout sensitivity to 1.4June McEnroe idk it seems to work. 2020-01-28Import shows.txtJune McEnroe