popper 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/popper/pop.rb +15 -12
- data/lib/popper/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: 90aa927924c06369b38fe9fd749e8e2cd5cbd1aa
|
4
|
+
data.tar.gz: be0e3502cac365f7722e05f448f9677321ca830f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5c7b68791a4b48c12b33a57259ead315c3ce8099df5cd3d44e600397f8947bcc37662115a182d69c25407854b2f79995031a460253ee33a9147674afec6c8802
|
7
|
+
data.tar.gz: b25e0951e10b359009e7fa1ee82fe877f21f92afe64a68c94113104d0a9c2ad72c46f98ff1581a6b999442c4494d182bb567aaf63ea52adc5f191f55c6aa42dc
|
data/lib/popper/pop.rb
CHANGED
@@ -20,11 +20,12 @@ module Popper
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def self.pop(account)
|
23
|
-
current_uidls = []
|
24
23
|
error_uidls = []
|
25
24
|
Popper.log.info "start popper #{account.name}"
|
26
25
|
connection(account) do |pop|
|
27
|
-
|
26
|
+
current_uidls = pop.mails.map(&:uidl)
|
27
|
+
target_uidls = current_uidls - last_uidl(account.name)
|
28
|
+
pop.mails.select {|_m|target_uidls.include?(_m.uidl) }.each do |m|
|
28
29
|
begin
|
29
30
|
mail = EncodeMail.new(m.mail)
|
30
31
|
Popper.log.info "check mail:#{mail.date.to_s} #{mail.subject}"
|
@@ -51,7 +52,9 @@ module Popper
|
|
51
52
|
account.login.user,
|
52
53
|
account.login.password
|
53
54
|
) do |pop|
|
55
|
+
Popper.log.info "connect server #{account.name}"
|
54
56
|
block.call(pop)
|
57
|
+
Popper.log.info "disconnect server #{account.name}"
|
55
58
|
end
|
56
59
|
end
|
57
60
|
|
@@ -78,17 +81,17 @@ module Popper
|
|
78
81
|
def self.prepop
|
79
82
|
Popper.configure.accounts.each do |account|
|
80
83
|
Popper.log.info "start prepop #{account.name}"
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
rescue => e
|
90
|
-
Popper.log.warn e
|
84
|
+
begin
|
85
|
+
connection(account) do |pop|
|
86
|
+
uidls = pop.mails.map(&:uidl)
|
87
|
+
last_uidl(
|
88
|
+
account.name,
|
89
|
+
uidls
|
90
|
+
)
|
91
|
+
Popper.log.info "success prepop #{account.name} mail count:#{uidls.count}"
|
91
92
|
end
|
93
|
+
rescue => e
|
94
|
+
Popper.log.warn e
|
92
95
|
end
|
93
96
|
end
|
94
97
|
end
|
data/lib/popper/version.rb
CHANGED