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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 899d43336ae319fa1483587328c0c1b7db5c9711
4
- data.tar.gz: ec65c2417a0d82f6b2fc7bb471549cdd28385cc6
3
+ metadata.gz: 90aa927924c06369b38fe9fd749e8e2cd5cbd1aa
4
+ data.tar.gz: be0e3502cac365f7722e05f448f9677321ca830f
5
5
  SHA512:
6
- metadata.gz: 5841012e7b9ddbd80d0cd99f0e46590eaf073c6ac1bd909098406a56c4a136aae7542a702d4ffb6e8f2c99dda362cac078955e30ac804b82b470a9acf4562cd5
7
- data.tar.gz: 9123956b06d973d8a72c881646796e8f916293b874ac85490840205e9a2a28477e11c8ca86893454d0018df2b1245caecd8172bbe4e812fc30f85e2123c30643
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
- pop.mails.reject {|m| current_uidls << m.uidl; last_uidl(account.name).include?(m.uidl) }.each do |m|
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
- connection(account) do |pop|
82
- begin
83
- uidls = pop.mails.map(&:uidl)
84
- last_uidl(
85
- account.name,
86
- uidls
87
- )
88
- Popper.log.info "success prepop #{account.name} mail count:#{uidls.count}"
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
@@ -1,3 +1,3 @@
1
1
  module Popper
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: popper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - pyama86