imap-backup 1.2.3 → 1.3.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.
- checksums.yaml +4 -4
- data/lib/email/mboxrd/message.rb +13 -15
- data/lib/imap/backup/version.rb +2 -2
- data/spec/unit/email/mboxrd/message_spec.rb +16 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8155050ded00ceecc4a76cf608612f7ba1ef32a51c3985441ad00a247e170140
|
4
|
+
data.tar.gz: f91b55a88b6dc3eeddccd3bfa515e7056896dd166f2760d4c337256fbbd50d64
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 24d3ee8534b607abbb10e1345205ca8142e3701190ef8d8ef79128f0bfe6d620c2f275dc58b4e3dc39a0ebae3c1ea48c634ddff48d2d8dbed3ef85f2ad736abc
|
7
|
+
data.tar.gz: 8ff7e5f6c757e4866b93ba2621941d38bbaa809cb4be7a08c7307dfdcc4d47b6a59bacd30dfd62c6f294a3fd6b9237cdc91c752a8c1cba3e077a62cbaee013e6
|
data/lib/email/mboxrd/message.rb
CHANGED
@@ -22,21 +22,17 @@ module Email::Mboxrd
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def best_from
|
25
|
-
if parsed.from.is_a?
|
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
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
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
|
data/lib/imap/backup/version.rb
CHANGED
@@ -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
|