summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--bounce.h1
-rw-r--r--client.c23
-rw-r--r--pounce.13
3 files changed, 25 insertions, 2 deletions
diff --git a/bounce.h b/bounce.h
index d94eae4..7bf830b 100644
--- a/bounce.h
+++ b/bounce.h
@@ -62,6 +62,7 @@ static inline struct Message parse(char *line) {
 	X("chghost", CapChghost) \
 	X("extended-join", CapExtendedJoin) \
 	X("invite-notify", CapInviteNotify) \
+	X("multi-prefix", CapMultiPrefix) \
 	X("sasl", CapSASL) \
 	X("server-time", CapServerTime) \
 	X("userhost-in-names", CapUserhostInNames) \
diff --git a/client.c b/client.c
index 324c6f0..6653005 100644
--- a/client.c
+++ b/client.c
@@ -302,6 +302,7 @@ static size_t strlcpyn(char *dst, const char *src, size_t cap, size_t len) {
 static char *snip(char *dst, size_t cap, const char *src, const regex_t *regex) {
 	size_t len = 0;
 	regmatch_t match[2];
+	assert(regex->re_nsub);
 	for (; *src; src += match[0].rm_eo) {
 		if (regexec(regex, src, 2, match, 0)) break;
 		len += strlcpyn(&dst[len], src, cap - len, match[0].rm_so);
@@ -353,13 +354,32 @@ static const char *filterInviteNotify(const char *line) {
 	return (wordcmp(line, 2, stateNick()) ? NULL : line);
 }
 
+static const char *filterMultiPrefix(const char *line) {
+	static char buf[512];
+	if (!wordcmp(line, 1, "352")) {
+		static regex_t regex;
+		return snip(
+			buf, sizeof(buf), line,
+			compile(&regex, "([HG][*]?[~!@%&+])[~!@%&+]+")
+		);
+	} else if (!wordcmp(line, 1, "353")) {
+		static regex_t regex;
+		return snip(
+			buf, sizeof(buf), line,
+			compile(&regex, "([ :][~!@%&+])[~!@%&+]+")
+		);
+	} else {
+		return line;
+	}
+}
+
 static const char *filterUserhostInNames(const char *line) {
 	if (wordcmp(line, 1, "353")) return line;
 	static regex_t regex;
 	static char buf[512];
 	return snip(
 		buf, sizeof(buf), line,
-		compile(&regex, "([ :][^!]+)![^ ]+")
+		compile(&regex, "([ :][^!]+)![^@]+@[^ ]+")
 	);
 }
 
@@ -369,6 +389,7 @@ static Filter *Filters[] = {
 	[CapChghostBit] = filterChghost,
 	[CapExtendedJoinBit] = filterExtendedJoin,
 	[CapInviteNotifyBit] = filterInviteNotify,
+	[CapMultiPrefixBit] = filterMultiPrefix,
 	[CapUserhostInNamesBit] = filterUserhostInNames,
 };
 
diff --git a/pounce.1 b/pounce.1
index bc33d23..6b7c5d9 100644
--- a/pounce.1
+++ b/pounce.1
@@ -1,4 +1,4 @@
-.Dd November 11, 2019
+.Dd November 14, 2019
 .Dt POUNCE 1
 .Os
 .
@@ -286,6 +286,7 @@ is supported:
 .Sy chghost ,
 .Sy extended-join ,
 .Sy invite-notify ,
+.Sy multi-prefix ,
 .Sy userhost-in-names .
 .
 .Ss Configuring SASL EXTERNAL
d class='logsubject'>Add DawnJune McEnroe 2019-05-20Declare vasprintf(3) for GNUJune McEnroe who the fuck is scraeming "#define _GNU_SOURCE" at my house. show yourself, coward. i will never #define _GNU_SOURCE 2019-05-20Fix comparison warning in ttpreJune McEnroe 2019-05-20Add AuthorityJune McEnroe 2019-05-19Specify precedence of unary versions of operatorsJune McEnroe 2019-05-18Add compound assignment operators to orderJune McEnroe 2019-05-15Support simple assignment in orderJune McEnroe 2019-05-15Implement sizeof in orderJune McEnroe 2019-05-15Add orderJune McEnroe 2019-05-12Add T suffix in bitJune McEnroe 2019-05-10Highlight yacc and lex files as CJune McEnroe Their %-prefixed directives should probably be highlighted Macro. 2019-05-10Use val instead of suboptargJune McEnroe suboptarg doesn't exist in GNU. Hopefully BSD getsubopt also sets val on failure? 2019-05-09Add Parable of the SowerJune McEnroe 2019-05-07Add bit without buildJune McEnroe Need to do some stuff in the Makefile for lex and yacc and generating HTML pages for it. 2019-05-04Fix MANDIR typoJune McEnroe 2019-05-04Move relay to binJune McEnroe