summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--handle.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/handle.c b/handle.c
index 00e854c..8e91810 100644
--- a/handle.c
+++ b/handle.c
@@ -248,17 +248,26 @@ static void handleReplyISupport(struct Message *msg) {
 			if (!msg->params[i]) continue;
 			set(&network.chanTypes, msg->params[i]);
 		} else if (!strcmp(key, "PREFIX")) {
-			if (!msg->params[i]) continue;
 			strsep(&msg->params[i], "(");
-			set(&network.prefixModes, strsep(&msg->params[i], ")"));
-			set(&network.prefixes, msg->params[i]);
-			assert(strlen(network.prefixes) == strlen(network.prefixModes));
+			char *modes = strsep(&msg->params[i], ")");
+			char *prefixes = msg->params[i];
+			if (!modes || !prefixes || strlen(modes) != strlen(prefixes)) {
+				errx(EX_PROTOCOL, "invalid PREFIX value");
+			}
+			set(&network.prefixModes, modes);
+			set(&network.prefixes, prefixes);
 		} else if (!strcmp(key, "CHANMODES")) {
-			if (!msg->params[i]) continue;
-			set(&network.listModes, strsep(&msg->params[i], ","));
-			set(&network.paramModes, strsep(&msg->params[i], ","));
-			set(&network.setParamModes, strsep(&msg->params[i], ","));
-			set(&network.channelModes, strsep(&msg->params[i], ","));
+			char *list = strsep(&msg->params[i], ",");
+			char *param = strsep(&msg->params[i], ",");
+			char *setParam = strsep(&msg->params[i], ",");
+			char *channel = strsep(&msg->params[i], ",");
+			if (!list || !param || !setParam || !channel) {
+				errx(EX_PROTOCOL, "invalid CHANMODES value");
+			}
+			set(&network.listModes, list);
+			set(&network.paramModes, param);
+			set(&network.setParamModes, setParam);
+			set(&network.channelModes, channel);
 		} else if (!strcmp(key, "EXCEPTS")) {
 			network.excepts = (msg->params[i] ?: "e")[0];
 		} else if (!strcmp(key, "INVEX")) {
ubject'>Add photos from September 5June McEnroe Had to prefix the folder number onto these file names manually because they must have come out of a different scanner or something. 2024-09-15Add some more film stocks to the listJune McEnroe 2024-09-13Add photos from September 2June McEnroe 2024-09-13Add Fomapan 200 to films listJune McEnroe 2024-09-10Add August 29 picnic photosJune McEnroe 2024-09-08Apply some bold to trips renderingJune McEnroe This seems easier to visually scan. The only other thing I'd like is a nicer date rendering but JavaScript is useless for that. 2024-09-08Render trips hopefully more efficientlyJune McEnroe 2024-09-08Allow removing bodies and lensesJune McEnroe 2024-09-08Limit body width so it looks less silly on desktopJune McEnroe 2024-09-07Handle no film being loadedJune McEnroe 2024-09-07Fancy up the text a littleJune McEnroe