]> git.cworth.org Git - sup/commitdiff
poll tweaks
authorwmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Sat, 10 Feb 2007 16:29:27 +0000 (16:29 +0000)
committerwmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Sat, 10 Feb 2007 16:29:27 +0000 (16:29 +0000)
git-svn-id: svn://rubyforge.org/var/svn/sup/trunk@312 5c8cc53c-5e98-4d25-b20a-d8db53a31250

bin/sup-import
lib/sup/poll.rb

index 68ffd760553cb2cdc5572effd439b46d755c04af..d4efa107c58e9da536940afe577f8e96fd0c6931 100644 (file)
@@ -107,8 +107,8 @@ begin
         m
       elsif opts[:full_rebuild] || # we're updating everyone; or
           (opts[:rebuild] && (entry[:source_id].to_i != source.id || entry[:source_info].to_i != offset)) # we're updating just the changed ones
-        puts "# updating message at #{offset}, #{m.from.inspect}, #{m.subj.inspect}, source #{entry[:source_id]} => #{source.id}, offset #{entry[:source_info]} => #{offset}, labels: #{m.labels * ' '}" if opts[:verbose]
-        num += 1
+        puts "# updating message at #{offset} (from #{m.from.longname} subject \"#{m.subj}\"), source #{entry[:source_id]} => #{source.id}, offset #{entry[:source_info]} => #{offset}, labels: {#{m.labels * ', '}}" if opts[:verbose]
+        num += 1 unless found[m.id]
         m
       else
         nil
index cbad96c3f2a2f1804b3881966874473ee2f04125..f7c73bd3b1fd68fca27edb646856275f241435bb 100644 (file)
@@ -41,7 +41,6 @@ class PollManager
   def do_poll
     total_num = total_numi = 0
     @mutex.synchronize do
-      found = {}
       Index.usual_sources.each do |source|
 #        yield "source #{source} is done? #{source.done?} (cur_offset #{source.cur_offset} >= #{source.end_offset})"
         yield "Loading from #{source}... " unless source.done? || source.broken?
@@ -50,7 +49,7 @@ class PollManager
         add_new_messages_from source do |m, offset, entry|
           ## always preserve the labels on disk.
           m.labels = entry[:label].split(/\s+/).map { |x| x.intern } if entry
-          yield "Found message at #{offset} with labels #{m.labels * ', '}"
+          yield "Found message at #{offset} with labels {#{m.labels * ', '}}"
           num += 1
           numi += 1 if m.labels.include? :inbox
           m
@@ -80,7 +79,6 @@ class PollManager
   ## labels, if they exist, so that state is not lost when e.g. a new
   ## version of a message from a mailing list comes in.
   def add_new_messages_from source
-    found = {}
     return if source.done? || source.broken?
 
     source.each do |offset, labels|
@@ -93,13 +91,6 @@ class PollManager
 
       begin
         m = Message.new :source => source, :source_info => offset, :labels => labels
-        if found[m.id]
-          Redwood::log "skipping duplicate message #{m.id}"
-          next
-        else
-          found[m.id] = true
-        end
-
         if m.source_marked_read?
           m.remove_label :unread
           labels.delete :unread