imap_processor 1.8.1 → 1.9.1

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: 1a9e8dcaced2039fb6596ac7aecc23e76454592000b8da87994799ac34ed9843
4
- data.tar.gz: 2989cac236ba9fee1eec47a1a4882c39adf2195729ed93db7cb1cd4b579904e6
3
+ metadata.gz: 36755836546999905b39ac70e2ee502e4bdc335207f6311496ef97ac438b1761
4
+ data.tar.gz: e61378205b65df8ab80201e1a55e5a47e8617b6c6f89f7109e31047f1fd45a75
5
5
  SHA512:
6
- metadata.gz: f63c1e50661ac9e42a4c1b0ce058f68055b48728212853c1eb713e5a3b7df44345fcc0089640f1ee24d4c8e4f7c87f257aeb48262bcc62daece5ec2b6d03ad40
7
- data.tar.gz: f94ab9c7c1c232e47caf59cfaab928e2086c2bf355540d2b69a858c3440a5c68b44ed5c379c519e6694d90edffe0900dd44ed18d351514e9c683b03c2d425fce
6
+ metadata.gz: 855faf67ecacc55c87971e6b78abd2ab160b64999e97ca981aa14272751984184c994efb3cf8b6ecf88723202a9c2b3cad407c9f7c0c059de31c80862dc2e653
7
+ data.tar.gz: 724758901576f50036be4ac2c98d80a12f943fea0f1f1386d25eabfafe1475b8ae5fafae75218d19d1296ac61d29238b50f690293c946864dc97ba0909064274
checksums.yaml.gz.sig CHANGED
Binary file
data/History.rdoc CHANGED
@@ -1,3 +1,24 @@
1
+ === 1.9.1 / 2026-09-19
2
+
3
+ * 1 minor enhancement:
4
+
5
+ * Added IMAP_CONF env to override the current config.
6
+
7
+ === 1.9.0 / 2025-09-09
8
+
9
+ * 1 minor enhancement:
10
+
11
+ * Added verbose accessors to IMAPProcessor.
12
+
13
+ * 6 bug fixes:
14
+
15
+ * Fixed bug in IMAPProcessor#create_mailbox w/ newer versions of Net::IMAP.
16
+ * Fixed bug with frozen string literals.
17
+ * Fixed deprecation warnings instantiating Net::IMAP w/ newer versions.
18
+ * Fixed to work with Net::IMAP::SASL.
19
+ * Fixed to work with newer vensions of Net::IMAP.
20
+ * Removed warnings loading/configuring Net::IMAP::SASL.
21
+
1
22
  === 1.8.1 / 2023-07-27
2
23
 
3
24
  * 1 bug fix:
data/README.rdoc CHANGED
@@ -14,6 +14,7 @@ manipulate IMAP mailboxes in several different ways:
14
14
 
15
15
  imap_archive :: Archives old messages to a new dated mailbox.
16
16
  imap_cleanse :: Delete messages older than a certain age in specified mailboxes.
17
+ imap_tidy :: Archive + Cleanse: Moves older messages to a dated mailbox.
17
18
  imap_flag :: Flag messages to/from certain people.
18
19
  imap_idle :: Shows new messages in a mailbox.
19
20
  imap_keywords :: Queries an IMAP server for keywords set on messages
@@ -83,7 +83,7 @@ class IMAPProcessor::Client < IMAPProcessor
83
83
  # with PLAIN auth on SSL sockets, sorry.
84
84
 
85
85
  def connect(host, port, ssl, username, password, auth = nil)
86
- @imap = Net::IMAP.new host, port, ssl, nil, false
86
+ @imap = Net::IMAP.new host, port: port, ssl: ssl
87
87
  log "Connected to #{host}:#{port}"
88
88
 
89
89
  if auth.nil? then
@@ -109,8 +109,9 @@ class IMAPProcessor::Client < IMAPProcessor
109
109
  return []
110
110
  end
111
111
 
112
- mailboxes.reject! { |mailbox| mailbox.attr.include? :Noselect }
113
- mailboxes.map! { |mailbox| mailbox.name }
112
+ mailboxes = mailboxes
113
+ .reject { |mailbox| mailbox.attr.include? :Noselect }
114
+ .map(&:name)
114
115
 
115
116
  @box_re = /^#{Regexp.escape @root}#{Regexp.union(*@boxes)}/
116
117
 
@@ -40,6 +40,7 @@ class IMAPProcessor::Tidy < IMAPProcessor
40
40
  def initialize options # :nodoc:
