net-imap 0.4.9.1 → 0.5.6
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 +4 -4
- data/BSDL +22 -0
- data/COPYING +56 -0
- data/Gemfile +12 -1
- data/LICENSE.txt +3 -22
- data/README.md +10 -4
- data/docs/styles.css +75 -14
- data/lib/net/imap/authenticators.rb +2 -2
- data/lib/net/imap/command_data.rb +61 -48
- data/lib/net/imap/config/attr_accessors.rb +75 -0
- data/lib/net/imap/config/attr_inheritance.rb +90 -0
- data/lib/net/imap/config/attr_type_coercion.rb +61 -0
- data/lib/net/imap/config.rb +470 -0
- data/lib/net/imap/data_encoding.rb +4 -4
- data/lib/net/imap/data_lite.rb +226 -0
- data/lib/net/imap/deprecated_client_options.rb +9 -6
- data/lib/net/imap/errors.rb +7 -1
- data/lib/net/imap/esearch_result.rb +180 -0
- data/lib/net/imap/fetch_data.rb +126 -47
- data/lib/net/imap/flags.rb +1 -1
- data/lib/net/imap/response_data.rb +126 -239
- data/lib/net/imap/response_parser/parser_utils.rb +11 -6
- data/lib/net/imap/response_parser.rb +188 -34
- data/lib/net/imap/sasl/anonymous_authenticator.rb +3 -3
- data/lib/net/imap/sasl/authentication_exchange.rb +52 -20
- data/lib/net/imap/sasl/authenticators.rb +8 -4
- data/lib/net/imap/sasl/client_adapter.rb +77 -26
- data/lib/net/imap/sasl/cram_md5_authenticator.rb +4 -4
- data/lib/net/imap/sasl/digest_md5_authenticator.rb +218 -56
- data/lib/net/imap/sasl/external_authenticator.rb +3 -3
- data/lib/net/imap/sasl/gs2_header.rb +7 -7
- data/lib/net/imap/sasl/login_authenticator.rb +4 -3
- data/lib/net/imap/sasl/oauthbearer_authenticator.rb +6 -6
- data/lib/net/imap/sasl/plain_authenticator.rb +7 -7
- data/lib/net/imap/sasl/protocol_adapters.rb +60 -4
- data/lib/net/imap/sasl/scram_authenticator.rb +8 -8
- data/lib/net/imap/sasl.rb +8 -5
- data/lib/net/imap/sasl_adapter.rb +0 -1
- data/lib/net/imap/search_result.rb +4 -8
- data/lib/net/imap/sequence_set.rb +239 -88
- data/lib/net/imap/stringprep/nameprep.rb +1 -1
- data/lib/net/imap/stringprep/trace.rb +4 -4
- data/lib/net/imap/uidplus_data.rb +244 -0
- data/lib/net/imap/vanished_data.rb +56 -0
- data/lib/net/imap.rb +1012 -322
- data/net-imap.gemspec +4 -7
- data/rakelib/benchmarks.rake +1 -1
- data/rakelib/rfcs.rake +2 -0
- data/rakelib/string_prep_tables_generator.rb +2 -0
- data/sample/net-imap.rb +167 -0
- metadata +16 -40
- data/.github/dependabot.yml +0 -6
- data/.github/workflows/pages.yml +0 -46
- data/.github/workflows/test.yml +0 -31
- data/.gitignore +0 -12
data/net-imap.gemspec
CHANGED
@@ -11,12 +11,12 @@ Gem::Specification.new do |spec|
|
|
11
11
|
spec.name = name
|
12
12
|
spec.version = version
|
13
13
|
spec.authors = ["Shugo Maeda", "nicholas a. evans"]
|
14
|
-
spec.email = ["shugo@ruby-lang.org", "nick@
|
14
|
+
spec.email = ["shugo@ruby-lang.org", "nick@rubinick.dev"]
|
15
15
|
|
16
16
|
spec.summary = %q{Ruby client api for Internet Message Access Protocol}
|
17
17
|
spec.description = %q{Ruby client api for Internet Message Access Protocol}
|
18
18
|
spec.homepage = "https://github.com/ruby/net-imap"
|
19
|
-
spec.required_ruby_version = Gem::Requirement.new(">=
|
19
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 3.1.0")
|
20
20
|
spec.licenses = ["Ruby", "BSD-2-Clause"]
|
21
21
|
|
22
22
|
spec.metadata["homepage_uri"] = spec.homepage
|
@@ -25,9 +25,9 @@ Gem::Specification.new do |spec|
|
|
25
25
|
|
26
26
|
# Specify which files should be added to the gem when it is released.
|
27
27
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
28
|
-
spec.files = Dir.chdir(
|
28
|
+
spec.files = Dir.chdir(__dir__) do
|
29
29
|
`git ls-files -z 2>/dev/null`.split("\x0")
|
30
|
-
.
|
30
|
+
.grep_v(%r{^(\.git(ignore)?|\.mailmap|(\.github|bin|test|spec|benchmarks|features|rfcs)/)})
|
31
31
|
end
|
32
32
|
spec.bindir = "exe"
|
33
33
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
@@ -35,7 +35,4 @@ Gem::Specification.new do |spec|
|
|
35
35
|
|
36
36
|
spec.add_dependency "net-protocol"
|
37
37
|
spec.add_dependency "date"
|
38
|
-
|
39
|
-
spec.add_development_dependency "digest"
|
40
|
-
spec.add_development_dependency "strscan"
|
41
38
|
end
|
data/rakelib/benchmarks.rake
CHANGED
@@ -26,7 +26,7 @@ file "benchmarks/parser.yml" => PARSER_TEST_FIXTURES do |t|
|
|
26
26
|
files = path.glob("*.yml")
|
27
27
|
tests = files.flat_map {|file|
|
28
28
|
file.read
|
29
|
-
.gsub(%r{([-:]) !ruby/(object|struct):\S+}) { $1 }
|
29
|
+
.gsub(%r{([-:]) !ruby/(object|struct|array):\S+}) { $1 }
|
30
30
|
.then {
|
31
31
|
YAML.safe_load(_1, filename: file,
|
32
32
|
permitted_classes: [Symbol, Regexp], aliases: true)
|
data/rakelib/rfcs.rake
CHANGED
data/sample/net-imap.rb
ADDED
@@ -0,0 +1,167 @@
|
|
1
|
+
require 'net/imap'
|
2
|
+
require "getoptlong"
|
3
|
+
|
4
|
+
$stdout.sync = true
|
5
|
+
$port = nil
|
6
|
+
$user = ENV["USER"] || ENV["LOGNAME"]
|
7
|
+
$auth = "login"
|
8
|
+
$ssl = false
|
9
|
+
$starttls = false
|
10
|
+
|
11
|
+
def usage
|
12
|
+
<<EOF
|
13
|
+
usage: #{$0} [options] <host>
|
14
|
+
|
15
|
+
--help print this message
|
16
|
+
--port=PORT specifies port
|
17
|
+
--user=USER specifies user
|
18
|
+
--auth=AUTH specifies auth type
|
19
|
+
--starttls use starttls
|
20
|
+
--ssl use ssl
|
21
|
+
EOF
|
22
|
+
end
|
23
|
+
|
24
|
+
begin
|
25
|
+
require 'io/console'
|
26
|
+
rescue LoadError
|
27
|
+
def _noecho(&block)
|
28
|
+
system("stty", "-echo")
|
29
|
+
begin
|
30
|
+
yield STDIN
|
31
|
+
ensure
|
32
|
+
system("stty", "echo")
|
33
|
+
end
|
34
|
+
end
|
35
|
+
else
|
36
|
+
def _noecho(&block)
|
37
|
+
STDIN.noecho(&block)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def get_password
|
42
|
+
print "password: "
|
43
|
+
begin
|
44
|
+
return _noecho(&:gets).chomp
|
45
|
+
ensure
|
46
|
+
puts
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def get_command
|
51
|
+
printf("%s@%s> ", $user, $host)
|
52
|
+
if line = gets
|
53
|
+
return line.strip.split(/\s+/)
|
54
|
+
else
|
55
|
+
return nil
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
parser = GetoptLong.new
|
60
|
+
parser.set_options(['--debug', GetoptLong::NO_ARGUMENT],
|
61
|
+
['--help', GetoptLong::NO_ARGUMENT],
|
62
|
+
['--port', GetoptLong::REQUIRED_ARGUMENT],
|
63
|
+
['--user', GetoptLong::REQUIRED_ARGUMENT],
|
64
|
+
['--auth', GetoptLong::REQUIRED_ARGUMENT],
|
65
|
+
['--starttls', GetoptLong::NO_ARGUMENT],
|
66
|
+
['--ssl', GetoptLong::NO_ARGUMENT])
|
67
|
+
begin
|
68
|
+
parser.each_option do |name, arg|
|
69
|
+
case name
|
70
|
+
when "--port"
|
71
|
+
$port = arg
|
72
|
+
when "--user"
|
73
|
+
$user = arg
|
74
|
+
when "--auth"
|
75
|
+
$auth = arg
|
76
|
+
when "--ssl"
|
77
|
+
$ssl = true
|
78
|
+
when "--starttls"
|
79
|
+
$starttls = true
|
80
|
+
when "--debug"
|
81
|
+
Net::IMAP.debug = true
|
82
|
+
when "--help"
|
83
|
+
usage
|
84
|
+
exit
|
85
|
+
end
|
86
|
+
end
|
87
|
+
rescue
|
88
|
+
abort usage
|
89
|
+
end
|
90
|
+
|
91
|
+
$host = ARGV.shift
|
92
|
+
unless $host
|
93
|
+
abort usage
|
94
|
+
end
|
95
|
+
|
96
|
+
imap = Net::IMAP.new($host, :port => $port, :ssl => $ssl)
|
97
|
+
begin
|
98
|
+
imap.starttls if $starttls
|
99
|
+
class << password = method(:get_password)
|
100
|
+
alias to_str call
|
101
|
+
end
|
102
|
+
imap.authenticate($auth, $user, password)
|
103
|
+
while true
|
104
|
+
cmd, *args = get_command
|
105
|
+
break unless cmd
|
106
|
+
begin
|
107
|
+
case cmd
|
108
|
+
when "list"
|
109
|
+
for mbox in imap.list("", args[0] || "*")
|
110
|
+
if mbox.attr.include?(Net::IMAP::NOSELECT)
|
111
|
+
prefix = "!"
|
112
|
+
elsif mbox.attr.include?(Net::IMAP::MARKED)
|
113
|
+
prefix = "*"
|
114
|
+
else
|
115
|
+
prefix = " "
|
116
|
+
end
|
117
|
+
print prefix, mbox.name, "\n"
|
118
|
+
end
|
119
|
+
when "select"
|
120
|
+
imap.select(args[0] || "inbox")
|
121
|
+
print "ok\n"
|
122
|
+
when "close"
|
123
|
+
imap.close
|
124
|
+
print "ok\n"
|
125
|
+
when "summary"
|
126
|
+
unless messages = imap.responses["EXISTS"][-1]
|
127
|
+
puts "not selected"
|
128
|
+
next
|
129
|
+
end
|
130
|
+
if messages > 0
|
131
|
+
for data in imap.fetch(1..-1, ["ENVELOPE"])
|
132
|
+
print data.seqno, ": ", data.attr["ENVELOPE"].subject, "\n"
|
133
|
+
end
|
134
|
+
else
|
135
|
+
puts "no message"
|
136
|
+
end
|
137
|
+
when "fetch"
|
138
|
+
if args[0]
|
139
|
+
data = imap.fetch(args[0].to_i, ["RFC822.HEADER", "RFC822.TEXT"])[0]
|
140
|
+
puts data.attr["RFC822.HEADER"]
|
141
|
+
puts data.attr["RFC822.TEXT"]
|
142
|
+
else
|
143
|
+
puts "missing argument"
|
144
|
+
end
|
145
|
+
when "logout", "exit", "quit"
|
146
|
+
break
|
147
|
+
when "help", "?"
|
148
|
+
print <<EOF
|
149
|
+
list [pattern] list mailboxes
|
150
|
+
select [mailbox] select mailbox
|
151
|
+
close close mailbox
|
152
|
+
summary display summary
|
153
|
+
fetch [msgno] display message
|
154
|
+
logout logout
|
155
|
+
help, ? display help message
|
156
|
+
EOF
|
157
|
+
else
|
158
|
+
print "unknown command: ", cmd, "\n"
|
159
|
+
end
|
160
|
+
rescue Net::IMAP::Error
|
161
|
+
puts $!
|
162
|
+
end
|
163
|
+
end
|
164
|
+
ensure
|
165
|
+
imap.logout
|
166
|
+
imap.disconnect
|
167
|
+
end
|
metadata
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: net-imap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shugo Maeda
|
8
8
|
- nicholas a. evans
|
9
|
-
autorequire:
|
10
9
|
bindir: exe
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2025-02-07 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: net-protocol
|
@@ -39,46 +38,16 @@ dependencies:
|
|
39
38
|
- - ">="
|
40
39
|
- !ruby/object:Gem::Version
|
41
40
|
version: '0'
|
42
|
-
- !ruby/object:Gem::Dependency
|
43
|
-
name: digest
|
44
|
-
requirement: !ruby/object:Gem::Requirement
|
45
|
-
requirements:
|
46
|
-
- - ">="
|
47
|
-
- !ruby/object:Gem::Version
|
48
|
-
version: '0'
|
49
|
-
type: :development
|
50
|
-
prerelease: false
|
51
|
-
version_requirements: !ruby/object:Gem::Requirement
|
52
|
-
requirements:
|
53
|
-
- - ">="
|
54
|
-
- !ruby/object:Gem::Version
|
55
|
-
version: '0'
|
56
|
-
- !ruby/object:Gem::Dependency
|
57
|
-
name: strscan
|
58
|
-
requirement: !ruby/object:Gem::Requirement
|
59
|
-
requirements:
|
60
|
-
- - ">="
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
version: '0'
|
63
|
-
type: :development
|
64
|
-
prerelease: false
|
65
|
-
version_requirements: !ruby/object:Gem::Requirement
|
66
|
-
requirements:
|
67
|
-
- - ">="
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
version: '0'
|
70
41
|
description: Ruby client api for Internet Message Access Protocol
|
71
42
|
email:
|
72
43
|
- shugo@ruby-lang.org
|
73
|
-
- nick@
|
44
|
+
- nick@rubinick.dev
|
74
45
|
executables: []
|
75
46
|
extensions: []
|
76
47
|
extra_rdoc_files: []
|
77
48
|
files:
|
78
|
-
-
|
79
|
-
-
|
80
|
-
- ".github/workflows/test.yml"
|
81
|
-
- ".gitignore"
|
49
|
+
- BSDL
|
50
|
+
- COPYING
|
82
51
|
- Gemfile
|
83
52
|
- LICENSE.txt
|
84
53
|
- README.md
|
@@ -87,9 +56,15 @@ files:
|
|
87
56
|
- lib/net/imap.rb
|
88
57
|
- lib/net/imap/authenticators.rb
|
89
58
|
- lib/net/imap/command_data.rb
|
59
|
+
- lib/net/imap/config.rb
|
60
|
+
- lib/net/imap/config/attr_accessors.rb
|
61
|
+
- lib/net/imap/config/attr_inheritance.rb
|
62
|
+
- lib/net/imap/config/attr_type_coercion.rb
|
90
63
|
- lib/net/imap/data_encoding.rb
|
64
|
+
- lib/net/imap/data_lite.rb
|
91
65
|
- lib/net/imap/deprecated_client_options.rb
|
92
66
|
- lib/net/imap/errors.rb
|
67
|
+
- lib/net/imap/esearch_result.rb
|
93
68
|
- lib/net/imap/fetch_data.rb
|
94
69
|
- lib/net/imap/flags.rb
|
95
70
|
- lib/net/imap/response_data.rb
|
@@ -121,12 +96,15 @@ files:
|
|
121
96
|
- lib/net/imap/stringprep/saslprep_tables.rb
|
122
97
|
- lib/net/imap/stringprep/tables.rb
|
123
98
|
- lib/net/imap/stringprep/trace.rb
|
99
|
+
- lib/net/imap/uidplus_data.rb
|
100
|
+
- lib/net/imap/vanished_data.rb
|
124
101
|
- net-imap.gemspec
|
125
102
|
- rakelib/benchmarks.rake
|
126
103
|
- rakelib/rdoc.rake
|
127
104
|
- rakelib/rfcs.rake
|
128
105
|
- rakelib/saslprep.rake
|
129
106
|
- rakelib/string_prep_tables_generator.rb
|
107
|
+
- sample/net-imap.rb
|
130
108
|
homepage: https://github.com/ruby/net-imap
|
131
109
|
licenses:
|
132
110
|
- Ruby
|
@@ -135,7 +113,6 @@ metadata:
|
|
135
113
|
homepage_uri: https://github.com/ruby/net-imap
|
136
114
|
source_code_uri: https://github.com/ruby/net-imap
|
137
115
|
changelog_uri: https://github.com/ruby/net-imap/releases
|
138
|
-
post_install_message:
|
139
116
|
rdoc_options: []
|
140
117
|
require_paths:
|
141
118
|
- lib
|
@@ -143,15 +120,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
143
120
|
requirements:
|
144
121
|
- - ">="
|
145
122
|
- !ruby/object:Gem::Version
|
146
|
-
version:
|
123
|
+
version: 3.1.0
|
147
124
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
148
125
|
requirements:
|
149
126
|
- - ">="
|
150
127
|
- !ruby/object:Gem::Version
|
151
128
|
version: '0'
|
152
129
|
requirements: []
|
153
|
-
rubygems_version: 3.
|
154
|
-
signing_key:
|
130
|
+
rubygems_version: 3.6.2
|
155
131
|
specification_version: 4
|
156
132
|
summary: Ruby client api for Internet Message Access Protocol
|
157
133
|
test_files: []
|
data/.github/dependabot.yml
DELETED
data/.github/workflows/pages.yml
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
name: Deploy RDoc site to Pages
|
2
|
-
|
3
|
-
on:
|
4
|
-
push:
|
5
|
-
branches: [ 'master' ]
|
6
|
-
workflow_dispatch:
|
7
|
-
|
8
|
-
permissions:
|
9
|
-
contents: read
|
10
|
-
pages: write
|
11
|
-
id-token: write
|
12
|
-
|
13
|
-
concurrency:
|
14
|
-
group: "pages"
|
15
|
-
cancel-in-progress: true
|
16
|
-
|
17
|
-
jobs:
|
18
|
-
build:
|
19
|
-
runs-on: ubuntu-latest
|
20
|
-
steps:
|
21
|
-
- name: Checkout
|
22
|
-
uses: actions/checkout@v4
|
23
|
-
- name: Setup Ruby
|
24
|
-
uses: ruby/setup-ruby@250fcd6a742febb1123a77a841497ccaa8b9e939 # v1.152.0
|
25
|
-
with:
|
26
|
-
ruby-version: '3.2'
|
27
|
-
bundler-cache: true
|
28
|
-
- name: Setup Pages
|
29
|
-
id: pages
|
30
|
-
uses: actions/configure-pages@v4
|
31
|
-
- name: Build with RDoc
|
32
|
-
run: bundle exec rake rdoc
|
33
|
-
- name: Upload artifact
|
34
|
-
uses: actions/upload-pages-artifact@v2
|
35
|
-
with: { path: 'doc' }
|
36
|
-
|
37
|
-
deploy:
|
38
|
-
environment:
|
39
|
-
name: github-pages
|
40
|
-
url: ${{ steps.deployment.outputs.page_url }}
|
41
|
-
runs-on: ubuntu-latest
|
42
|
-
needs: build
|
43
|
-
steps:
|
44
|
-
- name: Deploy to GitHub Pages
|
45
|
-
id: deployment
|
46
|
-
uses: actions/deploy-pages@v3
|
data/.github/workflows/test.yml
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
name: ubuntu
|
2
|
-
|
3
|
-
on: [push, pull_request]
|
4
|
-
|
5
|
-
jobs:
|
6
|
-
ruby-versions:
|
7
|
-
uses: ruby/actions/.github/workflows/ruby_versions.yml@master
|
8
|
-
with:
|
9
|
-
engine: cruby
|
10
|
-
min_version: 2.7
|
11
|
-
|
12
|
-
build:
|
13
|
-
needs: ruby-versions
|
14
|
-
name: build (${{ matrix.ruby }} / ${{ matrix.os }})
|
15
|
-
strategy:
|
16
|
-
matrix:
|
17
|
-
ruby: ${{ fromJson(needs.ruby-versions.outputs.versions) }}
|
18
|
-
os: [ ubuntu-latest, macos-latest ]
|
19
|
-
experimental: [false]
|
20
|
-
runs-on: ${{ matrix.os }}
|
21
|
-
continue-on-error: ${{ matrix.experimental }}
|
22
|
-
steps:
|
23
|
-
- uses: actions/checkout@v4
|
24
|
-
- name: Set up Ruby
|
25
|
-
uses: ruby/setup-ruby@v1
|
26
|
-
with:
|
27
|
-
ruby-version: ${{ matrix.ruby }}
|
28
|
-
bundler-cache: true
|
29
|
-
rubygems: 3.4.22
|
30
|
-
- name: Run test
|
31
|
-
run: bundle exec rake test
|