10 self.class.i_am_the_instance self
13 def self.source_name; "sup://sent"; end
14 def self.source_id; 9998; end
15 def new_source; @source = SentLoader.new; end
17 def write_sent_message date, from_email
18 need_blank = File.exists?(@fn) && !File.zero?(@fn)
19 File.open(@fn, "a") do |f|
21 f.puts "From #{from_email} #{date}"
24 @source.each do |offset, labels|
25 m = Message.new :source => @source, :source_info => offset, :labels => @source.labels
27 UpdateManager.relay self, :add, m
32 class SentLoader < MBox::Loader
33 def initialize cur_offset=0
34 filename = Redwood::SENT_FN
35 File.open(filename, "w") { } unless File.exists? filename
36 super "mbox://" + filename, cur_offset, true, true
39 def uri; SentManager.source_name; end
40 def to_s; SentManager.source_name; end
41 def id; SentManager.source_id; end
42 def labels; [:sent, :inbox]; end
45 Redwood::register_yaml(SentLoader, %w(cur_offset))