vmail 1.4.3 → 1.4.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -17,7 +17,8 @@ class ContactsExtractor
17
17
 
18
18
  def extract(limit = 500)
19
19
  open do |imap|
20
- mailbox = '[Gmail]/Sent Mail'
20
+ set_mailbox_prefix
21
+ mailbox = "[#@prefix]/Sent Mail"
21
22
  STDERR.puts "selecting #{mailbox}"
22
23
  imap.select(mailbox)
23
24
  STDERR.puts "fetching last #{limit} sent messages"
@@ -42,6 +43,11 @@ class ContactsExtractor
42
43
  end
43
44
  end
44
45
  end
46
+
47
+ def set_mailbox_prefix
48
+ mailboxes = ((@imap.list("[#@prefix]/", "%") || []) + (@imap.list("", "*")) || []).map {|struct| struct.name}
49
+ @prefix = mailboxes.detect {|m| m =~ /^\[Google Mail\]/} ? "Google Mail" : "Gmail"
50
+ end
45
51
  end
46
52
  end
47
53
 
@@ -1,3 +1,3 @@
1
1
  module Vmail
2
- VERSION = "1.4.3"
2
+ VERSION = "1.4.4"
3
3
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 4
8
- - 3
9
- version: 1.4.3
8
+ - 4
9
+ version: 1.4.4
10
10
  platform: ruby
11
11
  authors:
12
12
  - Daniel Choi