diff options
author | John Ankarström <john@ankarstrom.se> | 2021-05-21 00:50:39 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2021-05-21 00:50:39 +0200 |
commit | d3594888000fbc0a8da0dd0978d2de403511e753 (patch) | |
tree | 392f64002223439e0d0c05cf2388450a68534191 | |
parent | 70e572f5458aafd0ff7c555d75cf1abc1a575c47 (diff) | |
download | mum-d3594888000fbc0a8da0dd0978d2de403511e753.tar.gz |
Add M-Status header
-rw-r--r-- | doc/mum.ms | 86 | ||||
-rwxr-xr-x | src/pop | 15 |
2 files changed, 65 insertions, 36 deletions
@@ -10,26 +10,28 @@ .DE .. .TL -mum \(en modern UNIX mail interface +.BI mum +\(en a modern UNIX mail interface .AU John Ankarström -.SH \" ----------------------------------------------------------------- -Introduction +.AB \" ----------------------------------------------------------------- .LP Mum is a text-based e-mail client for UNIX and UNIX-like operating systems that supports both plain-text and HTML e-mail. It introduces a couple of innovations to the landscape of UNIX e-mail clients: -.IP \h'2n'1. -Reasonable support for HTML e-mail out of the box. -.IP \h'2n'2. -A new method for local storage of e-mail, called -.I "indexed mbox" . -.IP \h'2n'3. -.I Views +1) +reasonable support for HTML e-mail out of the box, +2) +a new method for local storage of e-mail, called +.I "indexed mbox" , +and +3) +.I views \(en simple scripts that filter messages \(en instead of folders. -.LP -In this document, the fundamental concepts of mum are explained. +In this document, the fundamental concepts underlying mum are +explained. +.AE .SH \" ----------------------------------------------------------------- The indexed mbox format .LP @@ -45,29 +47,57 @@ enhances it with an additional file called an .I index , which carries the same name as the mbox plus the extension .I .i . -The index contains all headers from the mbox file, including the +Mum and its associated view scripts use the index for most operations. +Whenever it is time to read the actual contents of a message, the +message is retrieved from the mbox using the offset specified in +the index. +.PP +The index contains all headers from the mbox file, as well as the .I From_ -line, without the actual contents of the corresponding messages. -Further, each block of headers contains three additional headers: +line, but without the actual contents of the corresponding messages. +Further, each block of headers contains four additional headers: .IP \h'2n'1. -.I UID , -containing the unique identifier of the message provided by the -mail server (optional). -.IP \h'2n'2. -.I Offset , +.I M-Offset , containing the starting position of the corresponding message in the original mbox file, described as a byte offset. -(It is important to note that the mbox and mbox.i files are -append-only.) -.IP \h'2n'3. -.I Message-Length , +(It is important to note that the mbox file is append-only.) +.IP \h'2n'2. +.I M-Length , containing the length of the entire message in the mbox file, including both headers and body, in number of bytes. +.IP \h'2n'3. +.I M-Status , +containing a one-byte value in hexadecimal notation, e.g. +.CW 0F . +.IP \h'2n'4. +.I M-UID , +containing the unique identifier of the message provided by the +mail server (optional). .LP -Mum and its associated view scripts use the index for most operations. -Whenever it is time to read the actual contents of a message, the -message is retrieved from the mbox using the offset specified in -the index. +The hexadecimal value specified in the +.I M-Status +describes the status of the message. +One byte enough to fit eight different flags: +.IP "\h'2n'\fC00 (0000 0000)" +no status (default) +.IP "\h'2n'\fC01 (0000 0001)" +read +.IP "\h'2n'\fC02 (0000 0010)" +ignored +.IP "\h'2n'\fC04 (0000 0100)" +important +.IP "\h'2n'\fC08 (0000 1000)" +(reserved but yet undecided) +.PP +.in 2n +The other byte can be freely used by the user themselves to store +any statuses they wish. +.LP +.I M-Status +is the only header that is allowed to be modified after a message +has been recorded in the index file. +Note, however, that any updates made to the value must not change +the size of the index file. .SH \" ----------------------------------------------------------------- Retrieval methods .LP @@ -23,11 +23,9 @@ if (@ARGV != 2) { my ($mbox, $index, @existing_uids); if (-e $ARGV[1]) { open $index, '<', $ARGV[1] or die "Could not open $ARGV[1]: $!"; - { - local $/ = ''; # paragraph mode - while (<$index>) { - push @existing_uids, $1 if /^UID: (.*)$/m; - } + local $/ = ''; # paragraph mode + while (<$index>) { + push @existing_uids, $1 if /^M-UID: (.*)$/m; } close $index; } @@ -112,9 +110,10 @@ $from_ MBOX print $index <<INDEX; $from_ -UID: $uids{$id} -Offset: $offset -Message-Length: $message_length +M-Offset: $offset +M-Length: $message_length +M-Status: 00 +M-UID: $uids{$id} @msg[0..$j-1] INDEX |