Navigation Menu

Skip to content

Commit

Permalink
skip spam and deleted messages during import time
Browse files Browse the repository at this point in the history
  • Loading branch information
William Morgan committed Mar 9, 2012
1 parent e921391 commit 0a217a3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions bin/heliotrope-import
Expand Up @@ -34,6 +34,8 @@ EOS
opt :add_labels, "Add these labels to every message (should be a comma-separated list)", :type => String
opt :remove_labels, "Do not add any of these labels to any message (should be a comma-separated list)", :type => String
opt :verbose, "Enable verbose output"
opt :no_skip_spam, "If a message is marked as spam, add it anyways (default: ignore it)"
opt :no_skip_deleted, "If a message is marked as deleted, add it anyways (default: ignore it)"

banner <<EOS
Expand Down Expand Up @@ -120,6 +122,9 @@ adder.each_message do |rawbody, source_state, source_labels|
labels += add_labels
labels -= remove_labels

next if (state.include?("spam") || labels.include?("spam")) && !opts.no_skip_spam
next if (state.include?("deleted") || labels.include?("deleted")) && !opts.no_skip_deleted

loc = zmbox.add rawbody
metaindex.add_message message, state, labels, :loc => loc
indexed = true
Expand Down

0 comments on commit 0a217a3

Please sign in to comment.