imap_processor 1.8.1 → 1.9.0

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: ef1fa4d15f8e4a6b497ee823b45c4411e4b7b65acce9f94c78bbf7e83acb50de
4
+ data.tar.gz: 3a2d6c65329facb489c9e68ae87935b43322f99fa2bf1f1f09dfd5d5791b5bc6
5
5
  SHA512:
6
- metadata.gz: f63c1e50661ac9e42a4c1b0ce058f68055b48728212853c1eb713e5a3b7df44345fcc0089640f1ee24d4c8e4f7c87f257aeb48262bcc62daece5ec2b6d03ad40
7
- data.tar.gz: f94ab9c7c1c232e47caf59cfaab928e2086c2bf355540d2b69a858c3440a5c68b44ed5c379c519e6694d90edffe0900dd44ed18d351514e9c683b03c2d425fce
6
+ metadata.gz: eb0be3a7c56a289a4e40549c13f20708fb32c203b73dc110290c4b94caebb92f7d25d42c1049f77eabd8a5b3c0f1dacaeddde10d98e8dc508fcad5aa4b685443
7
+ data.tar.gz: b22708aa4630f15879a797fd3e2f1b9709190402c4a7c269f967938440cebe45591398441c5747db1409808b32085333a9e74ad38caf8f53f330cc3d72cceb98
checksums.yaml.gz.sig CHANGED
Binary file
data/History.rdoc CHANGED
@@ -1,3 +1,18 @@
1
+ === 1.9.0 / 2025-09-09
2
+
3
+ * 1 minor enhancement:
4
+
5
+ * Added verbose accessors to IMAPProcessor.
6
+
7
+ * 6 bug fixes:
8
+
9
+ * Fixed bug in IMAPProcessor#create_mailbox w/ newer versions of Net::IMAP.
10
+ * Fixed bug with frozen string literals.
11
+ * Fixed deprecation warnings instantiating Net::IMAP w/ newer versions.
12
+ * Fixed to work with Net::IMAP::SASL.
13
+ * Fixed to work with newer vensions of Net::IMAP.
14
+ * Removed warnings loading/configuring Net::IMAP::SASL.
15
+
1
16
  === 1.8.1 / 2023-07-27
2
17
 
3
18
  * 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
 
@@ -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.0"
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
 
@@ -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.0
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
-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eVG14KkYRaLydAY1MNQk2yd3R5CGfeOpD1kttxjoypoUJ2dOG
31
- nsNBRuQJ1UfiCG97a6DNm+Fr
25
+ AQAC0WQJcPOWPFwkojhzweilRVjTJ19UiLhiBTw3C1wJO3LVdBkWDmnnhAmKuX4D
26
+ r7vjQvESlABGIPdutI1Yl7mrHQzTkfLfXvNN6MT0nLChPyIYauT6SZZxubwJrUfA
27
+ 7R0c2CJTIboZ0XaGpLsXqHEF1c29H7TV1QvVuqKAN2mCjh4N82QVn+ZKtys28AwT
28
+ 6GfQX2fqLoi4KSc7xIzHKaNzqxeOICmJofk9w5VZ2rRN6yes8jvFYwz9HR41wdj8
29
+ bwfinv7Yp5fA6AysuZLhCykyfDuZVRrUp0Vb68YCKsLjJly/Theak+euNTxvHsB+
30
+ al9oSgPPHICMEX65qvLywitx
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
@@ -58,14 +57,14 @@ dependencies:
58
57
  requirements:
59
58
  - - "~>"
60
59
  - !ruby/object:Gem::Version
61
- version: '4.0'
60
+ version: '4.3'
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.3'
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,6 +75,7 @@ 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
@@ -131,7 +131,6 @@ licenses:
131
131
  - MIT
132
132
  metadata:
133
133
  homepage_uri: https://github.com/seattlerb/imap_processor
134
- post_install_message:
135
134
  rdoc_options:
136
135
  - "--main"
137
136
  - README.rdoc
@@ -148,8 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
148
147
  - !ruby/object:Gem::Version
149
148
  version: '0'
150
149
  requirements: []
151
- rubygems_version: 3.4.10
152
- signing_key:
150
+ rubygems_version: 3.7.1
153
151
  specification_version: 4
154
152
  summary: IMAPProcessor is a client for processing messages on an IMAP server
155
153
  test_files: []
metadata.gz.sig CHANGED
Binary file