Maildir
Inherits Comparable / Reference / Object
Class for generating unique file names for new messages
Constants
Default serializer.
Maildir++ folders live in the root maildir as sibling directories whose name is the folder name prefixed with a dot; nesting is expressed by joining the name components with a dot too (".Parent.Child"). Every folder also carries an empty "maildirfolder" file, so that other tools recognize it as a folder rather than as a maildir in its own right.
Constructors
Create a new maildir at +path+. If +create+ is true, will ensure that the required subdirectories exist.
Class methods
Sets whether messages are fsynced before delivery. Turning this off trades the crash-safety guarantee above for throughput, which can be worth it on rotational or network storage when the data is reproducible anyway.
Instance methods
Writes data object out as a new message. Returns a Maildir::Message. See Maildir::Message.create for more.
Ensure subdirectories exist. This can safely be called multiple times and from several processes at once, but must hit the disk. Avoid calling this if you're certain the directories exist.
Returns the maildir for the named subfolder of this one, creating the directories of the whole chain unless +create+ is false. Names nest with a dot, so these two are the same folder: maildir.folder("a.x") maildir.folder("a").folder("x")
Returns true if this maildir is a Maildir++ folder of another maildir: its directory name is dot-prefixed and it sits inside a maildir. The second condition is what keeps a root maildir which merely lives at a dot-path (say "~/.maildir") from being taken for a folder of its parent directory.
The answer is settled once, on first use, so a maildir doesn't change its mind halfway through if the surrounding directories change.
Returns this maildir's immediate subfolders, sorted by path. Deeper descendants are reached by asking those folders in turn.
Finds messages in the tmp folder that have not been modified since +time+. +time+ defaults to 36 hours ago.
Returns an array of messages from the "new" or "cur" directory, sorted by key. If options[:flags] is specified and dir is "cur", returns only the messages carrying exactly those flags.
E.g. maildir.list("cur", {:flags => "F"}) # => lists all messages with flag "F" maildir.list("cur", {:flags => "FS"}) # => lists all messages with flags "F" and "S"; flags must be specified in ascending ASCII order ("FS" and not "SF") maildir.list("cur", {:flags => ""}) # => lists all messages without any flags This option does not work for the "new" directory
If options[:limit] is specified, returns only so many keys.
E.g. maildir.list("new") # => all new messages maildir.list("cur", {:limit => 10}) # => 10 oldest messages in cur
Returns own serializer or falls back to the default one. Deliberately does
not memoize, so that a later change of Maildir.serializer is picked up by
maildirs which don't have a serializer of their own.