]> git.cworth.org Git - sup/blobdiff - lib/sup/sent.rb
Merge branch 'hook-local-vars' into next
[sup] / lib / sup / sent.rb
index 935da2ac156c6619bd5bf1d7d799c3fd2eb700c9..9203dd666816a770d8537c18c6281ae8f17ed14a 100644 (file)
@@ -3,14 +3,11 @@ module Redwood
 class SentManager
   include Singleton
 
-  attr_reader :source
-  attr_reader :source_uri
+  attr_reader :source, :source_uri
 
   def initialize source_uri
     @source = nil
     @source_uri = source_uri
-    self.class.i_am_the_instance self
-    Redwood::log "SentManager intialized with source uri: #@source_uri"
   end
 
   def source_id; @source.id; end
@@ -23,7 +20,6 @@ class SentManager
 
   def default_source
     @source = Recoverable.new SentLoader.new
-    Redwood::log "SentManager initializing default source: #@source."
     @source_uri = @source.uri
     @source
   end
@@ -31,9 +27,9 @@ class SentManager
   def write_sent_message date, from_email, &block
     @source.store_message date, from_email, &block
 
-    PollManager.add_messages_from(@source) do |m, o, e|
+    PollManager.each_message_from(@source) do |m|
       m.remove_label :unread
-      m
+      PollManager.add_new_message m
     end
   end
 end
@@ -53,7 +49,7 @@ class SentLoader < MBox::Loader
   def uri; 'sup://sent' end
 
   def id; 9998; end
-  def labels; [:inbox]; end
+  def labels; [:inbox, :sent]; end
 end
 
 end