class TMail::MhPort
Private Instance Methods
get_status( tag )
click to toggle source
# File lib/tmail/port.rb, line 233 def get_status( tag ) File.foreach(@filename) {|line| return false if line.strip.empty? if m = /\AX-TMail-Status:/i.match(line) return m.post_match.strip.include?(tag[0]) end } false end
set_status( tag, flag )
click to toggle source
# File lib/tmail/port.rb, line 197 def set_status( tag, flag ) begin tmpfile = @filename + '.tmailtmp.' + $$.to_s File.open(tmpfile, 'w') {|f| write_status f, tag, flag } File.unlink @filename File.link tmpfile, @filename ensure File.unlink tmpfile end end
write_status( f, tag, flag )
click to toggle source
# File lib/tmail/port.rb, line 210 def write_status( f, tag, flag ) stat = '' File.open(@filename) {|r| while line = r.gets if line.strip.empty? break elsif m = /\AX-TMail-Status:/i.match(line) stat = m.post_match.strip else f.print line end end s = procinfostr(stat, tag, flag) f.puts 'X-TMail-Status: ' + s unless s.empty? f.puts while s = r.read(2048) f.write s end } end