mlist 0.1.9 → 0.1.10

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION.yml CHANGED
@@ -1,4 +1,5 @@
1
1
  ---
2
- :patch: 9
2
+ :patch: 10
3
3
  :major: 0
4
+ :build:
4
5
  :minor: 1
data/lib/mlist/email.rb CHANGED
@@ -6,10 +6,6 @@ module MList
6
6
  include MList::Util::EmailHelpers
7
7
  include MList::Util::TMailReaders
8
8
 
9
- def been_here?(list)
10
- tmail.header_string('x-beenthere') == list.address
11
- end
12
-
13
9
  def date
14
10
  if date_from_email = super
15
11
  return date_from_email
@@ -22,6 +18,12 @@ module MList
22
18
  tmail.header_string('from')
23
19
  end
24
20
 
21
+ # Answers the values of all the X-BeenThere headers.
22
+ #
23
+ def been_there_addresses
24
+ Array(tmail['x-beenthere']).collect { |e| e.body.downcase }.uniq
25
+ end
26
+
25
27
  # Answers the usable destination addresses of the email.
26
28
  #
27
29
  def list_addresses
data/lib/mlist/list.rb CHANGED
@@ -17,6 +17,14 @@ module MList
17
17
  true
18
18
  end
19
19
 
20
+ # Answers whether the email has been to this list before. The simplest
21
+ # test is whether the email has an X-BeenThere header that matches this
22
+ # list's address.
23
+ #
24
+ def been_here?(email)
25
+ email.been_there_addresses.include?(address)
26
+ end
27
+
20
28
  # Answers whether the subscriber is blocked from posting or not. This will
21
29
  # not be asked when the list is not active (answers _active?_ as false).
22
30
  #
data/lib/mlist/server.rb CHANGED
@@ -27,7 +27,7 @@ module MList
27
27
  protected
28
28
  def process_post(lists, email)
29
29
  lists.each do |list|
30
- next if email.been_here?(list)
30
+ next if list.been_here?(email)
31
31
  if list.subscriber?(email.from_address)
32
32
  publish_if_list_active(list, email)
33
33
  else
@@ -90,6 +90,7 @@ describe MList do
90
90
  end
91
91
 
92
92
  it 'should not forward mail that has been on this server before' do
93
+ # The sample email has multiple headers to prove that's not a problem
93
94
  @email_server.should_not forward_email(tmail_fixture('x-beenthere'))
94
95
  end
95
96
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mlist
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Williams
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-12-21 00:00:00 -05:00
12
+ date: 2010-01-11 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies: []
15
15