41
41
  super
42
42
 
43
+ log ""
43
44
  log "Tidy: #{options[:Host]}"
44
45
 
45
46
  self.move = options[:move]
@@ -5,8 +5,6 @@ require 'net/imap/date'
5
5
  require 'imap_sasl_plain'
6
6
  require 'yaml'
7
7
 
8
- Net::IMAP::Authenticators.send :public, :authenticators
9
-
10
8
  ##
11
9
  # IMAPProcessor is a client for processing messages on an IMAP server.
12
10
  #
@@ -25,10 +23,15 @@ Net::IMAP::Authenticators.send :public, :authenticators
25
23
 
26
24
  class IMAPProcessor
27
25
 
26
+ NEWER = Net::IMAP::VERSION > "0.4"
27
+
28
+ Net::IMAP::Authenticators.send :public, :authenticators if
29
+ Net::IMAP::Authenticators.private_method_defined? :authenticators
30
+
28
31
  ##
29
32
  # The version of IMAPProcessor you are using
30
33
 
31
- VERSION = "1.8.1"
34
+ VERSION = "1.9.1"
32
35
 
33
36
  ##
34
37
  # Base IMAPProcessor error class
@@ -62,6 +65,11 @@ class IMAPProcessor
62
65
 
63
66
  attr_reader :imap
64
67
 
68
+ ##
69
+ # Was --verbose used?
70
+
71
+ attr_accessor :verbose
72
+
65
73
  ##
66
74
  # Options Hash from process_args
67
75
 
@@ -120,7 +128,7 @@ class IMAPProcessor
120
128
  @@opts_file_name = File.basename processor_file, '.rb'
121
129
  @@opts_file_name = "imap_#{@@opts_file_name}" unless
122
130
  @@opts_file_name =~ /^imap_/
123
- opts_file = File.expand_path "~/.#{@@opts_file_name}"
131
+ opts_file = ENV["IMAP_CONF"] || File.expand_path("~/.#{@@opts_file_name}")
124
132
 
125
133
  if required_options then
126
134
  required_options.each do |option, (default, message)|
@@ -212,8 +220,13 @@ class IMAPProcessor
212
220
  options[:Password] = password
213
221
  end
214
222
 
215
- authenticators = Net::IMAP.authenticators
216
- auth_types = authenticators.keys.sort.join ', '
223
+ auth_class = NEWER ? Net::IMAP::SASL : Net::IMAP
224
+
225
+ authenticators = auth_class.authenticators
226
+
227
+ auth_names = NEWER ? authenticators.names : authenticators.keys
228
+
229
+ auth_types = auth_names.sort.join ', '
217
230
  opts.on("-a", "--auth AUTH", auth_types,
218
231
  "IMAP authentication type override",
219
232
  "Authentication type will be auto-",
@@ -380,7 +393,7 @@ Example ~/.#{@@opts_file_name}:
380
393
  username = @options[:Username],
381
394
  password = @options[:Password],
382
395
  auth = @options[:Auth]) # :yields: Connection
383
- imap = Net::IMAP.new host, port, ssl, nil, false
396
+ imap = Net::IMAP.new host, port:port, ssl:ssl
384
397
  log "Connected to imap://#{host}:#{port}/"
385
398
 
386
399
  capabilities = capability imap, imap.greeting
@@ -389,7 +402,7 @@ Example ~/.#{@@opts_file_name}:
389
402
 
390
403
  auth_caps = capabilities.select { |c| c =~ /^AUTH/ }
391
404
 
392
- if auth.nil? then
405
+ unless auth then
393
406
  raise "Couldn't find a supported auth type" if auth_caps.empty?
394
407
  auth = auth_caps.first.sub(/AUTH=/, '')
395
408
  end
@@ -431,7 +444,7 @@ Example ~/.#{@@opts_file_name}:
431
444
  def create_mailbox name
432
445
  log "LIST #{name}"
433
446
  list = imap.list '', name
434
- return if list
447
+ return if list && !list.empty?
435
448
  log "CREATE #{name}"
436
449
  imap.create name unless noop?
437
450
  end
@@ -580,7 +593,7 @@ Example ~/.#{@@opts_file_name}:
580
593
  def show_messages(uids)
581
594
  return if uids.nil? or (Array === uids and uids.empty?)
582
595
 
583
- fetch_data = 'BODY.PEEK[HEADER.FIELDS (DATE FROM TO SUBJECT)]'
596
+ fetch_data = +'BODY.PEEK[HEADER.FIELDS (DATE FROM TO SUBJECT)]'
584
597
  messages = imap.fetch uids, fetch_data
