summary refs log tree commit diff
path: root/archive.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--archive.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/archive.c b/archive.c
index 497b5a6..889f253 100644
--- a/archive.c
+++ b/archive.c
@@ -115,6 +115,15 @@ static struct AddressList parseAddressList(struct List list) {
 	return (struct AddressList) { list.len, addrs };
 }
 
+static char *parseID(char *id) {
+	size_t len = strlen(id);
+	if (id[0] != '<' || !len || id[len - 1] != '>') {
+		errx(EX_PROTOCOL, "invalid message ID");
+	}
+	id[len - 1] = '\0';
+	return &id[1];
+}
+
 static struct Envelope parseEnvelope(struct List list) {
 	enum {
 		Date, Subject, From, Sender, ReplyTo,
@@ -162,12 +171,12 @@ static struct Envelope parseEnvelope(struct List list) {
 	envelope.bcc = parseAddressList(list.ptr[Bcc].list);
 
 	if (list.ptr[InReplyTo].type == String) {
-		envelope.inReplyTo = list.ptr[InReplyTo].string;
+		envelope.inReplyTo = parseID(list.ptr[InReplyTo].string);
 	}
 	if (list.ptr[MessageID].type != String) {
 		errx(EX_PROTOCOL, "invalid envelope message-id field");
 	}
-	envelope.messageID = list.ptr[MessageID].string;
+	envelope.messageID = parseID(list.ptr[MessageID].string);
 
 	return envelope;
 }
ref='/catgirl/commit/input.c?h=vimode&id=cca9688cca171dc3ee6ac24822bdd8c315997759&follow=1'>Clear edit buffer before running commandJune McEnroe 2022-02-20Show indicator in status when window has pending inputJune McEnroe 2022-02-20Use separate edit buffers for each IDJune McEnroe 2022-02-20Make sure new cap is actually larger than new lengthJune McEnroe 2022-02-20Remove unused mbs.len field from struct EditJune McEnroe 2022-02-19Remove unneeded includes in ui.cJune McEnroe 2022-02-19Reimplement tab completeJune McEnroe 2022-02-19Handle errors from editFn, etc.June McEnroe 2022-02-19Reimplement text macrosJune McEnroe 2022-02-19Factor out input handling to input.cJune McEnroe 2022-02-19Factor out window management to window.cJune McEnroe 2022-02-19Enable -Wmissing-prototypesJune McEnroe 2022-02-19Fix edit.[ch] license notice additional permissionsJune McEnroe 2022-02-19Run line editing testsJune McEnroe 2022-02-18Implement new line editing "library"June McEnroe 2022-02-18Simplify cursor positioning in inputJune McEnroe 2022-02-18Fix M-f orderingJune McEnroe 2022-02-12Move sandman build to scripts/MakefileJune McEnroe 2022-02-12Use compat_readpassphrase.c on LinuxJune McEnroe 2022-02-12Copy RPP defines from oconfigureJune McEnroe