vmail 1.4.9 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +1 -1
- data/lib/vmail.rb +4 -0
- data/lib/vmail.vim +7 -5
- data/lib/vmail/imap_client.rb +20 -2
- data/lib/vmail/version.rb +1 -1
- metadata +11 -6
data/README.markdown
CHANGED
@@ -463,7 +463,7 @@ vmail generates a few files in the current directory when it is running:
|
|
463
463
|
|
464
464
|
* `current_message.txt` holds the current message being shown. Not deleted on quit.
|
465
465
|
|
466
|
-
* `
|
466
|
+
* `sent-messages.txt` will contain copies of any messages you send from vmail
|
467
467
|
|
468
468
|
* `part.html` is created if you open an HTML mail part from vmail.
|
469
469
|
|
data/lib/vmail.rb
CHANGED
@@ -10,6 +10,10 @@ module Vmail
|
|
10
10
|
|
11
11
|
def start
|
12
12
|
puts "Starting vmail #{Vmail::VERSION}"
|
13
|
+
if Gem::Version.new("1.9.0") > Gem::Version.new(RUBY_VERSION)
|
14
|
+
puts "This version of vmail requires Ruby version 1.9.0 or higher (1.9.2 is recommended)"
|
15
|
+
exit
|
16
|
+
end
|
13
17
|
|
14
18
|
vim = ENV['VMAIL_VIM'] || 'vim'
|
15
19
|
ENV['VMAIL_BROWSER'] ||= if RUBY_PLATFORM.downcase.include?('linux')
|
data/lib/vmail.vim
CHANGED
@@ -574,6 +574,8 @@ func! s:open_compose_window(command)
|
|
574
574
|
let res = system(a:command)
|
575
575
|
split compose_message.txt
|
576
576
|
setlocal modifiable
|
577
|
+
" TODO maybe later save backups?
|
578
|
+
setlocal buftype=nowrite
|
577
579
|
if winnr('$') > 1
|
578
580
|
wincmd p
|
579
581
|
close!
|
@@ -584,7 +586,6 @@ func! s:open_compose_window(command)
|
|
584
586
|
call s:compose_window_mappings()
|
585
587
|
setlocal completefunc=CompleteContact
|
586
588
|
normal 1G
|
587
|
-
write!
|
588
589
|
endfunc
|
589
590
|
|
590
591
|
func! s:turn_into_compose_window()
|
@@ -629,11 +630,12 @@ endfunc
|
|
629
630
|
function! s:send_message()
|
630
631
|
let mail = join(getline(1,'$'), "\n")
|
631
632
|
echo "Sending message"
|
632
|
-
|
633
|
-
|
634
|
-
|
633
|
+
let res = system(s:deliver_command, mail)
|
634
|
+
if match(res, '^Failed') == -1
|
635
|
+
call s:close_and_focus_list_window()
|
636
|
+
endif
|
635
637
|
redraw
|
636
|
-
echom
|
638
|
+
echom substitute(res, '[\s\r\n]\+$', '', '')
|
637
639
|
endfunction
|
638
640
|
|
639
641
|
" --------------------------------------------------------------------------------
|
data/lib/vmail/imap_client.rb
CHANGED
@@ -663,6 +663,23 @@ EOF
|
|
663
663
|
str * DIVIDER_WIDTH
|
664
664
|
end
|
665
665
|
|
666
|
+
SENT_MESSAGES_FILE = "sent-messages.txt"
|
667
|
+
|
668
|
+
def format_sent_message(mail)
|
669
|
+
formatter = Vmail::MessageFormatter.new(mail)
|
670
|
+
message_text = <<-EOF
|
671
|
+
Sent Message #{self.format_parts_info(formatter.list_parts)}
|
672
|
+
|
673
|
+
#{format_headers(formatter.extract_headers)}
|
674
|
+
|
675
|
+
#{formatter.process_body}
|
676
|
+
EOF
|
677
|
+
end
|
678
|
+
|
679
|
+
def backup_sent_message(message)
|
680
|
+
File.open(SENT_MESSAGES_FILE, "a") {|f| f.write(divider('-') + "\n" + format_sent_message(message))}
|
681
|
+
end
|
682
|
+
|
666
683
|
def deliver(text)
|
667
684
|
# parse the text. The headers are yaml. The rest is text body.
|
668
685
|
require 'net/smtp'
|
@@ -673,9 +690,10 @@ EOF
|
|
673
690
|
log res.inspect
|
674
691
|
log "\n"
|
675
692
|
msg = if res.is_a?(Mail::Message)
|
676
|
-
|
693
|
+
backup_sent_message mail
|
694
|
+
"Message '#{mail.subject}' sent and saved to #{SENT_MESSAGES_FILE}"
|
677
695
|
else
|
678
|
-
"Failed to deliver message '#{mail.subject}'"
|
696
|
+
"Failed to deliver message '#{mail.subject}'!"
|
679
697
|
end
|
680
698
|
log msg
|
681
699
|
msg
|
data/lib/vmail/version.rb
CHANGED
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vmail
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 3
|
5
|
+
prerelease:
|
5
6
|
segments:
|
6
7
|
- 1
|
7
|
-
-
|
8
|
-
-
|
9
|
-
version: 1.
|
8
|
+
- 5
|
9
|
+
- 0
|
10
|
+
version: 1.5.0
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Daniel Choi
|
@@ -14,7 +15,7 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2011-02-
|
18
|
+
date: 2011-02-11 00:00:00 -05:00
|
18
19
|
default_executable:
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
@@ -25,6 +26,7 @@ dependencies:
|
|
25
26
|
requirements:
|
26
27
|
- - ">="
|
27
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 31
|
28
30
|
segments:
|
29
31
|
- 2
|
30
32
|
- 2
|
@@ -40,6 +42,7 @@ dependencies:
|
|
40
42
|
requirements:
|
41
43
|
- - ">="
|
42
44
|
- !ruby/object:Gem::Version
|
45
|
+
hash: 13
|
43
46
|
segments:
|
44
47
|
- 1
|
45
48
|
- 6
|
@@ -144,6 +147,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
144
147
|
requirements:
|
145
148
|
- - ">="
|
146
149
|
- !ruby/object:Gem::Version
|
150
|
+
hash: 3
|
147
151
|
segments:
|
148
152
|
- 0
|
149
153
|
version: "0"
|
@@ -152,13 +156,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
152
156
|
requirements:
|
153
157
|
- - ">="
|
154
158
|
- !ruby/object:Gem::Version
|
159
|
+
hash: 3
|
155
160
|
segments:
|
156
161
|
- 0
|
157
162
|
version: "0"
|
158
163
|
requirements: []
|
159
164
|
|
160
165
|
rubyforge_project: vmail
|
161
|
-
rubygems_version: 1.
|
166
|
+
rubygems_version: 1.4.1
|
162
167
|
signing_key:
|
163
168
|
specification_version: 3
|
164
169
|
summary: A Vim interface to Gmail
|