mail_room 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/mail_room/mailbox_watcher.rb +15 -1
- data/lib/mail_room/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 12f1281c4daadee7a741b0d9cf55eb4b1592a42f
|
4
|
+
data.tar.gz: a46e8058fa97d38c6a63903994d34954588247c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f1cdbd850515534f5d3c504bc4453a522be6f190276235f92914641c63e2dab8da47d30290b49ea70dc6fa99e45ded4cc404a2c6d16bcaf4e76a489240fe85c7
|
7
|
+
data.tar.gz: c78b9a59fe28fedd44a042bee256c9aca38d4beb5cf7960e86aa511ba72ecd2487f8ad49b5c406469496dcedfdcb2ff9ccad37d221375ad9ac03a965e2001643
|
data/CHANGELOG.md
CHANGED
@@ -4,7 +4,7 @@ module MailRoom
|
|
4
4
|
# Watch a Mailbox
|
5
5
|
# @author Tony Pitale
|
6
6
|
class MailboxWatcher
|
7
|
-
attr_accessor :idling_thread
|
7
|
+
attr_accessor :idling_thread, :timeout_thread
|
8
8
|
|
9
9
|
# Watch a new mailbox
|
10
10
|
# @param mailbox [MailRoom::Mailbox] the mailbox to watch
|
@@ -94,8 +94,20 @@ module MailRoom
|
|
94
94
|
|
95
95
|
@idling = true
|
96
96
|
|
97
|
+
self.timeout_thread = Thread.start do
|
98
|
+
# The IMAP server will close the connection after 30 minutes of inactivity
|
99
|
+
# (which sending IDLE and then nothing technically is), so we re-idle every
|
100
|
+
# 29 minutes, as suggested by the spec: https://tools.ietf.org/html/rfc2177
|
101
|
+
sleep 29 * 60
|
102
|
+
|
103
|
+
imap.idle_done if idling?
|
104
|
+
end
|
105
|
+
timeout_thread.abort_on_exception = true
|
106
|
+
|
97
107
|
imap.idle(&idle_handler)
|
98
108
|
ensure
|
109
|
+
timeout_thread.kill if timeout_thread
|
110
|
+
self.timeout_thread = nil
|
99
111
|
@idling = false
|
100
112
|
end
|
101
113
|
|
@@ -104,7 +116,9 @@ module MailRoom
|
|
104
116
|
return unless idling?
|
105
117
|
|
106
118
|
imap.idle_done
|
119
|
+
|
107
120
|
idling_thread.join
|
121
|
+
self.idling_thread = nil
|
108
122
|
end
|
109
123
|
|
110
124
|
# run the mailbox watcher
|
data/lib/mail_room/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mail_room
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tony Pitale
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|