Common Lisp Package: MIME4CL

README:

FUNCTION

Public

DECODE-BASE64-STREAM (IN OUT &KEY PARSER-ERRORS)

Read from IN a stream of characters Base64 encoded and write to OUT a stream of decoded bytes.

DECODE-QUOTED-PRINTABLE-STREAM (IN OUT &KEY PARSER-ERRORS)

Read from stream IN a quoted printable text and write to binary output OUT the decoded stream of bytes.

DECODE-QUOTED-PRINTABLE-STRING (STRING &KEY (START 0) (END (LENGTH STRING)) PARSER-ERRORS)

Decode STRING as quoted printable sequence of characters and return a decoded sequence of bytes.

ENCODE-BASE64-SEQUENCE (SEQUENCE &KEY (START 0) (END (LENGTH SEQUENCE)))

Encode the sequence of bytes SEQUENCE into a Base64 string and return it.

ENCODE-BASE64-STREAM (IN OUT)

Read a byte stream from IN and write to OUT the encoded Base64 character stream.

ENCODE-QUOTED-PRINTABLE-SEQUENCE (SEQUENCE &KEY (START 0) (END (LENGTH SEQUENCE)))

Encode the sequence of bytes SEQUENCE into a quoted printable string and return it.

ENCODE-QUOTED-PRINTABLE-STREAM (IN OUT)

Read from IN a stream of bytes and write to OUT a stream of characters quoted printables encoded.

MAILBOXES-ONLY (LIST-OF-MAILBOXES-AND-GROUPS)

Return a flat list of MAILBOX-ADDRESSes from LIST-OF-MAILBOXES-AND-GROUPS, which is the kind of list returned by PARSE-ADDRESSES. This turns out to be useful when your program is not interested in mailbox groups and expects the user addresses only.

