diff --git a/lib/fetcher/base.rb b/lib/fetcher/base.rb index 5b7ea3e..95c5b2d 100644 --- a/lib/fetcher/base.rb +++ b/lib/fetcher/base.rb @@ -5,6 +5,7 @@ class Base # * :username - Username to use when connecting to server. # * :password - Password to use when connecting to server. # * :receiver - Receiver object to pass messages to. Assumes the + # * :keep - Do not remove messages from server # receiver object has a receive method that takes a message as it's argument # # Additional protocol-specific options implimented by sub-classes diff --git a/lib/fetcher/imap.rb b/lib/fetcher/imap.rb index c0d0c72..122fe6a 100644 --- a/lib/fetcher/imap.rb +++ b/lib/fetcher/imap.rb @@ -52,7 +52,7 @@ def get_messages handle_bogus_message(msg) end # Mark message as deleted - @connection.uid_store(uid, "+FLAGS", [:Seen, :Deleted]) + @connection.uid_store(uid, "+FLAGS", [:Seen, :Deleted]) unless @keep end end @@ -64,7 +64,7 @@ def handle_bogus_message(message) # Delete messages and log out def close_connection - @connection.expunge + @connection.expunge unless @keep @connection.logout begin @connection.disconnect unless @connection.disconnected? diff --git a/lib/fetcher/pop.rb b/lib/fetcher/pop.rb index e165799..ae3333c 100644 --- a/lib/fetcher/pop.rb +++ b/lib/fetcher/pop.rb @@ -31,7 +31,7 @@ def get_messages handle_bogus_message(msg.pop) end # Delete message from server - msg.delete + msg.delete unless @keep end end end