vmail 2.5.8 → 2.5.9
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +19 -11
- data/lib/vmail.rb +17 -12
- data/lib/vmail/database.rb +16 -0
- data/lib/vmail/imap_client.rb +1 -0
- data/lib/vmail/showing_message.rb +3 -2
- data/lib/vmail/version.rb +1 -1
- metadata +2 -2
data/README.markdown
CHANGED
@@ -43,7 +43,10 @@ problem, and mention what system you're using. You might want to try
|
|
43
43
|
|
44
44
|
sudo gem install vmail
|
45
45
|
|
46
|
-
to see if that puts `vmail` on your PATH.
|
46
|
+
to see if that puts `vmail` on your PATH. (If you're using [rbenv], running
|
47
|
+
`rbenv rehash` should do the trick.)
|
48
|
+
|
49
|
+
[rbenv]: https://github.com/sstephenson/rbenv
|
47
50
|
|
48
51
|
Vmail is evolving rapidly. To update to the latest version, simply run the
|
49
52
|
installation command again.
|
@@ -59,9 +62,9 @@ during execution (see below).
|
|
59
62
|
|
60
63
|
## Configuration file
|
61
64
|
|
62
|
-
To run Vmail, create a yaml file called `.vmailrc` and save it either in
|
63
|
-
|
64
|
-
|
65
|
+
To run Vmail, create a yaml file called `.vmailrc` and save it either in
|
66
|
+
~/.vmail/defaults/ or in your home directory. If you do the latter,
|
67
|
+
Vmail will move the file to ~/.vmail/defaults/ when it starts up.
|
65
68
|
|
66
69
|
The `.vmailrc` file should look something like this. Substitute your own values.
|
67
70
|
|
@@ -110,11 +113,11 @@ configuration options][firewall] that you can use.
|
|
110
113
|
## Contacts autocompletion
|
111
114
|
|
112
115
|
Vmail uses Vim autocompletion to help you auto-complete email addresses.
|
113
|
-
To use this feature, generate a `vmail-contacts.txt` file
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
116
|
+
To use this feature, generate a `vmail-contacts.txt` file. This is a
|
117
|
+
simple list of your email contacts. Invoking Vmail with the `-g` option
|
118
|
+
generates this file for you by collecting all the recipients and cc's
|
119
|
+
from your last 500 sent emails. You can adjust this number by using `-g`
|
120
|
+
with a number argument.
|
118
121
|
|
119
122
|
After Vmail generates this file for you, you can edit it however and whenever
|
120
123
|
you want, as long as there is one address per line.
|
@@ -463,9 +466,10 @@ invoke Vmail will show Vmail's logging output while MacVim is running. To quit
|
|
463
466
|
Vmail, first quit the MacVim window running Vmail, and then press CTRL-c in the
|
464
467
|
original terminal window to stop the Vmail process.
|
465
468
|
|
466
|
-
##
|
469
|
+
## Alternate VMAIL_HOME working directories
|
467
470
|
|
468
|
-
Vmail generates a
|
471
|
+
Vmail generates a directory called ~/.vmail/defaults and uses this as
|
472
|
+
the default `VMAIL_HOME`. Vmail places these files in it:
|
469
473
|
|
470
474
|
* `vmail.db` is a sqlite3 database. Vmail uses this to cache messages it has seen..
|
471
475
|
|
@@ -479,6 +483,10 @@ Finally, Vmail logs output to a `vmail.log` file which it creates in the
|
|
479
483
|
current directory. You can tail this file in a separate terminal window to see
|
480
484
|
what's going on behind the scenes as you use Vmail.
|
481
485
|
|
486
|
+
You can use up other working directories by setting the `VMAIL_HOME`
|
487
|
+
environment variable before or when you launch Vmail. Make sure you
|
488
|
+
place a `.vmailrc` configuration in that directory.
|
489
|
+
|
482
490
|
## Is my Gmail password secure?
|
483
491
|
|
484
492
|
In short, yes. Vmail uses TLS ([Transport Layer Security][tls]) to perform IMAP
|
data/lib/vmail.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
require 'vmail/version'
|
2
2
|
require 'vmail/options'
|
3
|
-
require 'vmail/imap_client'
|
4
3
|
require 'vmail/query'
|
5
4
|
require 'vmail/message_formatter'
|
6
5
|
|
@@ -16,17 +15,6 @@ module Vmail
|
|
16
15
|
exit
|
17
16
|
end
|
18
17
|
|
19
|
-
# check database version
|
20
|
-
print "Checking vmail.db version... "
|
21
|
-
db = Sequel.connect 'sqlite://vmail.db'
|
22
|
-
if (r = db[:version].first) && r[:vmail_version] != Vmail::VERSION
|
23
|
-
print "Vmail database version is outdated. Recreating.\n"
|
24
|
-
`rm vmail.db`
|
25
|
-
`sqlite3 vmail.db < #{CREATE_TABLE_SCRIPT}`
|
26
|
-
else
|
27
|
-
print "OK\n"
|
28
|
-
end
|
29
|
-
|
30
18
|
vim = ENV['VMAIL_VIM'] || 'vim'
|
31
19
|
ENV['VMAIL_BROWSER'] ||= if RUBY_PLATFORM.downcase.include?('linux')
|
32
20
|
tools = ['gnome-open', 'kfmclient-exec', 'xdg-open', 'konqueror']
|
@@ -45,6 +33,18 @@ module Vmail
|
|
45
33
|
puts "Setting VMAIL_BROWSER to '#{ENV['VMAIL_BROWSER']}'"
|
46
34
|
check_lynx
|
47
35
|
|
36
|
+
working_dir = ENV['VMAIL_HOME'] || "#{ENV['HOME']}/.vmail/default"
|
37
|
+
`mkdir -p #{working_dir}`
|
38
|
+
# legacy migration: move files into VMAIL_HOME
|
39
|
+
['.vmailrc', 'vmail.log', 'vmail.db', 'vmail-contacts.txt', 'compose_message.txt', 'attachments'].each do |x|
|
40
|
+
if File.size?(x)
|
41
|
+
c = "mv #{x} #{working_dir}"
|
42
|
+
puts c
|
43
|
+
%x{#{c}}
|
44
|
+
end
|
45
|
+
end
|
46
|
+
puts "Changing working directory to #{working_dir}"
|
47
|
+
Dir.chdir(working_dir)
|
48
48
|
opts = Vmail::Options.new(ARGV)
|
49
49
|
opts.config
|
50
50
|
config = opts.config
|
@@ -67,6 +67,11 @@ module Vmail
|
|
67
67
|
end
|
68
68
|
end
|
69
69
|
|
70
|
+
puts "WORKING DIR: #{Dir.pwd}"
|
71
|
+
|
72
|
+
# require after the working dir is set
|
73
|
+
require 'vmail/imap_client'
|
74
|
+
|
70
75
|
drb_uri = begin
|
71
76
|
Vmail::ImapClient.daemon config
|
72
77
|
rescue
|
data/lib/vmail/database.rb
CHANGED
@@ -1,12 +1,28 @@
|
|
1
1
|
require 'sequel'
|
2
2
|
|
3
|
+
# check database version
|
4
|
+
|
3
5
|
CREATE_TABLE_SCRIPT = File.expand_path("../../../db/create.sql", __FILE__)
|
6
|
+
print "Checking vmail.db version... "
|
7
|
+
db = Sequel.connect 'sqlite://vmail.db'
|
8
|
+
if db.tables.include?(:version) &&
|
9
|
+
(r = db[:version].first) &&
|
10
|
+
r[:vmail_version] != Vmail::VERSION
|
11
|
+
|
12
|
+
print "Vmail database version is outdated. Recreating.\n"
|
13
|
+
`rm vmail.db`
|
14
|
+
`sqlite3 vmail.db < #{CREATE_TABLE_SCRIPT}`
|
15
|
+
else
|
16
|
+
print "OK\n"
|
17
|
+
end
|
18
|
+
db.disconnect
|
4
19
|
|
5
20
|
if !File.size?('vmail.db')
|
6
21
|
puts `sqlite3 vmail.db < #{CREATE_TABLE_SCRIPT}`
|
7
22
|
end
|
8
23
|
|
9
24
|
DB = Sequel.connect 'sqlite://vmail.db'
|
25
|
+
puts "Connecting to database"
|
10
26
|
|
11
27
|
if DB[:version].count == 0
|
12
28
|
DB[:version].insert(:vmail_version => Vmail::VERSION)
|
data/lib/vmail/imap_client.rb
CHANGED
@@ -61,8 +61,9 @@ module Vmail
|
|
61
61
|
headers = format_headers headers_hash
|
62
62
|
# replace the date value with the one derived from the envelope
|
63
63
|
body = formatter.plaintext_part
|
64
|
-
|
65
|
-
body
|
64
|
+
conv_from = /charset=(.*)\s/.match(parts_list)[1].strip
|
65
|
+
body.force_encoding conv_from
|
66
|
+
body = body.encode!('utf-8', undef: :replace, invalid: :replace)
|
66
67
|
message_text = <<-EOF
|
67
68
|
#{message_id} #{number_to_human_size message.size} #{message.flags} #{parts_list}
|
68
69
|
#{divider '-'}
|
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.5.
|
4
|
+
version: 2.5.9
|
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: 2012-
|
12
|
+
date: 2012-12-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: mail
|