7.3.2.4 BabylMessage

Python 2.5

7.3.2.4 BabylMessage

A message with Babyl-specific behaviors. Parameter message has the same meaning as with the Message constructor.

Certain message labels, called attributes, are defined by convention to have special meanings. The attributes are as follows:

Label Explanation
unseen Not read, but previously detected by MUA
deleted Marked for subsequent deletion
filed Copied to another file or mailbox
answered Replied to
forwarded Forwarded
edited Modified by the user
resent Resent

By default, Rmail displays only visible headers. The BabylMessage class, though, uses the original headers because they are more complete. Visible headers may be accessed explicitly if desired.

BabylMessage instances offer the following methods:

Return a list of labels on the message.

Set the list of labels on the message to labels.

Add label to the list of labels on the message.

Remove label from the list of labels on the message.

Return an Message instance whose headers are the message's visible headers and whose body is empty.

Set the message's visible headers to be the same as the headers in message. Parameter visible should be a Message instance, an email.Message.Message instance, a string, or a file-like object (which should be open in text mode).

When a BabylMessage instance's original headers are modified, the visible headers are not automatically modified to correspond. This method updates the visible headers as follows: each visible header with a corresponding original header is set to the value of the original header, each visible header without a corresponding original header is removed, and any of Date:, From:, Reply-To:, To:, CC:, and Subject: that are present in the original headers but not the visible headers are added to the visible headers.

When a BabylMessage instance is created based upon a MaildirMessage instance, the following conversions take place:

Resulting state MaildirMessage state
"unseen" label no S flag
"deleted" label T flag
"answered" label R flag
"forwarded" label P flag

When a BabylMessage instance is created based upon an mboxMessage or MMDFMessage instance, the Status: and X-Status: headers are omitted and the following conversions take place:

Resulting state mboxMessage or MMDFMessage state
"unseen" label no R flag
"deleted" label D flag
"answered" label A flag

When a BabylMessage instance is created based upon an MHMessage instance, the following conversions take place:

Resulting state MHMessage state
"unseen" label "unseen" sequence
"answered" label "replied" sequence

See About this document... for information on suggesting changes.