Class: IMAPProcessor::Cleanse
- Inherits:
-
Client
- Object
- IMAPProcessor
- Client
- IMAPProcessor::Cleanse
- Defined in:
- lib/imap_processor/cleanse.rb
Overview
Cleanse removes old messages from your IMAP mailboxes so you don’t have to!
aka part one of my Plan for Total Email Domination.
Cleanse doesn’t remove messages you haven’t read nor messages you’ve flagged.
Constant Summary
Constants inherited from IMAPProcessor
Instance Attribute Summary
Attributes inherited from IMAPProcessor
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options) ⇒ Cleanse
constructor
Creates a new Cleanse from
options
. -
#run ⇒ Object
Removes read, unflagged messages from all selected mailboxes…
Methods inherited from Client
#connect, #find_mailboxes, #mark, #search
Methods inherited from IMAPProcessor
add_move, #capability, #connect, #create_mailbox, #delete_messages, #each_message, #each_part, #log, #mime_parts, #move_messages, #noop?, run, #show_messages, #verbose?
Constructor Details
#initialize(options) ⇒ Cleanse
Creates a new Cleanse from options
.
Options include:
+:Age+:: Delete messages older than this many days ago
and all options from IMAPClient
22 23 24 25 26 27 |
# File 'lib/imap_processor/cleanse.rb', line 22 def initialize() super @cleanse = [:cleanse] @boxes = @cleanse.keys end |
Class Method Details
.process_args(args) ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/imap_processor/cleanse.rb', line 29 def self.process_args(args) super __FILE__, args, {} do |opts, | opts. << <<-EOF imap_cleanse removes old messages from your IMAP mailboxes. EOF end end |
Instance Method Details
#run ⇒ Object
Removes read, unflagged messages from all selected mailboxes…
40 41 42 43 44 45 46 |
# File 'lib/imap_processor/cleanse.rb', line 40 def run super "Cleansing read, unflagged old messages", [:Deleted] do @imap.expunge log "Expunged deleted messages" end end |