You are looking at historical revision 18081 of this page. It may differ significantly from its current revision.

mbox

Description

The mbox library contains procedures for parsing of mbox database files, RFC 4155. It is intended to conform closely to the ABNF grammar in the RFC.

Library Procedures

Message Predicates and Accessors

The parsing procedures in this library return a list of message objects. The following procedures are available for manipulating the message objects:

[procedure] (message? X) => BOOL

Returns #t if the given argument is a message object, #f otherwise.

[procedure] (message-envelope X) => ENVELOPE

Returns the envelope part of a message. The envelope is an s-expression of the following form:

((time-seconds R) [(ctime ...) | (abbrtime ...)] (address ADDRESS))

The time-seconds field contains the time when the message was received, in seconds since 1900. The ctime or abbrtime fields contain the components of the date/time string. The address fields is an s-expression of the form:

 ((local-part STRING) (domain STRING))
[procedure] (message-headers X) => (LAMBDA () => HEADERS)

Returns the headers part of a message. This is a procedure of no arguments that when invoked, returns the parsed list of headers in an alist where the key is the header name (as a symbol), and the value is the parsed header contents.

[procedure] (message-body X) => (LAMBDA ([P]) => BODY)

Returns the body part of a message. This is a procedure of a single argument, that when invoked, uses the given argument procedure to parse the message body, and returns the result.

Parsing Procedures

[procedure] (mbox-file->messages FILENAME) => MESSAGE LIST

Given a filename, parses the given files as an mbox database, and returns a list of message objects. The contents of the message are represented as a list of characters.

[procedure] (mbox-file->messages/byte-blob-stream FILENAME) => MESSAGE LIST

Given a filename, parses the given files as an mbox database, and returns a list of message objects. The contents of the message are represented as a byte-blob-stream object.

Requires

Version History

License

 Copyright 2010 Ivan Raikov and the Okinawa Institute of Science and Technology.
 This program is free software: you can redistribute it and/or
 modify it under the terms of the GNU General Public License as
 published by the Free Software Foundation, either version 3 of the
 License, or (at your option) any later version.
 This program is distributed in the hope that it will be useful, but
 WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 General Public License for more details.
 A full copy of the GPL license can be found at
 <http://www.gnu.org/licenses/>.