Talk:Oberon/A2/Oberon.Mail.Mod

CutLines vs. Wrap
Mail.CutLines has at least three faults. Wrap corrects these faults. The name is chosen by analogy to the wrapping of a cord onto a mandrel, ... PeterEasthope (discuss • contribs) 17:04, 9 September 2017 (UTC)
 * If the width limit is w and a word of length v, with v > w, is encountered, then v-w empty lines are inserted before the long word.
 * CutLines invokes Texts.Insert which invokes Display.Broadcast which updates the viewer at least. CutLines makes repeated insertions; therefore invokes repeated updates and consequently is slow.
 * CutLines can make lines shorter. It can not join lines.

Conformance to POP and POP3
Regarding the POP3 protocol, RFC 1939, Section 3 states "Keywords and arguments are each[sic] separated by a single SPACE character." The extra blank appended to the front of the argument by Mail.NrToArg when converting a single digit was erroneous. The Zimbra POP3 server reported "-ERR unable to parse msg" and refused to cooperate. The blank has been removed from Oberon.Mail.NrToArg. ... PeterEasthope (discuss • contribs) 16:59, 9 September 2017 (UTC)

The cont.len Bug
Messages are stored in sequence in the file named in MsgFile; in the distribution, the file is MailMessages. A message comprises a header and a body. When message number no is read from the POP server, the total length is recorded in msgs[no].len.

For a non-plain message, Mail.decodeMessage has MIME.ReadHeader(S, NIL, h, len) which returns the length of the header in len.

"cont" refers to MIME "content" which is contained in the message body. The length of the message body is msgs[no].len - len; not msgs[no].len. The consequence of the bug is that when Mail.Show displays a non-plain message, characters from the following message are appended to the message body. Not destructive but certainly distracting.

The correction is to change cont.len := msgs[no].len; to cont.len := msgs[no].len - len; in decodeMessage.

Mail.Show Command
The parameter of the Mail.Show command is a message number. When no parameter is given, the command produced no output. Show is easily modified so that in absence of a parameter, a concise list of all messages is produced. Useful when searching in a large number of messages.

Searches
The Oberon Mail module has two searches. The first is for string pat marking the beginning of a message in the incoming buffer, buf. The second is TextSearch. These searches apply the Boyer-Moore algorithm. The implementations use displacement vectors, d in Search and sDv in TextSearch.