imap-backup 1.2.3 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 55d07b2ed9eae209a118323f3e8c494b831183468ef92e05cfe2ae139177f82b
4
- data.tar.gz: c76ad04b8363dd146fc2abdc5ba6243fe3cd446a107f946187bf45bf16689906
3
+ metadata.gz: 8155050ded00ceecc4a76cf608612f7ba1ef32a51c3985441ad00a247e170140
4
+ data.tar.gz: f91b55a88b6dc3eeddccd3bfa515e7056896dd166f2760d4c337256fbbd50d64
5
5
  SHA512:
6
- metadata.gz: cd396bf6b70d293ef00ac83bc4e3f3ac0efdfdbf56c835484abf5c503ec84d5690537c0f36c5d23cf9e18f27f64372b66157b45491954fa6dfd0c2779b8b7aac
7
- data.tar.gz: 1af9c675e2641debc9e897b4a4ae1a13834550e234887bcdd8ef75cafd3aadde58b296fdd903c377bddf142b340f9ed32fd8e8d6305d673e7fde5a7acb4437a5
6
+ metadata.gz: 24d3ee8534b607abbb10e1345205ca8142e3701190ef8d8ef79128f0bfe6d620c2f275dc58b4e3dc39a0ebae3c1ea48c634ddff48d2d8dbed3ef85f2ad736abc
7
+ data.tar.gz: 8ff7e5f6c757e4866b93ba2621941d38bbaa809cb4be7a08c7307dfdcc4d47b6a59bacd30dfd62c6f294a3fd6b9237cdc91c752a8c1cba3e077a62cbaee013e6
@@ -22,21 +22,17 @@ module Email::Mboxrd
22
22
  end
23
23
 
24
24
  def best_from
25
- if parsed.from.is_a? Enumerable
25
+ if parsed.from.is_a?(Enumerable)
26
26
  parsed.from.each do |addr|
27
- if addr
28
- return addr
29
- end
27
+ return addr if addr
30
28
  end
31
29
  end
32
- if parsed.envelope_from
33
- return parsed.envelope_from
34
- end
35
- if parsed.return_path
36
- return parsed.return_path
37
- end
38
30
 
39
- return ''
31
+ return parsed.sender if parsed.sender
32
+ return parsed.envelope_from if parsed.envelope_from
33
+ return parsed.return_path if parsed.return_path
34
+
35
+ return ""
40
36
  end
41
37
 
42
38
  def from
@@ -44,10 +40,12 @@ module Email::Mboxrd
44
40
  end
45
41
 
46
42
  def mboxrd_body
47
- return @mboxrd_body if @mboxrd_body
48
- @mboxrd_body = supplied_body.gsub(/\n(>*From)/, "\n>\\1")
49
- @mboxrd_body += "\n" unless @mboxrd_body.end_with?("\n")
50
- @mboxrd_body
43
+ @mboxrd_body ||=
44
+ begin
45
+ @mboxrd_body = supplied_body.gsub(/\n(>*From)/, "\n>\\1")
46
+ @mboxrd_body += "\n" if !@mboxrd_body.end_with?("\n")
47
+ @mboxrd_body
48
+ end
51
49
  end
52
50
 
53
51
  def asctime
@@ -2,7 +2,7 @@ module Imap; end
2
2
 
3
3
  module Imap::Backup
4
4
  MAJOR = 1
5
- MINOR = 2
6
- REVISION = 3
5
+ MINOR = 3
6
+ REVISION = 0
7
7
  VERSION = [MAJOR, MINOR, REVISION].map(&:to_s).join(".")
8
8
  end
@@ -8,8 +8,7 @@ Subject: Re: no subject|
8
8
  msg_bad_from = %Q|Delivered-To: you@example.com
9
9
  from: "FirstName LastName (TEXT)" <"TEXT*" <no-reply@example.com>>
10
10
  To: FirstName LastName <you@example.com>
11
- Subject: Re: no subject
12
- Sender: FistName LastName <"TEXT*"no-reply=example.com@example.com>|
11
+ Subject: Re: no subject|
13
12
 
14
13
  msg_no_from_but_return_path = %Q|Delivered-To: you@example.com
15
14
  From: example <www.example.com>
@@ -17,6 +16,11 @@ To: FirstName LastName <you@example.com>
17
16
  Return-Path: <me@example.com>
18
17
  Subject: Re: no subject|
19
18
 
19
+ msg_no_from_but_sender = %Q|Delivered-To: you@example.com
20
+ To: FirstName LastName <you@example.com>
21
+ Subject: Re: no subject
22
+ Sender: FistName LastName <me@example.com>|
23
+
20
24
  describe Email::Mboxrd::Message do
21
25
  let(:from) { "me@example.com" }
22
26
  let(:date) { DateTime.new(2012, 12, 13, 18, 23, 45) }
@@ -77,6 +81,7 @@ describe Email::Mboxrd::Message do
77
81
 
78
82
  context "when original message 'from' is a string but not an address" do
79
83
  let(:message_body) { msg_bad_from }
84
+
80
85
  it "'from' is empty string" do
81
86
  expect(subject.to_s).to start_with("From \n")
82
87
  end
@@ -84,9 +89,18 @@ describe Email::Mboxrd::Message do
84
89
 
85
90
  context "when original message 'from' is nil and 'envelope from' is nil and 'return path' is available" do
86
91
  let(:message_body) { msg_no_from_but_return_path }
92
+
87
93
  it "'return path' is used as 'from'" do
88
94
  expect(subject.to_s).to start_with("From " + from + " \n")
89
95
  end
90
96
  end
97
+
98
+ context "with no from and a 'Sender'" do
99
+ let(:message_body) { msg_no_from_but_sender }
100
+
101
+ it "Sender is used as 'from'" do
102
+ expect(subject.to_s).to start_with("From " + from + " \n")
103
+ end
104
+ end
91
105
  end
92
106
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: imap-backup
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.3
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joe Yates