larch 1.1.0.dev.20091206 → 1.1.0.dev.20100120

Sign up to get free protection for your applications and to get access to all the features.
data/HISTORY CHANGED
@@ -12,6 +12,9 @@ Version 1.1.0 (git)
12
12
  command-line, Larch will use the options in that section for the session;
13
13
  otherwise it will use the options in the "default" section. See the README
14
14
  for more details.
15
+ * Added experimental support for Yahoo! Mail IMAP when connecting to
16
+ imap.mail.yahoo.com or imap-ssl.mail.yahoo.com. See the README for caveats
17
+ and known issues.
15
18
  * Folders are now copied recursively by default.
16
19
  * Progress information is now displayed regularly while scanning large
17
20
  mailboxes.
@@ -213,6 +213,10 @@ servers:
213
213
  * Gmail
214
214
  * Microsoft Exchange 2003
215
215
 
216
+ The following servers are known to work, but with caveats:
217
+
218
+ * Yahoo! Mail
219
+
216
220
  The following servers do not work well with Larch:
217
221
 
218
222
  * BlitzMail - Buggy server implementation; fails to properly quote or escape
@@ -258,6 +262,35 @@ such as " folder ". Gmail does not. When copying folders to Gmail, Larch will
258
262
  automatically remove leading and trailing whitespace in folder names to prevent
259
263
  errors.
260
264
 
265
+ === Yahoo! Mail Quirks
266
+
267
+ Yahoo! doesn't officially support IMAP access for general usage, but Larch is
268
+ able to connect to imap.mail.yahoo.com and imap-ssl.mail.yahoo.com by using a
269
+ fairly well-known trick. That said, as with anything tricky, there are caveats.
270
+
271
+ ==== No hierarchical folders
272
+
273
+ Similar to Gmail, Yahoo!'s IMAP gateway doesn't allow hierarchical (nested)
274
+ folders. If you try to copy a folder hierarchy to Yahoo!, it will work, but
275
+ you'll end up with a set of folders named "folder" and "folder.subfolder"
276
+ rather than seeing "subfolder" as an actual subfolder of "folder".
277
+
278
+ ==== No custom flags
279
+
280
+ Yahoo! Mail IMAP doesn't appear to support custom message flags, such as the
281
+ labels and junk/not junk flags used by Thunderbird. When transferring messages
282
+ with custom flags to a Yahoo! Mail IMAP account, the custom flags will be lost.
283
+ Also, Larch's <tt>sync-flags</tt> option will not work correctly if you have
284
+ messages with custom flags.
285
+
286
+ ==== Here there be dragons
287
+
288
+ Larch's support for Yahoo! Mail is very new and very lightly tested. Given its
289
+ newness and the fact that Yahoo!'s IMAP gateway isn't official, there are likely
290
+ to be other quirks we're not yet aware of. There's also no guarantee that Yahoo!
291
+ won't shut down its IMAP gateway, deprecate the trick Larch uses to connect, or
292
+ just outright block Larch. Use at your own risk.
293
+
261
294
  == Known Issues
262
295
 
263
296
  * Larch uses Ruby's Net::IMAP standard library for all IMAP operations. While
@@ -64,8 +64,10 @@ class IMAP
64
64
 
65
65
  @conn = nil
66
66
  @mailboxes = {}
67
+
67
68
  @quirks = {
68
- :gmail => false
69
+ :gmail => false,
70
+ :yahoo => false
69
71
  }
70
72
 
71
73
  @db_account = Database::Account.find_or_create(
@@ -99,7 +101,7 @@ class IMAP
99
101
 
100
102
  # Gets the server's mailbox hierarchy delimiter.
101
103
  def delim
102
- @delim ||= safely { @conn.list('', '')[0].delim }
104
+ @delim ||= safely { @conn.list('', '')[0].delim || '.'}
103
105
  end
104
106
 
105
107
  # Closes the IMAP connection if one is currently open.
@@ -258,6 +260,10 @@ class IMAP
258
260
  if @conn.greeting.data.text =~ /^Gimap ready/
259
261
  @quirks[:gmail] = true
260
262
  debug "looks like Gmail"
263
+
264
+ elsif host =~ /^imap(?:-ssl)?\.mail\.yahoo\.com$/
265
+ @quirks[:yahoo] = true
266
+ debug "looks like Yahoo! Mail"
261
267
  end
262
268
  end
263
269
 
@@ -312,6 +318,12 @@ class IMAP
312
318
 
313
319
  check_quirks
314
320
 
321
+ # If this is Yahoo! Mail, we have to send a special command before
322
+ # it'll let us authenticate.
323
+ if @quirks[:yahoo]
324
+ @conn.instance_eval { send_command('ID ("guid" "1")') }
325
+ end
326
+
315
327
  auth_methods = ['PLAIN']
316
328
  tried = []
317
329
  capability = @conn.capability
@@ -362,7 +374,7 @@ class IMAP
362
374
  name = Net::IMAP.decode_utf7(mb.name)
363
375
  name = 'INBOX' if name.downcase == 'inbox'
364
376
 
365
- @mailboxes[name] ||= Mailbox.new(self, name, mb.delim,
377
+ @mailboxes[name] ||= Mailbox.new(self, name, mb.delim || '.',
366
378
  subscribed.any?{|s| s.name == mb.name}, mb.attr)
367
379
  end
368
380
 
@@ -438,6 +438,7 @@ class Mailbox
438
438
 
439
439
  @imap.safely do
440
440
  begin
441
+ @imap.conn.close unless @state == :closed
441
442
  @state = :closed
442
443
 
443
444
  debug "examining mailbox"
@@ -466,6 +467,7 @@ class Mailbox
466
467
 
467
468
  @imap.safely do
468
469
  begin
470
+ @imap.conn.close unless @state == :closed
469
471
  @state = :closed
470
472
 
471
473
  debug "selecting mailbox"
@@ -1,6 +1,6 @@
1
1
  module Larch
2
2
  APP_NAME = 'Larch'
3
- APP_VERSION = '1.1.0.dev.20091206'
3
+ APP_VERSION = '1.1.0.dev.20100120'
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.20091206
4
+ version: 1.1.0.dev.20100120
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: 2009-12-06 00:00:00 -08:00
12
+ date: 2010-01-20 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -30,7 +30,7 @@ dependencies:
30
30
  requirements:
31
31
  - - ~>
32
32
  - !ruby/object:Gem::Version
33
- version: 3.6.0
33
+ version: "3.8"
34
34
  version:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: sqlite3-ruby