vmail 1.4.3 → 1.4.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/vmail/contacts_extractor.rb +7 -1
- data/lib/vmail/version.rb +1 -1
- metadata +2 -2
@@ -17,7 +17,8 @@ class ContactsExtractor
|
|
17
17
|
|
18
18
|
def extract(limit = 500)
|
19
19
|
open do |imap|
|
20
|
-
|
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
|
|
data/lib/vmail/version.rb
CHANGED