mailman 0.5.4 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -50,6 +50,7 @@ and my mentor was [Steven Soroka](http://github.com/ssoroka).
50
50
  - [Phillip Ridlen](https://github.com/philtr)
51
51
  - [Daniel Schierbeck](http://github.com/dasch)
52
52
  - [Steven Soroka](http://github.com/ssoroka)
53
+ - [Ryan Stawarz](https://github.com/rstawarz)
53
54
  - [Benjamin Waldher](https://github.com/lgbr)
54
55
  - [Ian White](http://github.com/ianwhite)
55
56
  - [Andreas Wolff](https://github.com/rubyphunk)
@@ -17,15 +17,20 @@ module Mailman
17
17
  # @option options [String] :username the username to authenticate with
18
18
  # @option options [String] :password the password to authenticate with
19
19
  # @option options [String] :folder the mail folder to search
20
+ # @option options [Array] :done_flags the flags to add to messages that
21
+ # have been processed
22
+ # @option options [String] :filter the search filter to use to select
23
+ # messages to process
20
24
  def initialize(options)
21
- @processor = options[:processor]
22
- @server = options[:server]
23
- @username = options[:username]
24
- @password = options[:password]
25
- @filter = options[:filter] || ['NEW']
26
- @port = options[:port] || 143
27
- @ssl = options[:ssl] || false
28
- @folder = options[:folder] || "INBOX"
25
+ @processor = options[:processor]
26
+ @server = options[:server]
27
+ @username = options[:username]
28
+ @password = options[:password]
29
+ @filter = options[:filter] || 'UNSEEN'
30
+ @done_flags = options[:done_flags] || [Net::IMAP::SEEN]
31
+ @port = options[:port] || 143
32
+ @ssl = options[:ssl] || false
33
+ @folder = options[:folder] || "INBOX"
29
34
  end
30
35
 
31
36
  # Connects to the IMAP server.
@@ -44,12 +49,12 @@ module Mailman
44
49
  end
45
50
 
46
51
  # Iterates through new messages, passing them to the processor, and
47
- # deleting them.
52
+ # flagging them as done.
48
53
  def get_messages
49
- @connection.search(@filter).each do |message|
50
- body = @connection.fetch(message,"RFC822")[0].attr["RFC822"]
54
+ @connection.search(@filter).each do |message|
55
+ body = @connection.fetch(message, "RFC822")[0].attr["RFC822"]
51
56
  @processor.process(body)
52
- @connection.store(message,"+FLAGS",[Net::IMAP::DELETED])
57
+ @connection.store(message, "+FLAGS", @done_flags)
53
58
  end
54
59
  # Clears messages that have the Deleted flag set
55
60
  @connection.expunge
@@ -1,3 +1,3 @@
1
1
  module Mailman
2
- VERSION = '0.5.4'
2
+ VERSION = '0.6.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mailman
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.4
4
+ version: 0.6.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-04 00:00:00.000000000 Z
12
+ date: 2013-01-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mail