Module: Gurgitate::Deliver::MBox
- Defined in:
- lib/gurgitate/deliver/mbox.rb
Class Method Summary collapse
-
.check_mailbox(mailbox) ⇒ Object
- Checks to see if
mailbox
is an mbox mailbox mailbox -
A string containing the path of the mailbox to save the message to.
- Checks to see if
Instance Method Summary collapse
-
#deliver_message(mailbox) ⇒ Object
- Delivers the message to
mailbox
mailbox -
A string containing the path of the mailbox to save the message to.
- Delivers the message to
Class Method Details
.check_mailbox(mailbox) ⇒ Object
Checks to see if mailbox
is an mbox mailbox
- mailbox
-
A string containing the path of the mailbox to save the message to. If it is of the form “=mailbox”, it saves the message to
Maildir
/mailbox
. Otherwise, it simply saves the message to the filemailbox
.
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/gurgitate/deliver/mbox.rb', line 16 def self::check_mailbox mailbox begin if File.stat(mailbox).file? then return MBox else return nil end rescue Errno::ENOENT return nil end end |
Instance Method Details
#deliver_message(mailbox) ⇒ Object
Delivers the message to mailbox
- mailbox
-
A string containing the path of the mailbox to save the message to. If it is of the form “=mailbox”, it saves the message to
Maildir
/mailbox
. Otherwise, it simply saves the message to the filemailbox
.
35 36 37 38 39 40 41 42 43 44 |
# File 'lib/gurgitate/deliver/mbox.rb', line 35 def mailbox File.open(mailbox,File::WRONLY | File::APPEND | File::CREAT) do |f| f.flock(File::LOCK_EX) =(if f.stat.size > 0 then "\n" else "" end) + to_mbox f.print f.flock(File::LOCK_UN) end end |