vmail 2.8.9 → 2.9.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/vmail/contacts_extractor.rb +6 -2
- data/lib/vmail/defaults.rb +13 -0
- data/lib/vmail/imap_client.rb +7 -8
- data/lib/vmail/options.rb +2 -1
- data/lib/vmail/version.rb +1 -1
- metadata +3 -3
@@ -1,10 +1,14 @@
|
|
1
1
|
require 'net/imap'
|
2
|
+
require 'vmail/defaults'
|
2
3
|
|
3
4
|
module Vmail
|
4
5
|
class ContactsExtractor
|
5
|
-
def initialize(username, password)
|
6
|
+
def initialize(username, password, mailbox_config)
|
6
7
|
puts "Logging as #{username}"
|
7
8
|
@username, @password = username, password
|
9
|
+
|
10
|
+
@sent_mailbox = mailbox_config && mailbox_config['sent']
|
11
|
+
@sent_mailbox ||= Vmail::Defaults::MAILBOX_ALIASES['sent']
|
8
12
|
end
|
9
13
|
|
10
14
|
def open
|
@@ -18,7 +22,7 @@ class ContactsExtractor
|
|
18
22
|
def extract(limit = 500)
|
19
23
|
open do |imap|
|
20
24
|
set_mailbox_prefix
|
21
|
-
mailbox = "[#@prefix]
|
25
|
+
mailbox = "[#@prefix]/#@sent_mailbox"
|
22
26
|
STDERR.puts "Selecting #{mailbox}"
|
23
27
|
imap.select(mailbox)
|
24
28
|
STDERR.puts "Fetching last #{limit} sent messages"
|
data/lib/vmail/imap_client.rb
CHANGED
@@ -7,6 +7,7 @@ require 'net/imap'
|
|
7
7
|
require 'time'
|
8
8
|
require 'logger'
|
9
9
|
require 'tempfile'
|
10
|
+
require 'vmail/defaults'
|
10
11
|
require 'vmail/helpers'
|
11
12
|
require 'vmail/address_quoter'
|
12
13
|
require 'vmail/database'
|
@@ -53,6 +54,11 @@ module Vmail
|
|
53
54
|
@date_formatter_this_year = config['date_format'] || '%b %d %I:%M%P'
|
54
55
|
@date_formatter_prev_years = config['date_format_previous_years'] || '%b %d %Y'
|
55
56
|
@date_width = DateTime.parse("12/12/2012 12:12:12").strftime(@date_formatter_this_year).length
|
57
|
+
|
58
|
+
mailbox_aliases_config = config['mailbox_aliases'] || {}
|
59
|
+
@default_mailbox_aliases = Vmail::Defaults::MAILBOX_ALIASES.merge(
|
60
|
+
mailbox_aliases_config)
|
61
|
+
|
56
62
|
current_message = nil
|
57
63
|
end
|
58
64
|
|
@@ -172,15 +178,8 @@ module Vmail
|
|
172
178
|
# do this just once
|
173
179
|
def mailbox_aliases
|
174
180
|
return @mailbox_aliases if @mailbox_aliases
|
175
|
-
aliases = {"sent" => "Sent Mail",
|
176
|
-
"all" => "All Mail",
|
177
|
-
"starred" => "Starred",
|
178
|
-
"important" => "Important",
|
179
|
-
"drafts" => "Drafts",
|
180
|
-
"spam" => "Spam",
|
181
|
-
"trash" => "Trash"}
|
182
181
|
@mailbox_aliases = {}
|
183
|
-
|
182
|
+
@default_mailbox_aliases.each do |shortname, fullname|
|
184
183
|
[ "[Gmail]", "[Google Mail]" ].each do |prefix|
|
185
184
|
if self.mailboxes.include?( "#{prefix}/#{fullname}" )
|
186
185
|
@mailbox_aliases[shortname] = "#{prefix}/#{fullname}"
|
data/lib/vmail/options.rb
CHANGED
@@ -73,7 +73,8 @@ EOF
|
|
73
73
|
|
74
74
|
if @get_contacts
|
75
75
|
require 'vmail/contacts_extractor'
|
76
|
-
extractor = ContactsExtractor.new(@config['username'],
|
76
|
+
extractor = ContactsExtractor.new(@config['username'],
|
77
|
+
@config['password'], @config['mailbox_aliases'])
|
77
78
|
File.open(DEFAULT_CONTACTS_FILENAME, 'w') do |file|
|
78
79
|
extractor.extract(@max_messages_to_scan) do |address|
|
79
80
|
STDERR.print '.'
|
data/lib/vmail/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vmail
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.9.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-05-
|
12
|
+
date: 2014-05-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: mail
|
@@ -117,6 +117,7 @@ files:
|
|
117
117
|
- lib/vmail/address_quoter.rb
|
118
118
|
- lib/vmail/contacts_extractor.rb
|
119
119
|
- lib/vmail/database.rb
|
120
|
+
- lib/vmail/defaults.rb
|
120
121
|
- lib/vmail/flagging_and_moving.rb
|
121
122
|
- lib/vmail/helpers.rb
|
122
123
|
- lib/vmail/imap_client.rb
|
@@ -175,4 +176,3 @@ signing_key:
|
|
175
176
|
specification_version: 3
|
176
177
|
summary: A Vim interface to Gmail
|
177
178
|
test_files: []
|
178
|
-
has_rdoc:
|