about summary refs log tree commit diff
path: root/bounce.h
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-02-25 18:06:41 -0500
committerJune McEnroe <june@causal.agency>2020-02-25 18:11:11 -0500
commitdde937cec56b3f6563322d37121308d3f5f5ac39 (patch)
tree2aa278588e31c07b23796f352dc5d6fb08c37c04 /bounce.h
parentBump buffer sizes to allow for tags (diff)
downloadpounce-dde937cec56b3f6563322d37121308d3f5f5ac39.tar.gz
pounce-dde937cec56b3f6563322d37121308d3f5f5ac39.zip
Request server-time from the server and filter tags for clients
This doesn't yet, but it will break the "robustness principle" according
to which a server "SHOULD NOT" assume that a client capable of parsing
one tag is capable of parsing all tags. In future, TagCaps will have all
other caps that use tags ORed into it, and only if the client supports
none of them will tags be filtered out.
Diffstat (limited to 'bounce.h')
-rw-r--r--bounce.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/bounce.h b/bounce.h
index f95bdc8..da52592 100644
--- a/bounce.h
+++ b/bounce.h
@@ -43,6 +43,7 @@ enum { MessageCap = 8191 + 512 };
 
 enum { ParamCap = 15 };
 struct Message {
+	char *tags;
 	char *origin;
 	char *cmd;
 	char *params[ParamCap];
@@ -50,6 +51,7 @@ struct Message {
 
 static inline struct Message parse(char *line) {
 	struct Message msg = {0};
+	if (line[0] == '@') msg.tags = 1 + strsep(&line, " ");
 	if (line[0] == ':') msg.origin = 1 + strsep(&line, " ");
 	msg.cmd = strsep(&line, " ");
 	for (size_t i = 0; line && i < ParamCap; ++i) {
@@ -79,6 +81,7 @@ enum Cap {
 #define X(name, id) BIT(id),
 	ENUM_CAP
 #undef X
+	TagCaps = CapServerTime,
 };
 
 static const char *CapNames[] = {