larch 1.1.0.dev.20100206 → 1.1.0.dev.20100208

Sign up to get free protection for your applications and to get access to all the features.
data/HISTORY CHANGED
@@ -30,6 +30,8 @@ Version 1.1.0 (git)
30
30
  --all-subscribed to copy messages from multiple source folders to a single
31
31
  destination folder.
32
32
  * More concise log messages to reduce visual clutter in the log.
33
+ * Monkeypatched Net::IMAP to fix broken response handling with certain server
34
+ responses, particularly when changing mailboxes on a Dovecot 1.2+ server.
33
35
  * Fixed encoding issues when creating mailboxes and getting mailbox lists.
34
36
  * Fixed incorrect case-sensitive treatment of the 'INBOX' folder name.
35
37
  * Fixed a bug in which Larch would try to copy flags that weren't supported on
data/lib/larch.rb CHANGED
@@ -9,6 +9,8 @@ require 'yaml'
9
9
  require 'sequel'
10
10
  require 'sequel/extensions/migration'
11
11
 
12
+ require 'larch/monkeypatch/net/imap'
13
+
12
14
  require 'larch/config'
13
15
  require 'larch/errors'
14
16
  require 'larch/imap'
@@ -0,0 +1,48 @@
1
+ # Monkeypatch Net::IMAP in Ruby <= 1.9.1 to fix broken response handling,
2
+ # particularly when changing mailboxes on a Dovecot 1.2+ server.
3
+ #
4
+ # This monkeypatch shouldn't be necessary in Ruby 1.9.2 and higher.
5
+
6
+ if RUBY_VERSION <= '1.9.1'
7
+ module Net # :nodoc:
8
+ class IMAP # :nodoc:
9
+ class ResponseParser # :nodoc:
10
+ private
11
+
12
+ # This monkeypatched method is the one included in Ruby 1.9 SVN trunk as
13
+ # of 2010-02-08.
14
+ def resp_text_code
15
+ @lex_state = EXPR_BEG
16
+ match(T_LBRA)
17
+ token = match(T_ATOM)
18
+ name = token.value.upcase
19
+ case name
20
+ when /\A(?:ALERT|PARSE|READ-ONLY|READ-WRITE|TRYCREATE|NOMODSEQ)\z/n
21
+ result = ResponseCode.new(name, nil)
22
+ when /\A(?:PERMANENTFLAGS)\z/n
23
+ match(T_SPACE)
24
+ result = ResponseCode.new(name, flag_list)
25
+ when /\A(?:UIDVALIDITY|UIDNEXT|UNSEEN)\z/n
26
+ match(T_SPACE)
27
+ result = ResponseCode.new(name, number)
28
+ else
29
+ token = lookahead
30
+ if token.symbol == T_SPACE
31
+ shift_token
32
+ @lex_state = EXPR_CTEXT
33
+ token = match(T_TEXT)
34
+ @lex_state = EXPR_BEG
35
+ result = ResponseCode.new(name, token.value)
36
+ else
37
+ result = ResponseCode.new(name, nil)
38
+ end
39
+ end
40
+ match(T_RBRA)
41
+ @lex_state = EXPR_RTEXT
42
+ return result
43
+ end
44
+ end
45
+
46
+ end
47
+ end
48
+ end
data/lib/larch/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module Larch
2
2
  APP_NAME = 'Larch'
3
- APP_VERSION = '1.1.0.dev.20100206'
3
+ APP_VERSION = '1.1.0.dev.20100208'
4
4
  APP_AUTHOR = 'Ryan Grove'
5
5
  APP_EMAIL = 'ryan@wonko.com'
6
6
  APP_URL = 'http://github.com/rgrove/larch/'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: larch
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0.dev.20100206
4
+ version: 1.1.0.dev.20100208
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Grove
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-02-06 00:00:00 -08:00
12
+ date: 2010-02-08 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -75,6 +75,7 @@ files:
75
75
  - lib/larch/imap/mailbox.rb
76
76
  - lib/larch/imap.rb
77
77
  - lib/larch/logger.rb
78
+ - lib/larch/monkeypatch/net/imap.rb
78
79
  - lib/larch/version.rb
79
80
  - lib/larch.rb
80
81
  has_rdoc: true