Permalink
Browse files

Cosmetic changes:

Removed the parens around method parameters, and cleaned up trailing
whitespace.
  • Loading branch information...
1 parent 271bd6c commit c080c4c668fc354b3378929b1d04a589eafb8efd @dagbrown committed with Dave Brown May 6, 2008
Showing with 24 additions and 24 deletions.
  1. +4 −4 gurgitate/deliver/maildir.RB
  2. +5 −5 gurgitate/deliver/mbox.RB
  3. +15 −15 gurgitate/deliver/mh.RB
@@ -15,7 +15,7 @@ module Gurgitate
# message to. If it is of the form "=mailbox", it saves
# the message to +Maildir+/+mailbox+. Otherwise, it
# simply saves the message to the file +mailbox+.
- def self::check_mailbox(mailbox)
+ def self::check_mailbox mailbox
begin
if File.stat(mailbox).directory? then
if File.stat(File.join(mailbox,"cur")).directory? then
@@ -33,7 +33,7 @@ module Gurgitate
# One of "+mailbox+/tmp" or "+mailbox+/new", but that's
# only because that's what the maildir spec
# (http://cr.yp.to/proto/maildir.html) says.
- def maildir_getfilename(dir)
+ def maildir_getfilename dir
time=Time.now.to_f
counter=0
hostname=Socket::gethostname
@@ -50,7 +50,7 @@ module Gurgitate
# Creates a new Maildir folder +mailbox+
# mailbox::
# The full path of the new folder to be created
- def make_mailbox(mailbox)
+ def make_mailbox mailbox
Dir.mkdir(mailbox)
%w{cur tmp new}.each do |dir|
Dir.mkdir(File.join(mailbox,dir))
@@ -63,7 +63,7 @@ module Gurgitate
# message to. If it is of the form "=mailbox", it saves
# the message to +Maildir+/+mailbox+. Otherwise, it
# simply saves the message to the file +mailbox+.
- def deliver_message(mailbox)
+ def deliver_message mailbox
begin
File.stat(mailbox)
rescue Errno::ENOENT
View
@@ -13,10 +13,10 @@ module Gurgitate
# 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 file +mailbox+.
- def self::check_mailbox(mailbox)
+ def self::check_mailbox mailbox
begin
- if File.stat(mailbox).file? then
+ if File.stat(mailbox).file? then
return MBox
else
return nil
@@ -32,9 +32,9 @@ module Gurgitate
# 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 file +mailbox+.
- def deliver_message(mailbox)
- File.open(mailbox,File::WRONLY |
- File::APPEND |
+ def deliver_message mailbox
+ File.open(mailbox,File::WRONLY |
+ File::APPEND |
File::CREAT) do |f|
f.flock(File::LOCK_EX)
message=(if f.stat.size > 0 then "\n" else "" end) + to_mbox
View
@@ -15,7 +15,7 @@ module Gurgitate
# 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 file +mailbox+.
- def self::check_mailbox(mailbox)
+ def self::check_mailbox mailbox
begin
# Rather annoyingly, pretty well any directory can
# be a MH mailbox, but this just checks to make sure
@@ -24,10 +24,10 @@ module Gurgitate
# 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
+ 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
@@ -41,7 +41,7 @@ module Gurgitate
# 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 file +mailbox+.
- def deliver_message(mailbox)
+ def deliver_message mailbox
if ! File.exists? mailbox then
Dir.mkdir(mailbox)
end
@@ -59,16 +59,16 @@ module Gurgitate
private
- def update_sequences(mailbox, msgnum)
+ def update_sequences mailbox, msgnum
sequences = File.join(mailbox, ".mh_sequences")
lockfile = sequences + ".lock" # how quaint
loop do
begin
- File.open(lockfile,
- File::WRONLY |
- File::CREAT |
+ File.open(lockfile,
+ File::WRONLY |
+ File::CREAT |
File::EXCL ) do |lock|
- File.open(sequences,
+ File.open(sequences,
File::RDWR | File::CREAT) do |seq|
seq.flock(File::LOCK_EX)
@@ -91,7 +91,7 @@ module Gurgitate
rescue Errno::EEXIST
# some other process is doing something, so wait a few
# milliseconds until it's done
- sleep(0.01)
+ sleep(0.01)
end
end
end
@@ -115,13 +115,13 @@ module Gurgitate
end
end
- def next_message(mailbox)
+ def next_message mailbox
next_msgnum = Dir.open(mailbox).map { |ent| ent.to_i }.max + 1
loop do
begin
File.open(File.join(mailbox, next_msgnum.to_s),
- File::WRONLY |
- File::CREAT |
+ File::WRONLY |
+ File::CREAT |
File::EXCL ) do |filehandle|
yield filehandle
end

0 comments on commit c080c4c

Please sign in to comment.