Maildir::Message
Inherits Comparable / Reference / Object
Constants
COLON seperates the unique name from the info
The standard maildir flags, and the letters representing them.
The default info, to which flags are appended
Constructors
Create a new, unwritten message or instantiate an existing message. If key is nil, create a new message: Message.new(maildir) # => a new, unwritten message
If +key+ is not nil, instantiate a message object for the message at +key+. Message.new(maildir, key) # => an existing message
Class methods
Create a new message in maildir with data. The message is first written to the tmp dir, then moved to new. This is a shortcut for: message = Maildir::Message.new(maildir) message.write(data)
Splits a key into its dir, unique name, and info parts. Raises ArgumentError if the key is not of the form "dir/unique_name[:info]".
Instance methods
Adds one or more flags to a message. Returns the message's key if successful, false otherwise.
flag:: String or Enumerable of flags
Returns the message's data from disk. If the path doesn't exist, raises File::NotFoundError.
Deletes the message path. Returns nil if the file was destroyed, false if the file was missing.
Adds the "D" (draft) flag to the message. Returns the message's key if successful, false otherwise.
Adds the "F" (flagged) flag to the message. Returns the message's key if successful, false otherwise.
Sets the flags on a message. Returns the message's key if successful, false otherwise.
flags:: String or Enumerable of flags
Adds the "P" (passed) flag to the message. Returns the message's key if successful, false otherwise.
Removes flags from a message. Returns the message's key if successful, false otherwise.
flags:: String or Enumerable of flags
Adds the "R" (replied) flag to the message. Returns the message's key if successful, false otherwise.
Adds the "S" (seen) flag to the message. Returns the message's key if successful, false otherwise.
Adds the "T" (trashed) flag to the message. Returns the message's key if successful, false otherwise.
Updates the modification and access time. Returns nil if successful, false if the file doesn't exist.
Writes data to disk. Can only be called on messages instantiated without a key (which haven't been written to disk). After successfully writing to disk, rename the message to the new dir
Returns the message's key