check_tmp()
click to toggle source
def check_tmp
old = Time.now.to_i - TOO_OLD
each_filename(@tmp) do |full, fname|
if FileTest.file? full and
File.stat(full).mtime.to_i < old
File.unlink full
end
end
end
close()
click to toggle source
directory()
click to toggle source
def directory
@dirname
end
each()
click to toggle source
each_mail()
click to toggle source
each_new_port() { |port_class| ... }
click to toggle source
def each_new_port
mail_files(@new).each do |path|
dest = @cur + '/' + File.basename(path)
File.rename path, dest
yield PORT_CLASS.new(dest)
end
check_tmp
end
each_newmail()
click to toggle source
each_port() { |port_class| ... }
click to toggle source
def each_port
mail_files(@cur).each do |path|
yield PORT_CLASS.new(path)
end
end
inspect()
click to toggle source
def inspect
"#<#{self.class} #{@dirname}>"
end
new_mail()
click to toggle source
new_port() { |f| ... }
click to toggle source
def new_port
fname = nil
tmpfname = nil
newfname = nil
begin
fname = "#{Time.now.to_i}.#{$$}_#{Maildir.unique_number}.#{Socket.gethostname}"
tmpfname = "#{@tmp}/#{fname}"
newfname = "#{@new}/#{fname}"
end while FileTest.exist? tmpfname
if block_given?
File.open(tmpfname, 'w') {|f| yield f }
File.rename tmpfname, newfname
PORT_CLASS.new(newfname)
else
File.open(tmpfname, 'w') {|f| f.write "\n\n" }
PORT_CLASS.new(tmpfname)
end
end
reverse_each()
click to toggle source
reverse_each_port() { |port_class| ... }
click to toggle source
def reverse_each_port
mail_files(@cur).reverse_each do |path|
yield PORT_CLASS.new(path)
end
end