class Maildir::Message

Included Modules

Defined in:

message.cr

Constant Summary

COLON = ":"

COLON seperates the unique name from the info

FLAG_NAMES = {passed: "P", replied: "R", seen: "S", trashed: "T", draft: "D", flagged: "F"}
INFO = "2,"

The default info, to which flags are appended

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(maildir : Maildir, key = nil) #

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


[View source]

Class Method Detail

def self.create(maildir, data) #

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)


[View source]
def self.serializer #

DEPRECATED Get the serializer. @see Maildir.serializer


[View source]
def self.serializer=(serializer) #

DEPRECATED Set the serializer. @see Maildir.serializer=


[View source]

Instance Method Detail

def <=>(other) #

Compares messages by their paths. If message is a different class, return nil. Otherwise, return 1, 0, or -1.


[View source]
def add_flag(flag) #

Adds a flag to a message. Returns the message's key if successful, false otherwise.


[View source]
def atime #

Returns the message's atime, or false if the file doesn't exist.


[View source]
def data #

Returns the message's data from disk. If the path doesn't exist, freeze's the object and raises Errno:ENOENT


[View source]
def destroy #

Deletes the message path and freezes the message object. Returns 1 if the file was destroyed, false if the file was missings.


[View source]
def dir : String? #

[View source]
def draft! #

[View source]
def draft? #

[View source]
def filename #

Returns the filename of the message


[View source]
def flagged! #

[View source]
def flagged? #

[View source]
def flags #

Returns an array of single letter flags applied to the message


[View source]
def flags=(flags) #

Sets the flags on a message. Returns the message's key if successful, false otherwise.


[View source]
def info : String? #

[View source]
def info=(info) #

Set info on a message. Returns the message's key if successful, false otherwise.


[View source]
def inspect #

Friendly inspect method


[View source]
def key #

Returns the key to identify the message


[View source]
def mtime #

Returns the message's mtime, or false if the file doesn't exist.


[View source]
def passed! #

[View source]
def passed? #

[View source]
def path #

Returns the full path to the message


[View source]
def process #

Move a message from new to cur, add info. Returns the message's key


[View source]
def remove_flag(flags) #

Removes flags from a message. Returns the message's key if successful, false otherwise.

flags:: String or Array


[View source]
def replied! #

[View source]
def replied? #

[View source]
def seen! #

[View source]
def seen? #

[View source]
def serializer #

Helper to get serializer.


[View source]
def trashed! #

[View source]
def trashed? #

[View source]
def unique_name : String? #

[View source]
def utime(atime, mtime) #

Updates the modification and access time. Returns 1 if successful, false otherwise.


[View source]
def write(data) #

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


[View source]