MBX-DESCRIPTION (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

MBX-DOMAIN (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

MBX-HOST (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

MBX-USER (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

MBXG-MAILBOXES (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

MBXG-NAME (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

PARSE-ADDRESSES (STRING &KEY NO-GROUPS)

Parse STRING and return a list of MAILBOX-ADDRESSes or MAILBOX-GROUPs. If STRING is unparsable return NIL. If NO-GROUPS is true, return a flat list of mailboxes throwing away the group containers, if any.

PARSE-RFC2047-TEXT (TEXT)

Parse the string TEXT according to RFC2047 rules and return a list of pairs and strings. The strings are the bits interposed between the actually encoded text. The pairs are composed of: a decoded byte sequence, a charset string indicating the original coding.

PARSE-RFC822-DATE (DATE-STRING)

Parse a RFC822 compliant date string and return an universal time.

PARSE-RFC822-HEADER (STRING)

Parse STRING which should be a valid RFC822 message header and return two values: a string of the header name and a string of the header value.

READ-MIME-MESSAGE (STREAM)

Main function to read a MIME message from a stream. It returns a MIME-MESSAGE object.

READ-RFC822-HEADERS (STREAM &OPTIONAL REQUIRED-HEADERS)

Read RFC822 compliant headers from STREAM and return them in a alist of keyword and string pairs. REQUIRED-HEADERS is a list of header names we are interested in; if NIL return all headers found in STREAM.

TIME-RFC822-STRING (&OPTIONAL (EPOCH (GET-UNIVERSAL-TIME)))

Return a string describing the current time according to the RFC822.

Undocumented

DECODE-BASE64-STRING (STRING &KEY (START 0) (END (LENGTH STRING)) PARSER-ERRORS)

DECODER-READ-SEQUENCE

SETFMBX-DESCRIPTION (NEW-VALUE INSTANCE)

SETFMBX-DOMAIN (NEW-VALUE INSTANCE)

SETFMBX-HOST (NEW-VALUE INSTANCE)

SETFMBX-USER (NEW-VALUE INSTANCE)

SETFMBXG-MAILBOXES (NEW-VALUE INSTANCE)

SETFMBXG-NAME (NEW-VALUE INSTANCE)

MIME-BODY-LENGTH (MIME-PART)

MIME-BODY-STREAM (MIME-PART &KEY (BINARY T))

MIME-PART-P (OBJECT)

MIME-TEXT-CHARSET (PART)

Private

ANALYSE-STRING (STRING)

Return the list of tokens produced by a lexical analysis of STRING. These are the tokens that would be seen by the parser.

CURSOR-POSITION (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

CURSOR-STREAM (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

DEBUG-ADDRESSES (STRING)

More or less like PARSE-ADDRESSES, but don't ignore parsing errors.

DECODE-QUOTED-PRINTABLE-RFC2047-STRING

Decode a string encoded according to the quoted printable method of RFC2047 and return a sequence of bytes.

DECODE-QUOTED-PRINTABLE-STREAM-TO-SEQUENCE (STREAM &KEY PARSER-ERRORS)

Read from STREAM a quoted printable text and return a vector of bytes.

DECODE-RFC2047-STRING (ENCODING STRING &KEY (START 0) (END (LENGTH STRING)))

Decode STRING according to RFC2047 and return a sequence of bytes.

DO-MULTIPART-PARTS (BODY-STREAM PART-BOUNDARY CONTENTS-FUNCTION END-PART-FUNCTION)

Read through BODY-STREAM. Call CONTENTS-FUNCTION at each (non-boundary) line or END-PART-FUNCTION at each PART-BOUNDARY.

DUMP-STREAM-BINARY (IN OUT)

Write content of IN character stream to OUT binary stream.

ENCODE-BASE64-SEQUENCE-TO-STREAM (SEQUENCE STREAM &KEY (START 0) (END (LENGTH SEQUENCE)))

Encode the sequence of bytes SEQUENCE and write to STREAM the Base64 character sequence.

ENCODE-QUOTED-PRINTABLE-SEQUENCE-TO-STREAM (SEQUENCE STREAM &KEY (START 0) (END (LENGTH SEQUENCE)))

Encode the sequence of bytes SEQUENCE and write to STREAM a quoted printable sequence of characters.

FILE-PORTION-DATA (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

FILE-PORTION-ENCODING (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

FILE-PORTION-END (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

FILE-PORTION-START (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

INDEX-MULTIPART-PARTS (BODY-STREAM PART-BOUNDARY)

Read from BODY-STREAM and return the file offset of the MIME parts separated by PART-BOUNDARY.

KEYWORDIFY-ENCODING (STRING)

Return a keyword for a content transfer encoding string. Return STRING itself if STRING is an unkown encoding.

MAKE-MIME-PART (HEADERS STREAM)

Create a MIME-PART object based on HEADERS and a body which has to be read from STREAM. If the mime part type can't be guessed from the headers, use the *DEFAULT-TYPE*.

PARSE-CONTENT-DISPOSITION (STRING)

Parse string as a Content-Disposition MIME header and return a list. The first element is the layout, the other elements are the optional parameters alist. Example: ("inline" ("filename" . "doggy.jpg")).

PARSE-CONTENT-TYPE (STRING)

Parse string as a Content-Type MIME header and return a list of three elements. The first is the type, the second is the subtype and the third is an alist of parameters and their values. Example: ("text" "plain" (("charset" . "us-ascii")...)).

PARSE-HEX

Parse two characters as hexadecimal and return their combined value.

PARSE-PARAMETER (STRING)

Given a string like "foo=bar" return a pair ("foo" . "bar"). Return NIL if string is not parsable.

READ-MIME-PART (STREAM)

Read mime part from STREAM. Return a MIME-PART object.

RUN-PROGRAM (PROGRAM ARGUMENTS &KEY (WAIT T) PTY INPUT OUTPUT ERROR)

Run PROGRAM with ARGUMENTS (a list) and return a process object.

SPLIT-HEADER-PARTS (STRING)

Split parts of a MIME headers. These are divided by semi-colons not within strings or comments.

SPLIT-MULTIPART-PARTS (BODY-STREAM PART-BOUNDARY)

Read from BODY-STREAM and split MIME parts separated by PART-BOUNDARY. Return a list of strings.

Undocumented

ALIST= (ALIST1 ALIST2 &KEY (TEST #'EQL))

ATOM-COMPONENT-P (C)

BASE-STREAM (STREAM)

CHOOSE-BOUNDARY (PARTS &OPTIONAL DEFAULT)

COPY-CURSOR (INSTANCE)

COPY-FILE-PORTION (INSTANCE)

COPY-MAILBOX (INSTANCE)

COPY-MAILBOX-GROUP (INSTANCE)

CURSOR-P (OBJECT)

SETFCURSOR-POSITION (NEW-VALUE INSTANCE)

SETFCURSOR-STREAM (NEW-VALUE INSTANCE)

DECODE-BASE64-STREAM-TO-SEQUENCE (STREAM &KEY PARSER-ERRORS)

DECODE-STREAM (IN OUT ENCODING &KEY PARSER-ERRORS-P)

DECODE-STREAM-TO-SEQUENCE (STREAM ENCODING &KEY PARSER-ERRORS-P)

DECODE-STRING (STRING ENCODING &KEY PARSER-ERRORS-P)

DECODER-READ-LINE (DECODER)

ENCODE-SEQUENCE (SEQUENCE ENCODING)

ENCODE-SEQUENCE-TO-STREAM (SEQUENCE OUT ENCODING)

ENCODE-STREAM (IN OUT ENCODING)

SETFFILE-PORTION-DATA (NEW-VALUE INSTANCE)

SETFFILE-PORTION-ENCODING (NEW-VALUE INSTANCE)

SETFFILE-PORTION-END (NEW-VALUE INSTANCE)

FILE-PORTION-P (OBJECT)

SETFFILE-PORTION-START (NEW-VALUE INSTANCE)

SETFHEADER (VALUE NAME HEADERS)

MAILBOX-GROUP-P (OBJECT)

MAILBOX-P (OBJECT)

MAKE-CURSOR (&KEY ((STREAM DUM210) NIL) ((POSITION DUM211) 0))

MAKE-FILE-PORTION (&KEY ((DATA DUM701) NIL) ((ENCODING DUM702) NIL) ((START DUM703) NIL) ((END DUM704) NIL))

MAKE-MAILBOX (&KEY ((DESCRIPTION DUM0) NIL) ((USER DUM1) NIL) ((HOST DUM2) NIL) ((DOMAIN DUM3) NIL))

MAKE-MAILBOX-GROUP (&KEY ((NAME DUM42) NIL) ((MAILBOXES DUM43) NIL))

OPEN-DECODED-FILE-PORTION (FILE-PORTION)

OPEN-FILE-PORTION (FILE-PORTION)

PARSER-MAKE-MAILBOX (DESCRIPTION ADDRESS-LIST)

POPULATE-GRAMMAR

PROCESS-ALIVE-P (PROCESS)

PROCESS-WAIT (REASON PREDICATE)

READ-ATEXT (FIRST-CHARACTER CURSOR)

READ-COMMENT (CURSOR)

READ-DELIMITED-STRING (STREAM END-CHAR &KEY NESTING-START-CHAR (ESCAPE-CHAR \))

READ-DOMAIN-LITERAL (CURSOR)

READ-STRING (CURSOR)

WRITE-MAILBOX (ADDR &OPTIONAL (STREAM *STANDARD-OUTPUT*))

WRITE-MAILBOX-ADDRESS (ADDR &OPTIONAL (STREAM *STANDARD-OUTPUT*))

WRITE-MAILBOX-DOMAIN-NAME (ADDR &OPTIONAL (STREAM *STANDARD-OUTPUT*))

WRITE-MAILBOX-GROUP (GRP &OPTIONAL (STREAM *STANDARD-OUTPUT*))

WRITE-MIME-HEADER (PART STREAM)

MACRO

Public

Undocumented

DO-PARTS ((VAR MIME-PART) &BODY BODY)

WITH-INPUT-FROM-MIME-BODY-STREAM ((STREAM PART &KEY (BINARY T)) &BODY FORMS)

Private

MAKE-STREAM-TO-SEQUENCE-DECODER (DECODER-CLASS INPUT-FORM &KEY PARSER-ERRORS)

Decode the character stream STREAM and return a sequence of bytes.

Undocumented

MAKE-DECODER-LOOP (DECODER-CLASS INPUT-FORM OUTPUT-FORM &KEY PARSER-ERRORS)

MAKE-ENCODER-LOOP (ENCODER-CLASS INPUT-FORM OUTPUT-FORM)

GENERIC-FUNCTION

Public

FIND-MIME-PART-BY-ID (PART ID)

Return a subpart of PAR, whose Content-ID is the same as ID, which is a string.

FIND-MIME-PART-BY-PATH (MIME PATH)

Return a subpart of MIME identified by PATH, which is a list of integers. For example '(2 3 1) is the first part of the third of the second in MIME.

GET-MIME-DISPOSITION-PARAMETER (PART NAME)

Return the MIME disposition parameter associated to NAME of PART.

GET-MIME-TYPE-PARAMETER (PART NAME)

Return the MIME type parameter associated to NAME of PART.

SETFGET-MIME-TYPE-PARAMETER (VALUE PART NAME)

Set the MIME type parameter associated to NAME of PART.

MAP-PARTS (FUNCTION MIME-PART)

Recursively map FUNCTION to MIME-PART or its components.

MIME-MESSAGE (THING)

Convert THING to a MIME-MESSAGE object.

MIME-PART (OBJECT)

Promote object, if necessary, to MIME-PART.

MIME-PART-SIZE (PART)

Return the size in bytes of the body of a MIME part.

MIME-TYPE-STRING (MIME-PART)

Return the string describing the MIME part.

MIME= (MIME1 MIME2)

Return true if MIME1 and MIME2 have equivalent structure and identical bodies (as for EQ).

Undocumented

APPLY-ON-PARTS (FUNCTION PART)

DECODER-READ-BYTE (DECODER)

ENCODE-MIME-BODY (PART STREAM)

ENCODE-MIME-PART (PART STREAM)

ENCODER-FINISH-OUTPUT (ENCODER)

ENCODER-WRITE-BYTE (ENCODER BYTE)

SETFGET-MIME-DISPOSITION-PARAMETER (VALUE PART NAME)

MBX-ADDRESS (MBX)

MBX-DOMAIN-NAME (MBX)

MIME-PART-FILE-NAME (PART)

SETFMIME-PART-FILE-NAME (VALUE PART)

Private

Undocumented

DECODE-MIME-BODY (PART INPUT-STREAM)

MAKE-ENCODED-BODY-STREAM (PART)

SLOT-ACCESSOR

Public

MIME-ENCODING (OBJECT)

It's supposed to be either: :7BIT, :8BIT, :BINARY, :QUOTED-PRINTABLE, :BASE64, a X-token or an ietf-token (whatever that means).

MIME-TYPE (OBJECT)

The original type string from the MIME header.

Undocumented

MIME-BODY (OBJECT)

SETFMIME-BODY (NEW-VALUE OBJECT)

MIME-DESCRIPTION (OBJECT)

SETFMIME-DESCRIPTION (NEW-VALUE OBJECT)

MIME-DISPOSITION (OBJECT)

SETFMIME-DISPOSITION (NEW-VALUE OBJECT)

MIME-DISPOSITION-PARAMETERS (OBJECT)

SETFMIME-DISPOSITION-PARAMETERS (NEW-VALUE OBJECT)

MIME-ID (OBJECT)

MIME-MESSAGE-HEADERS (OBJECT)

SETFMIME-MESSAGE-HEADERS (NEW-VALUE OBJECT)

MIME-PARTS (OBJECT)

SETFMIME-PARTS (NEW-VALUE OBJECT)

MIME-SUBTYPE (OBJECT)

SETFMIME-SUBTYPE (NEW-VALUE OBJECT)

MIME-TYPE-PARAMETERS (OBJECT)

SETFMIME-TYPE-PARAMETERS (NEW-VALUE OBJECT)

Private

DECODER-INPUT-FUNCTION (OBJECT)

Function is called repeatedly by the decoder methods to get the next character. It should return a character os NIL (indicating EOF).

ENCODER-OUTPUT-FUNCTION (OBJECT)

Function is called repeatedly by the encoder methods to output a character. It should expect a character as its only argument.

Undocumented

DECODER-PARSER-ERRORS (OBJECT)

ENCODER-LINE-LENGTH (OBJECT)

MIME-VERSION (OBJECT)

SETFMIME-VERSION (NEW-VALUE OBJECT)

REAL-STREAM (OBJECT)

STREAM-END (OBJECT)

STREAM-START (OBJECT)

STREAM-STRING (OBJECT)

VARIABLE

Public

*BASE64-LINE-LENGTH*

Maximum length of the encoded base64 line. NIL means it can be of unlimited length (no line breaks will be done by the encoding function).

*LAZY-MIME-DECODE*

If true don't decode mime bodies in memory.

*QUOTED-PRINTABLE-LINE-LENGTH*

Maximum length of the encoded quoted printable line. NIL means it can be of unlimited length (no line breaks will be done by the encoding function).

Private

*DEFAULT-TYPE*

Internal special variable that contains the default MIME type at any given time of the parsing phase. There are MIME container parts that may change this.

Undocumented

*MIME-TYPES*

+BASE64-DECODE-TABLE+

+BASE64-ENCODE-TABLE+

DEFINE-GRAMMAR

CLASS

Public

BASE64-DECODER

Class for Base64 decoder input streams.

BASE64-ENCODER

Class for Base64 encoder output streams.

BYTE-DECODER

Class for decoders that turns chars to bytes.

BYTE-ENCODER

Class for encoders that turns bytes to chars.

MIME-PART (OBJECT)

Abstract base class for all types of MIME parts.

MIME-UNKNOWN-PART

MIME part unknown to this library. Accepted but not handled.

Undocumented

MAILBOX

MAILBOX-GROUP

MIME-APPLICATION

MIME-AUDIO

MIME-BINARY

MIME-IMAGE

MIME-MESSAGE (THING)

MIME-MULTIPART

MIME-TEXT

MIME-VIDEO

QUOTED-PRINTABLE-DECODER

QUOTED-PRINTABLE-ENCODER

Private

7BIT-DECODER

Class for decoders that do nothing.

7BIT-ENCODER

Class for encoders that do nothing.

8BIT-DECODER

Class for decoders that do nothing.

8BIT-ENCODER

Class for encoders that do nothing.

DECODER

Abstract base class for decoders.

ENCODER

Abstract base class for encoders.

ENCODER-INPUT-STREAM

This is the base class for encoders with the direction swapped. It reads from REAL-STREAM a stream of bytes, encodes it and returnes it in a stream of character.

LINE-ENCODER

Abstract base class for line encoders.

MIME-BODILY-PART

Abstract base class for MIME parts with a body.

PARSING-DECODER

Abstract base class for decoders that do parsing.

Undocumented

8BIT-DECODER-STREAM

8BIT-ENCODER-INPUT-STREAM

8BIT-ENCODER-STREAM

BASE64-DECODER-STREAM

BASE64-ENCODER-INPUT-STREAM

BASE64-ENCODER-STREAM

BINARY-INPUT-ADAPTER-STREAM

CHARACTER-INPUT-ADAPTER-STREAM

CODER-INPUT-STREAM-MIXIN

CODER-OUTPUT-STREAM-MIXIN

CODER-STREAM-MIXIN

CURSOR

DELIMITED-INPUT-STREAM

FILE-PORTION

INPUT-ADAPTER-STREAM

MY-STRING-INPUT-STREAM

QUOTED-PRINTABLE-DECODER-STREAM

QUOTED-PRINTABLE-ENCODER-INPUT-STREAM

QUOTED-PRINTABLE-ENCODER-STREAM

CONSTANT

Private

+KNOWN-ENCODINGS+

List of known content encodings.