[ruby-list:50570] Re: IMAP IDLE
From:
emo@...
Date:
2017-08-31 05:00:19 UTC
List:
ruby-list #50570
On 2017/08/31 10:06, Shugo Maeda wrote:
>>> continue_reqはContinuationRequestを返すことが期待されているので、上記の修正では
>>> 問題が起きるかもしれません。
>>>
>>
>> とりあえずは、今回の目的だけ達成すれば良いので、
>> これで動かしています。
>
> 上記の修正をしないとどのような問題があったでしょうか?
> すでにtrunkでは上記の修正を適用していますので、問題があるのであれば修正して
> おきたいと思います。
>
9 class Net::IMAP::ResponseParser
10 def continue_req
11 match(T_PLUS)
12 token = lookahead
13 if token.symbol == T_SPACE
14 shift_token
15 return ContinuationRequest.new(resp_text, @str)
16 else
17 return ContinuationRequest.new(ResponseText.new(nil, ""),
@str)
18 #return T_PLUS
19 end
20 end
21 end
...
...
48 unless imap
49 imap = Net::IMAP.new(imap_host, imap_port, imap_usessl)
50 imap.login(imap_user, imap_passwd)
51 imap.examine('INBOX')
52 count = 0
53 end
54
55 newmail = false
56 imap.idle(300) do |resp|
57 if resp.name == "EXISTS"
58 last_id = resp.data
..
...
上記のようなコードを実行しているのですが、
教えていただいたコードのままだと、以下のような例外が
送出されます。
% ./check_mail.rb
/usr/lib/ruby/2.3.0/net/imap.rb:962:in `block in idle'
/usr/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
/usr/lib/ruby/2.3.0/net/imap.rb:952:in `idle'
./check_mail.rb:56:in `<main>'connection closed: reconecting...
江本
Attachments (1)
smime.p7s
(3.91 KB, application/pkcs7-signature)