mailhandler 1.0.25 → 1.0.26
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mailhandler/receiving/mail.rb +29 -37
- data/lib/mailhandler/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c2ddb338b7a52cc1426f32afaaaeab6db6c33b7d
|
4
|
+
data.tar.gz: e79fff22bcc348aa7ecd8c3c6027172f5926f265
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40bfafd947ed23c6562519d1427da8c491097a7d7eeeb2b48c9cdf04c8d169d14d146d509530b264c65b982eb53f3d7fc81f479028c781361f928e834a748d26
|
7
|
+
data.tar.gz: a2dde2cb11e392fb60d5947671dc390f67094535154e0fe3eb8174925be7663c60f401d62f4c88b0a431fd8d25c90db8e255c6b9931ddbf7ff95c6a404a0e9b3
|
@@ -10,58 +10,50 @@ module Mail
|
|
10
10
|
options[:read_only] ? imap.examine(options[:mailbox]) : imap.select(options[:mailbox])
|
11
11
|
uids = imap.uid_search(options[:keys])
|
12
12
|
|
13
|
-
if
|
13
|
+
uids.reverse! if options[:what].to_sym == :last
|
14
|
+
uids = uids.first(options[:count]) if options[:count].is_a?(Integer)
|
15
|
+
uids.reverse! if (options[:what].to_sym == :last && options[:order].to_sym == :asc) ||
|
16
|
+
(options[:what].to_sym != :last && options[:order].to_sym == :desc)
|
14
17
|
|
15
|
-
|
18
|
+
if block_given?
|
16
19
|
|
17
|
-
|
18
|
-
|
19
|
-
uids.reverse! if options[:what].to_sym == :last
|
20
|
-
uids = uids.first(options[:count]) if options[:count].is_a?(Integer)
|
21
|
-
uids.reverse! if (options[:what].to_sym == :last && options[:order].to_sym == :asc) ||
|
22
|
-
(options[:what].to_sym != :last && options[:order].to_sym == :desc)
|
23
|
-
|
24
|
-
if block_given?
|
25
|
-
|
26
|
-
uids.each do |uid|
|
27
|
-
|
28
|
-
uid = options[:uid].to_i unless options[:uid].nil?
|
29
|
-
fetchdata = imap.uid_fetch(uid, ['RFC822'])[0]
|
30
|
-
new_message = Mail.new(fetchdata.attr['RFC822'])
|
31
|
-
new_message.mark_for_delete = true if options[:delete_after_find]
|
20
|
+
uids.each do |uid|
|
32
21
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
end
|
38
|
-
|
39
|
-
imap.uid_store(uid, "+FLAGS", [Net::IMAP::DELETED]) if options[:delete_after_find] && new_message.is_marked_for_delete?
|
40
|
-
break unless options[:uid].nil?
|
22
|
+
uid = options[:uid].to_i unless options[:uid].nil?
|
23
|
+
fetchdata = imap.uid_fetch(uid, ['RFC822'])[0]
|
24
|
+
new_message = Mail.new(fetchdata.attr['RFC822'])
|
25
|
+
new_message.mark_for_delete = true if options[:delete_after_find]
|
41
26
|
|
27
|
+
if block.arity == 3
|
28
|
+
yield new_message, imap, uid
|
29
|
+
else
|
30
|
+
yield new_message
|
42
31
|
end
|
43
32
|
|
44
|
-
imap.
|
33
|
+
imap.uid_store(uid, "+FLAGS", [Net::IMAP::DELETED]) if options[:delete_after_find] && new_message.is_marked_for_delete?
|
34
|
+
break unless options[:uid].nil?
|
45
35
|
|
46
|
-
|
36
|
+
end
|
47
37
|
|
48
|
-
|
38
|
+
imap.expunge if options[:delete_after_find]
|
49
39
|
|
50
|
-
|
40
|
+
else
|
51
41
|
|
52
|
-
|
53
|
-
fetchdata = imap.uid_fetch(uid, ['RFC822'])[0]
|
54
|
-
emails << Mail.new(fetchdata.attr['RFC822'])
|
55
|
-
imap.uid_store(uid, "+FLAGS", [Net::IMAP::DELETED]) if options[:delete_after_find]
|
56
|
-
break unless options[:uid].nil?
|
42
|
+
emails = []
|
57
43
|
|
58
|
-
|
44
|
+
uids.each do |uid|
|
59
45
|
|
60
|
-
|
61
|
-
|
46
|
+
uid = options[:uid].to_i unless options[:uid].nil?
|
47
|
+
fetchdata = imap.uid_fetch(uid, ['RFC822'])[0]
|
48
|
+
emails << Mail.new(fetchdata.attr['RFC822'])
|
49
|
+
imap.uid_store(uid, "+FLAGS", [Net::IMAP::DELETED]) if options[:delete_after_find]
|
50
|
+
break unless options[:uid].nil?
|
62
51
|
|
63
52
|
end
|
64
53
|
|
54
|
+
imap.expunge if options[:delete_after_find]
|
55
|
+
emails.size == 1 && options[:count] == 1 ? emails.first : emails
|
56
|
+
|
65
57
|
end
|
66
58
|
|
67
59
|
end
|
data/lib/mailhandler/version.rb
CHANGED