585
598
  fetch_data.sub! '.PEEK', '' # stripped by server
586
599
 
@@ -35,6 +35,11 @@ class Net::IMAP::PlainAuthenticator
35
35
  end unless defined? Net::IMAP::PlainAuthenticator
36
36
 
37
37
  if defined? OpenSSL then
38
- Net::IMAP.add_authenticator 'PLAIN', Net::IMAP::PlainAuthenticator
38
+ old, $-w = $-w, nil
39
+ if Net::IMAP::SASL.respond_to?(:add_authenticator) then
40
+ Net::IMAP::SASL.add_authenticator 'PLAIN', Net::IMAP::PlainAuthenticator
41
+ else
42
+ Net::IMAP.add_authenticator 'PLAIN', Net::IMAP::PlainAuthenticator
43
+ end
44
+ $-w = old
39
45
  end
40
-
@@ -27,7 +27,7 @@ require 'time'
27
27
  #
28
28
  # test:test:<your uid>:<your gid>::/path/to/your/home/dovecot
29
29
 
30
- class TestIMAPProcessor < MiniTest::Unit::TestCase
30
+ class TestIMAPProcessor < Minitest::Test
31
31
 
32
32
  def setup
33
33
  host, port, username, password = 'localhost', 143, 'test', 'test'
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,19 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: imap_processor
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.1
4
+ version: 1.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Davis
8
8
  - Eric Hodel
9
- autorequire:
10
9
  bindir: bin
11
10
  cert_chain:
12
11
  - |
13
12
  -----BEGIN CERTIFICATE-----
14
- MIIDPjCCAiagAwIBAgIBBzANBgkqhkiG9w0BAQsFADBFMRMwEQYDVQQDDApyeWFu
13
+ MIIDPjCCAiagAwIBAgIBCjANBgkqhkiG9w0BAQsFADBFMRMwEQYDVQQDDApyeWFu
15
14
  ZC1ydWJ5MRkwFwYKCZImiZPyLGQBGRYJemVuc3BpZGVyMRMwEQYKCZImiZPyLGQB
16
- GRYDY29tMB4XDTIzMDEwMTA3NTExN1oXDTI0MDEwMTA3NTExN1owRTETMBEGA1UE
15
+ GRYDY29tMB4XDTI2MDEwNzAxMDkxNFoXDTI3MDEwNzAxMDkxNFowRTETMBEGA1UE
17
16
  AwwKcnlhbmQtcnVieTEZMBcGCgmSJomT8ixkARkWCXplbnNwaWRlcjETMBEGCgmS
18
17
  JomT8ixkARkWA2NvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALda
19
18
  b9DCgK+627gPJkB6XfjZ1itoOQvpqH1EXScSaba9/S2VF22VYQbXU1xQXL/WzCkx
@@ -23,14 +22,14 @@ cert_chain:
23
22
  qhtV7HJxNKuPj/JFH0D2cswvzznE/a5FOYO68g+YCuFi5L8wZuuM8zzdwjrWHqSV
24
23
  gBEfoTEGr7Zii72cx+sCAwEAAaM5MDcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAw
25
24
  HQYDVR0OBBYEFEfFe9md/r/tj/Wmwpy+MI8d9k/hMA0GCSqGSIb3DQEBCwUAA4IB
26
- AQAkg3y+PBnBAPWdxxITm5sPHqdWQgSyCpRA20o4LTuWr8BWhSXBkfQNa7cY6fOn
27
- xyM34VPzBFbExv6XOGDfOMFBVaYTHuN9peC/5/umL7kLl+nflXzL2QA7K6LYj5Bg
28
- sM574Onr0dZDM6Vn69bzQ7rBIFDfK/OhlPzqKZad4nsdcsVH8ODCiT+ATMIZyz5K
29
- WCnNtqlyiWXI8tdTpahDgcUwfcN/oN7v4K8iU5IbLJX6HQ5DKgmKjfb6XyMth16k
30
- ROfWo9Uyp8ba/j9eVG14KkYRaLydAY1MNQk2yd3R5CGfeOpD1kttxjoypoUJ2dOG
31
- nsNBRuQJ1UfiCG97a6DNm+Fr
25
+ AQA/X8/PKTTc/IkYQEUL6XWtfK8fAfbuLJzmLcz6f2ZWrtBvPsYvqRuwI1bWUtil
26
+ 2ibJEfIuSIHX6BsUTX18+hlaIussf6EWq/YkE7e2BKmgQE42vSOZMce0kCEAPbx0
27
+ rQtqonfWTHQ8UbQ7GqCL3gDQ0QDD2B+HUlb4uaCZ2icxqa/eOtxMvHC2tj+h0xKY
28
+ xL84ipM5kr0bHGf9/MRZJWcw51urueNycBXu1Xh+pEN8qBmYsFRR4SIODLClybAO
29
+ 6cbm2PyPQgKNiqE4H+IQrDVHd9bJs1XgLElk3qoaJBWXc/5fy0J1imYb25UqmiHG
30
+ snGe1hrppvBRdcyEzvhfIPjI
32
31
  -----END CERTIFICATE-----
