net-imap 0.2.0 → 0.2.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.

Potentially problematic release.


This version of net-imap might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a804edc85533bfda64ba246d9c90163e9b3ae7de6dcd55cfb22e9788ffc0674b
4
- data.tar.gz: 2c5481cc5def65f616575f484a56024805023cf223e8e184e39b0049ab16d15c
3
+ metadata.gz: 3eefc3b1cd7e0363c5ce0a07a3849b903248a1ab716a6c025dd15dcfd2af30c3
4
+ data.tar.gz: 0ff1ba4529e6d462e9bccd4417997582e8d3fac60ed4e60bbc270c135db115a7
5
5
  SHA512:
6
- metadata.gz: 4292263bd4719686c854b85677e639b5ca6092ad3b44de29384cda759cfe754934d1a8f1ef04a5624b3f726ea9e875ed4c9991247a0d43eb80930c38f9978033
7
- data.tar.gz: 2a8a211591e2da4b295b14564d7166664fdc695c3823bcff86b80ca3b45619a493482a5a5d1ee8bf621c4a7a89fc877d6a7717821412e8053ba613e6202dd2a6
6
+ metadata.gz: 847ccde0966c5dd4e633c0cfd5ce894ad08a7c97dc6598377d169e609770c36093f9ba612a87749755ee56df24d6cde5caae54c4ea93dd4caf37b0a467cc01be
7
+ data.tar.gz: 314766dc692163b3b9b9770d884154357bf956df8f3047bb6ce85c6c07b587cfca616c4a4677855013a33b31b5e43a8267dee7077689266b539afe459c8b467a
@@ -7,13 +7,16 @@ jobs:
7
7
  name: build (${{ matrix.ruby }} / ${{ matrix.os }})
8
8
  strategy:
9
9
  matrix:
10
- ruby: [ 2.7, 2.6, 2.5, head ]
10
+ ruby: [ 3.0, 2.7, 2.5, head ]
11
11
  os: [ ubuntu-latest, macos-latest ]
12
12
  experimental: [false]
13
13
  include:
14
+ # - ruby: 2.6
15
+ # os: ubuntu-latest
16
+ # experimental: true
14
17
  - ruby: 2.6
15
- os: ubuntu-latest
16
- experimental: true
18
+ os: macos-latest
19
+ experimental: false
17
20
  runs-on: ${{ matrix.os }}
18
21
  continue-on-error: ${{ matrix.experimental }}
19
22
  steps:
data/lib/net/imap.rb CHANGED
@@ -201,7 +201,7 @@ module Net
201
201
  # Unicode", RFC 2152, May 1997.
202
202
  #
203
203
  class IMAP < Protocol
204
- VERSION = "0.2.0"
204
+ VERSION = "0.2.1"
205
205
 
206
206
  include MonitorMixin
207
207
  if defined?(OpenSSL::SSL)
@@ -229,6 +229,9 @@ module Net
229
229
  # it raises a Net::OpenTimeout exception. The default value is 30 seconds.
230
230
  attr_reader :open_timeout
231
231
 
232
+ # Seconds to wait until an IDLE response is received.
233
+ attr_reader :idle_response_timeout
234
+
232
235
  # The thread to receive exceptions.
233
236
  attr_accessor :client_thread
234
237
 
@@ -1056,7 +1059,7 @@ module Net
1056
1059
  unless @receiver_thread_terminating
1057
1060
  remove_response_handler(response_handler)
1058
1061
  put_string("DONE#{CRLF}")
1059
- response = get_tagged_response(tag, "IDLE")
1062
+ response = get_tagged_response(tag, "IDLE", @idle_response_timeout)
1060
1063
  end
1061
1064
  end
1062
1065
  end
@@ -1142,6 +1145,7 @@ module Net
1142
1145
  # If options[:ssl] is a hash, it's passed to
1143
1146
  # OpenSSL::SSL::SSLContext#set_params as parameters.
1144
1147
  # open_timeout:: Seconds to wait until a connection is opened
1148
+ # idle_response_timeout:: Seconds to wait until an IDLE response is received
1145
1149
  #
1146
1150
  # The most common errors are:
1147
1151
  #
@@ -1171,6 +1175,7 @@ module Net
1171
1175
  @tag_prefix = "RUBY"
1172
1176
  @tagno = 0
1173
1177
  @open_timeout = options[:open_timeout] || 30
1178
+ @idle_response_timeout = options[:idle_response_timeout] || 5
1174
1179
  @parser = ResponseParser.new
1175
1180
  @sock = tcp_socket(@host, @port)
1176
1181
  begin
@@ -1294,10 +1299,19 @@ module Net
1294
1299
  end
1295
1300
  end
1296
1301
 
1297
- def get_tagged_response(tag, cmd)
1302
+ def get_tagged_response(tag, cmd, timeout = nil)
1303
+ if timeout
1304
+ deadline = Time.now + timeout
1305
+ end
1298
1306
  until @tagged_responses.key?(tag)
1299
1307
  raise @exception if @exception
1300
- @tagged_response_arrival.wait
1308
+ if timeout
1309
+ timeout = deadline - Time.now
1310
+ if timeout <= 0
1311
+ return nil
1312
+ end
1313
+ end
1314
+ @tagged_response_arrival.wait(timeout)
1301
1315
  end
1302
1316
  resp = @tagged_responses.delete(tag)
1303
1317
  case resp.name
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: net-imap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shugo Maeda
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-03-10 00:00:00.000000000 Z
11
+ date: 2021-03-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: net-protocol