vmail 1.9.0 → 1.9.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -307,7 +307,7 @@ at the top of the message window:
307
307
  to: Daniel Choi <dhchoi@gmail.com>
308
308
  subject: attachment test
309
309
 
310
- see attached
310
+ Hi Dan, please see attached
311
311
 
312
312
  To download these attachments to a local directory, type `,A`. You'll be
313
313
  prompted for a directory path. Then Vmail will save all the attachments in the
@@ -320,18 +320,24 @@ composition window:
320
320
  to: barackobama@whitehouse.gov
321
321
  subject: look at this!
322
322
 
323
- attach:
324
- - images/middle-east-map.png
325
- - images/policypaper.pdf
326
- - docs/
323
+ attach: images/middle-east-map.png
324
+ attach: images/policypaper.pdf
325
+ attach: docs/
327
326
 
328
327
  I think you'll find this stuff interesting.
329
328
 
330
-
331
- The `attach:` block is a YAML list. The items are paths (either relative to the
329
+ The items following the `attach:` directives are paths (either relative to the
332
330
  current directory or absolute) to the files you want to attach to your message.
333
331
  Note that you can also specify a directory, in which case Vmail attaches every
334
- file it finds in that directory.
332
+ file it finds in that directory. Make sure that you
333
+
334
+ * keep the `attach:` lines contiguous (no intervening empty lines) if you want to add multiple attachments
335
+ * insert an empty line before the attachments section
336
+ * insert an empty after the attachments section
337
+
338
+ You don't have to type the `attach:` directives manually. You can use the
339
+ command `:VMAttach [filename-or-path]` to insert a `attach:` directive with
340
+ the help of file auto-completion.
335
341
 
336
342
  One thing Vmail doesn't do yet is let you forward a message with all its
337
343
  attachments intact. This feature will be implemented in the near future.
@@ -655,6 +655,15 @@ func! s:save_attachments()
655
655
  let res = system(command)
656
656
  echo res
657
657
  endfunc
658
+
659
+ func! s:attach_file(file)
660
+ normal gg
661
+ normal }
662
+ let attach = "attach: " . a:file
663
+ put =attach
664
+ endfunc
665
+
666
+
658
667
  " --------------------------------------------------------------------------------
659
668
 
660
669
  func! s:toggle_maximize_window()
@@ -824,6 +833,7 @@ func! s:compose_window_mappings()
824
833
  setlocal ai
825
834
  " setlocal textwidth=72
826
835
  autocmd CursorMoved <buffer> call <SID>toggle_textwidth()
836
+ command! -bar -nargs=1 -complete=file VMAttach call s:attach_file(<f-args>)
827
837
  endfunc
828
838
 
829
839
  func! s:global_mappings()
@@ -370,9 +370,9 @@ EOF
370
370
  mail.charset = 'UTF-8'
371
371
  # attachments are added as a snippet of YAML after a blank line
372
372
  # after the headers, and followed by a blank line
373
- if (attachments = raw_body.split(/\n\s*\n/, 2)[0]) =~ /^attach(ment|ments)*:/
374
- files = YAML::load(attachments).values.flatten
375
- log "Attach: #{files}"
373
+ if (attachments_section = raw_body.split(/\n\s*\n/, 2)[0]) =~ /^attach(ment|ments)*:/
374
+ files = attachments_section.split(/\n/).map {|line| line[/[-:]\s*(.*)\s*$/, 1]}.compact
375
+ log "Attach: #{files.inspect}"
376
376
  files.each do |file|
377
377
  if File.directory?(file)
378
378
  Dir.glob("#{file}/*").each {|f| mail.add_file(f) if File.size?(f)}
@@ -1,3 +1,3 @@
1
1
  module Vmail
2
- VERSION = '1.9.0'
2
+ VERSION = '1.9.1'
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: vmail
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.9.0
5
+ version: 1.9.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Daniel Choi