33
- date: 2023-07-27 00:00:00.000000000 Z
32
+ date: 1980-01-02 00:00:00.000000000 Z
34
33
  dependencies:
35
34
  - !ruby/object:Gem::Dependency
36
35
  name: rdoc
@@ -38,34 +37,34 @@ dependencies:
38
37
  requirements:
39
38
  - - ">="
40
39
  - !ruby/object:Gem::Version
41
- version: '4.0'
40
+ version: '7.0'
42
41
  - - "<"
43
42
  - !ruby/object:Gem::Version
44
- version: '7'
43
+ version: '9'
45
44
  type: :development
46
45
  prerelease: false
47
46
  version_requirements: !ruby/object:Gem::Requirement
48
47
  requirements:
49
48
  - - ">="
50
49
  - !ruby/object:Gem::Version
51
- version: '4.0'
50
+ version: '7.0'
52
51
  - - "<"
53
52
  - !ruby/object:Gem::Version
54
- version: '7'
53
+ version: '9'
55
54
  - !ruby/object:Gem::Dependency
56
55
  name: hoe
57
56
  requirement: !ruby/object:Gem::Requirement
58
57
  requirements:
59
58
  - - "~>"
60
59
  - !ruby/object:Gem::Version
61
- version: '4.0'
60
+ version: '4.7'
62
61
  type: :development
63
62
  prerelease: false
64
63
  version_requirements: !ruby/object:Gem::Requirement
65
64
  requirements:
66
65
  - - "~>"
67
66
  - !ruby/object:Gem::Version
68
- version: '4.0'
67
+ version: '4.7'
69
68
  description: |-
70
69
  IMAPProcessor is a client for processing messages on an IMAP server. It
71
70
  provides some basic mechanisms for connecting to an IMAP server, determining
@@ -76,11 +75,18 @@ description: |-
76
75
 
77
76
  imap_archive :: Archives old messages to a new dated mailbox.
78
77
  imap_cleanse :: Delete messages older than a certain age in specified mailboxes.
78
+ imap_tidy :: Archive + Cleanse: Moves older messages to a dated mailbox.
79
79
  imap_flag :: Flag messages to/from certain people.
80
80
  imap_idle :: Shows new messages in a mailbox.
81
81
  imap_keywords :: Queries an IMAP server for keywords set on messages
82
82
  imap_learn :: Flags messages based on what you've flagged before.
83
83
  imap_mkdir :: Ensures that certain mailboxes exist.
84
+
85
+ == Features/Problems:
86
+
87
+ * Connection toolkit
88
+ * Executable toolkit
89
+ * Only known to work with SASL/PLAIN authentication
84
90
  email:
85
91
  - ryand-ruby@zenspider.com
86
92
  - drbrain@segment7.net
@@ -96,7 +102,6 @@ executables:
96
102
  extensions: []
97
103
  extra_rdoc_files:
98
104
  - History.rdoc
99
- - Manifest.txt
100
105
  - README.rdoc
101
106
  files:
102
107
  - ".autotest"
@@ -131,7 +136,7 @@ licenses:
131
136
  - MIT
132
137
  metadata:
133
138
  homepage_uri: https://github.com/seattlerb/imap_processor
134
- post_install_message:
139
+ documentation_uri: http://docs.seattlerb.org/imap_processor
135
140
  rdoc_options:
136
141
  - "--main"
137
142
  - README.rdoc
@@ -148,8 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
148
153
  - !ruby/object:Gem::Version
149
154
  version: '0'
150
155
  requirements: []
151
- rubygems_version: 3.4.10
152
- signing_key:
156
+ rubygems_version: 3.7.2
153
157
  specification_version: 4
154
158
  summary: IMAPProcessor is a client for processing messages on an IMAP server
155
159
  test_files: []
metadata.gz.sig CHANGED
Binary file