about summary refs log tree commit diff
path: root/bounce.h
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-02-27 02:56:54 -0500
committerJune McEnroe <june@causal.agency>2020-02-27 02:56:54 -0500
commit21bb677c1f395541a1b0610a0f576d58ce778273 (patch)
tree5860433bdc64a69a677926f7ba48bd6da78a508d /bounce.h
parentProperly treat CAP LS version as a number (diff)
downloadpounce-21bb677c1f395541a1b0610a0f576d58ce778273.tar.gz
pounce-21bb677c1f395541a1b0610a0f576d58ce778273.zip
Send CAP LS 302 to the server
Diffstat (limited to 'bounce.h')
-rw-r--r--bounce.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/bounce.h b/bounce.h
index 5aff027..1eb5ce9 100644
--- a/bounce.h
+++ b/bounce.h
@@ -102,19 +102,20 @@ static const char *CapNames[] = {
 #undef X
 };
 
-static inline enum Cap capParse(const char *list) {
+static inline enum Cap capParse(const char *list, const char *values[CapBits]) {
 	enum Cap caps = 0;
 	while (*list) {
 		enum Cap cap = CapUnsupported;
-		size_t len = strcspn(list, " ");
+		size_t len = strcspn(list, "= ");
 		for (size_t i = 0; i < ARRAY_LEN(CapNames); ++i) {
 			if (len != strlen(CapNames[i])) continue;
 			if (strncmp(list, CapNames[i], len)) continue;
 			cap = 1 << i;
+			if (list[len] == '=' && values) values[i] = &list[len + 1];
 			break;
 		}
 		caps |= cap;
-		list += len;
+		list += strcspn(list, " ");
 		if (*list) list++;
 	}
 	return caps;