Module: Gurgitate::Deliver::MH
- Defined in:
- lib/gurgitate/deliver/mh.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
.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/gurgitate/deliver/mh.rb', line 18 def self::check_mailbox mailbox begin # Rather annoyingly, pretty well any directory can # be a MH mailbox, but this just checks to make sure # it's not actually a Maildir by mistake. # # I could put in a check for the path given in # $HOME/.mh_profile, but Claws-Mail uses MH mailboxes and # disregards $HOME/.mh_profile. if( File.stat(mailbox).directory? and not ( File.exists?(File.join(mailbox, "cur")) or File.exists?(File.join(mailbox, "tmp")) or File.exists?(File.join(mailbox, "new")) ) ) then return MH 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
.
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/gurgitate/deliver/mh.rb', line 44 def mailbox if ! File.exists? mailbox then Dir.mkdir(mailbox) end if File.exists? mailbox and not File.directory? mailbox then raise SystemError, "not a directory" end new_msgnum = (mailbox) do |filehandle| filehandle.print self.to_s end update_sequences(mailbox, new_msgnum) end |