popper 0.6.4 → 0.6.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/popper/version.rb +1 -1
  3. data/lib/popper.rb +52 -9
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7241d920f1cc1df768881863fd35b016df55897ab00eac6be95afe59e59a392b
4
- data.tar.gz: a4a80773306057f341999e6deedce2ed8688a4e81006be9b4fe3f0e6c23ba98e
3
+ metadata.gz: 4de4bcbe9303ab959c01fd28fd85f0f2dc1caae813453051d516a09d4022e715
4
+ data.tar.gz: 3c52de4d26a5c4eb4586419ef38ae617f94dc3da891b5a657a7aef2f420b6129
5
5
  SHA512:
6
- metadata.gz: c2fdc66898ca3b56790fd5a266888c9162ce0ab7b62edd13ba5c613999863d431131e07d400f4f19d76753987a0cac568a338bf46fde51e16632fb41d4ffc89a
7
- data.tar.gz: 814434364ccb6c25d3d9bd3a328d5707644741377947417f127bc3299d2329d16f0b81251c29e43ac8e96c174bafece2e2f7700737e6a86ab1e5ac7425fd765f
6
+ metadata.gz: 4c7473685a393b108d83a45724b307e6a62c09f22b280b4621e889e054b2ec9ec516fd299106e0175a53a78f7b17abc08c10cee5503b2788af229870b3dc06ca
7
+ data.tar.gz: c89d577059817b392d8560ac9a5eba430eb98afdb2156b2f3d4d632fc481e34ea4e77107d41938cd53745483ec805019af246deb0c63a26bbe14f9a61ca2bbe4
@@ -1,3 +1,3 @@
1
1
  module Popper
2
- VERSION = '0.6.4'
2
+ VERSION = '0.6.5'
3
3
  end
data/lib/popper.rb CHANGED
@@ -1,17 +1,17 @@
1
1
  require 'pp'
2
- require "popper/version"
3
- require "popper/cli"
2
+ require 'popper/version'
3
+ require 'popper/cli'
4
4
  require 'popper/mail_account'
5
- require "popper/config"
6
- require "popper/action"
7
- require "popper/init"
5
+ require 'popper/config'
6
+ require 'popper/action'
7
+ require 'popper/init'
8
8
 
9
9
  module Popper
10
- def self.init_logger(options, stdout=nil)
11
- log_path = options[:log] || "/var/log/popper.log"
12
- log_path = STDOUT if ENV["POPPER_TEST"] || stdout
10
+ def self.init_logger(options, stdout = nil)
11
+ log_path = options[:log] || '/var/log/popper.log'
12
+ log_path = STDOUT if ENV['POPPER_TEST'] || stdout
13
13
  @_logger = Logger.new(log_path)
14
- rescue => e
14
+ rescue StandardError => e
15
15
  puts e
16
16
  end
17
17
 
@@ -19,3 +19,46 @@ module Popper
19
19
  @_logger
20
20
  end
21
21
  end
22
+
23
+ # ref: https://github.com/ruby/net-pop/issues/27
24
+ module Net
25
+ class POP3Command
26
+ def list
27
+ critical do
28
+ getok 'LIST'
29
+ list = []
30
+ @socket.each_list_item do |line|
31
+ if line.split(' ').size != 2
32
+ num, uid = line.split(' ')[2..3]
33
+ list.push [num.to_i, uid.to_i]
34
+ end
35
+ m = /\A(\d+)[ \t]+(\d+)/.match(line) or
36
+ raise POPBadResponse, "bad response: #{line}"
37
+ list.push [m[1].to_i, m[2].to_i]
38
+ end
39
+ return list
40
+ end
41
+ end
42
+
43
+ def uidl(num = nil)
44
+ if num
45
+ res = check_response(critical { get_response('UIDL %d', num) })
46
+ res.split(/ /)[1]
47
+ else
48
+ critical do
49
+ getok('UIDL')
50
+ table = {}
51
+ @socket.each_list_item do |line|
52
+ if line.split(' ').size == 4
53
+ num, uid = line.split(' ')[2..3]
54
+ table[num.to_i] = uid
55
+ end
56
+ num, uid = line.split(' ')
57
+ table[num.to_i] = uid
58
+ end
59
+ return table
60
+ end
61
+ end
62
+ end
63
+ end
64
+ 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.4
4
+ version: 0.6.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - pyama86
@@ -217,7 +217,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
217
217
  - !ruby/object:Gem::Version
218
218
  version: '0'
219
219
  requirements: []
220
- rubygems_version: 3.4.10
220
+ rubygems_version: 3.5.11
221
221
  signing_key:
222
222
  specification_version: 4
223
223
  summary: email notification tool