popper 0.6.2 → 0.6.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5f23fe15b78f11b47aa52fdb5cad73ebedd8facc552d26a607638708e23b3e1f
4
- data.tar.gz: 19ed031ffdaa942a0d398557c13baa0fafef8344bbfd253c41a24f8af08f86a3
3
+ metadata.gz: 7241d920f1cc1df768881863fd35b016df55897ab00eac6be95afe59e59a392b
4
+ data.tar.gz: a4a80773306057f341999e6deedce2ed8688a4e81006be9b4fe3f0e6c23ba98e
5
5
  SHA512:
6
- metadata.gz: f116d29ff59f6474200649e54e29721662be4659800abb9effee52b0193384cab8d037d2f18d42ebb8b4f14088450c3e2ab261ca957979d21dc10d4ea3718df9
7
- data.tar.gz: 7725660d395fb16f3574e87dbe5db952bea95d4a90675522e6f4d0a49f3c6adf6b6049f6ae6b8268b925b62a54152631d40ba9e55cbeb270419722f5aed67b0a
6
+ metadata.gz: c2fdc66898ca3b56790fd5a266888c9162ce0ab7b62edd13ba5c613999863d431131e07d400f4f19d76753987a0cac568a338bf46fde51e16632fb41d4ffc89a
7
+ data.tar.gz: 814434364ccb6c25d3d9bd3a328d5707644741377947417f127bc3299d2329d16f0b81251c29e43ac8e96c174bafece2e2f7700737e6a86ab1e5ac7425fd765f
@@ -7,13 +7,13 @@ module Popper
7
7
  attr_accessor :config, :current_list, :complete_list
8
8
 
9
9
  def initialize(config)
10
- self.config = config
10
+ @config = config
11
11
  end
12
12
 
13
13
  def run
14
14
  session_start do |conn|
15
- self.current_list = conn.mails.map(&:uidl)
16
- self.complete_list = current_list unless complete_list
15
+ @current_list = conn.mails.map(&:uidl)
16
+ @complete_list ||= @current_list
17
17
  pop(conn)
18
18
  end
19
19
  rescue StandardError => e
@@ -27,10 +27,12 @@ module Popper
27
27
  Popper.log.info "start popper #{config.name}"
28
28
 
29
29
  process_uidl_list(conn).each do |m|
30
+ uidl = m.uidl
31
+ Popper.log.info "pop mail:#{uidl}"
30
32
  done_uidls << check_and_action(m)
31
33
  m.delete if config.login.respond_to?(:delete_after) && config.login.delete_after
32
34
  rescue Net::POPError => e
33
- self.complete_list += done_uidls
35
+ @complete_list += done_uidls
34
36
  Popper.log.warn 'pop err write uidl'
35
37
  return
36
38
  rescue StandardError => e
@@ -38,8 +40,8 @@ module Popper
38
40
  Popper.log.warn e
39
41
  end
40
42
 
41
- self.complete_list = current_list - error_uidls
42
- Popper.log.info "success popper #{config.name}"
43
+ @complete_list = @current_list - error_uidls
44
+ Popper.log.info "success popper #{config.name} current_list:#{@current_list.size} complete_list:#{@complete_list.size}"
43
45
  end
44
46
 
45
47
  def check_and_action(m)
@@ -79,7 +81,7 @@ module Popper
79
81
  end
80
82
 
81
83
  def process_uidl_list(conn)
82
- uidl_list = current_list - complete_list
84
+ uidl_list = @current_list - @complete_list
83
85
  conn.mails.select { |_m| uidl_list.include?(_m.uidl) }
84
86
  end
85
87
 
@@ -120,10 +122,10 @@ class EncodeMail < Mail::Message
120
122
  def utf_body
121
123
  if multipart?
122
124
  parts.map do |part|
123
- part.body.decoded.encode('UTF-8', charset) unless part.attachment?
125
+ part.body.decoded.encode('UTF-8', charset, undef: :replace, invalid: :replace, replace: '') unless part.attachment?
124
126
  end.join
125
127
  else
126
- body.decoded.encode('UTF-8', charset)
128
+ body.decoded.encode('UTF-8', charset, undef: :replace, invalid: :replace, replace: '')
127
129
  end
128
130
  end
129
131
  end
@@ -1,3 +1,3 @@
1
1
  module Popper
2
- VERSION = '0.6.2'
2
+ VERSION = '0.6.4'
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.6.2
4
+ version: 0.6.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - pyama86