vmail 2.3.5 → 2.3.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -68,6 +68,16 @@ function! s:create_message_window()
68
68
  close
69
69
  endfunction
70
70
 
71
+ function! s:system_with_error_handling(command)
72
+ let res = system(a:command)
73
+ if res =~ 'VMAIL_ERROR'
74
+ echoe "ERROR" res
75
+ return ""
76
+ else
77
+ return res
78
+ end
79
+ endfunction
80
+
71
81
  function! s:show_message(stay_in_message_list)
72
82
  let line = getline(line("."))
73
83
  if match(line, '^> Load') != -1
@@ -94,7 +104,7 @@ function! s:show_message(stay_in_message_list)
94
104
  let command = s:show_message_command . s:uid
95
105
  echom "Loading message ". s:uid .". Please wait..."
96
106
  redrawstatus
97
- let res = system(command)
107
+ let res = s:system_with_error_handling(command)
98
108
  call s:focus_message_window()
99
109
  set modifiable
100
110
  1,$delete
@@ -166,7 +176,7 @@ function! s:show_raw()
166
176
  echo command
167
177
  setlocal modifiable
168
178
  1,$delete
169
- let res = system(command)
179
+ let res = s:system_with_error_handling(command)
170
180
  put =res
171
181
  1delete
172
182
  normal 1G
@@ -215,7 +225,7 @@ endfunc
215
225
  function! s:update()
216
226
  let command = s:update_command
217
227
  echo "Checking for new messages. Please wait..."
218
- let res = system(command)
228
+ let res = s:system_with_error_handling(command)
219
229
  let lines = split(res, '\n')
220
230
  if len(lines) > 0
221
231
  setlocal modifiable
@@ -249,7 +259,7 @@ function! s:toggle_star() range
249
259
  echom "Toggling flags on " . nummsgs . " messages"
250
260
  endif
251
261
  " toggle * on lines
252
- let res = system(command)
262
+ let res = s:system_with_error_handling(command)
253
263
  setlocal modifiable
254
264
  let lnum = a:firstline
255
265
  while lnum <= a:lastline
@@ -284,7 +294,7 @@ func! s:delete_messages(flag) range
284
294
  else
285
295
  echom "Deleting " . nummsgs . " messages"
286
296
  endif
287
- let res = system(command)
297
+ let res = s:system_with_error_handling(command)
288
298
  setlocal modifiable
289
299
  exec "silent " . a:firstline . "," . a:lastline . "delete"
290
300
  setlocal nomodifiable
@@ -298,7 +308,7 @@ func! s:archive_messages() range
298
308
  let nummsgs = len(uid_set)
299
309
  let command = s:move_to_command . shellescape(join(uid_set, ',')) . ' ' . "all"
300
310
  echo "Archiving message" . (nummsgs == 1 ? '' : 's')
301
- let res = system(command)
311
+ let res = s:system_with_error_handling(command)
302
312
  setlocal modifiable
303
313
  exec "silent " . a:firstline . "," . a:lastline . "delete"
304
314
  setlocal nomodifiable
@@ -321,7 +331,7 @@ func! s:append_messages_to_file() range
321
331
  let s:append_file = append_file
322
332
  let command = s:append_to_file_command . shellescape(join(uid_set, ',')) . ' ' . s:append_file
323
333
  echo "Appending " . nummsgs . " message" . (nummsgs == 1 ? '' : 's') . " to " . s:append_file . ". Please wait..."
324
- let res = system(command)
334
+ let res = s:system_with_error_handling(command)
325
335
  echo res
326
336
  redraw
327
337
  endfunc
@@ -365,7 +375,7 @@ function! s:complete_move_to_mailbox()
365
375
  endif
366
376
  redraw
367
377
  echo "Moving uids ". s:uid_set . " to mailbox " . mailbox
368
- let res = system(command)
378
+ let res = s:system_with_error_handling(command)
369
379
  setlocal modifiable
370
380
  if !s:copy_to_mailbox
371
381
  exec "silent " . s:firstline . "," . s:lastline . "delete"
@@ -408,7 +418,7 @@ function! s:get_mailbox_list()
408
418
  let command = s:list_mailboxes_command
409
419
  redraw
410
420
  echo command
411
- let res = system(command)
421
+ let res = s:system_with_error_handling(command)
412
422
  let s:mailboxes = split(res, "\n", '')
413
423
  endfunction
414
424
 
@@ -469,16 +479,16 @@ function! s:select_mailbox()
469
479
  let command = s:select_mailbox_command . shellescape(s:mailbox)
470
480
  redraw
471
481
  echom "Selecting mailbox: ". s:mailbox . ". Please wait..."
472
- call system(command)
482
+ call s:system_with_error_handling(command)
473
483
  redraw
474
484
  " reset window width now
475
- call system(s:set_window_width_command . winwidth(1))
485
+ call s:system_with_error_handling(s:set_window_width_command . winwidth(1))
476
486
  " now get latest 100 messages
477
487
  call s:focus_list_window()
478
488
  setlocal modifiable
479
489
  let command = s:search_command . shellescape("all")
480
490
  echo "Loading messages..."
481
- let res = system(command)
491
+ let res = s:system_with_error_handling(command)
482
492
  silent 1,$delete
483
493
  silent! put! =res
484
494
  execute "normal Gdd\<c-y>"
@@ -510,7 +520,7 @@ function! s:do_search()
510
520
  call s:focus_list_window()
511
521
  setlocal modifiable
512
522
  echo "Running query on " . s:mailbox . ": " . s:query . ". Please wait..."
513
- let res = system(command)
523
+ let res = s:system_with_error_handling(command)
514
524
  silent! 1,$delete
515
525
  silent! put! =res
516
526
  execute "silent normal Gdd\<c-y>"
@@ -522,7 +532,7 @@ endfunction
522
532
  function! s:more_messages()
523
533
  let command = s:more_messages_command
524
534
  echo "Fetching more messages. Please wait..."
525
- let res = system(command)
535
+ let res = s:system_with_error_handling(command)
526
536
  setlocal modifiable
527
537
  let lines = split(res, "\n")
528
538
  call append(line('$'), lines)
@@ -564,7 +574,7 @@ endfunction
564
574
  func! s:open_compose_window(command)
565
575
  redraw
566
576
  echo a:command
567
- let res = system(a:command)
577
+ let res = s:system_with_error_handling(a:command)
568
578
  let previous_winnr = winnr()
569
579
  only
570
580
  split compose_message.txt
@@ -606,7 +616,7 @@ function! CompleteContact(findstart, base)
606
616
  " '\(^ho\|<ho\)'
607
617
  " let regex = shellescape('\(^' . a:base . '\|<' . a:base . '\)')
608
618
  let regex = shellescape(a:base)
609
- let matches = system("grep -i " . regex . " " . $VMAIL_CONTACTS_FILE)
619
+ let matches = s:system_with_error_handling("grep -i " . regex . " " . $VMAIL_CONTACTS_FILE)
610
620
  return split(matches, "\n")
611
621
  endif
612
622
  endfun
@@ -622,7 +632,7 @@ endfunc
622
632
  function! s:send_message()
623
633
  let mail = join(getline(1,'$'), "\n")
624
634
  echo "Sending message"
625
- let res = system(s:deliver_command, mail)
635
+ let res = s:system_with_error_handling(s:deliver_command, mail)
626
636
  if match(res, '^Failed') == -1
627
637
  write!
628
638
  call s:close_and_focus_list_window()
@@ -637,7 +647,7 @@ endfunction
637
647
  func! s:open_html_part()
638
648
  let command = s:open_html_part_command
639
649
  " the command saves the html part to a local file
640
- let outfile = system(command)
650
+ let outfile = s:system_with_error_handling(command)
641
651
  " todo: allow user to change open in browser command?
642
652
  exec "!" . s:browser_command . ' ' . outfile
643
653
  endfunc
@@ -648,7 +658,7 @@ func! s:save_attachments()
648
658
  end
649
659
  let s:savedir = input("save attachments to directory: ", s:savedir, "dir")
650
660
  let command = s:save_attachments_command . s:savedir
651
- let res = system(command)
661
+ let res = s:system_with_error_handling(command)
652
662
  echo res
653
663
  endfunc
654
664
 
@@ -686,7 +696,7 @@ func! s:open_href(all) range
686
696
  let href = matchstr(getline(lnum), pattern)
687
697
  if href != ""
688
698
  let command = s:browser_command ." ".shellescape(href)." &"
689
- call system(command)
699
+ call s:system_with_error_handling(command)
690
700
  let n += 1
691
701
  endif
692
702
  let lnum += 1
@@ -699,7 +709,7 @@ func! s:open_href(all) range
699
709
  while line
700
710
  let href = matchstr(getline(line('.')), pattern)
701
711
  let command = s:browser_command ." ".shellescape(href)." &"
702
- call system(command)
712
+ call s:system_with_error_handling(command)
703
713
  let n += 1
704
714
  let line = search('https\?:', 'W')
705
715
  endwhile
@@ -707,7 +717,7 @@ func! s:open_href(all) range
707
717
  else
708
718
  let href = matchstr(getline(line('.')), pattern)
709
719
  let command = s:browser_command ." ".shellescape(href)." &"
710
- call system(command)
720
+ call s:system_with_error_handling(command)
711
721
  echom 'opened '.href
712
722
  endif
713
723
  endfunc
@@ -726,8 +736,8 @@ endfunc
726
736
  " HELP
727
737
  func! s:show_help()
728
738
  let command = s:browser_command . ' ' . shellescape('http://danielchoi.com/software/vmail.html')
729
- call system(command)
730
- "let helpfile = system(s:show_help_command)
739
+ call s:system_with_error_handling(command)
740
+ "let helpfile = s:system_with_error_handling(s:show_help_command)
731
741
  "exec "split " . helpfile
732
742
  endfunc
733
743
 
@@ -889,12 +899,12 @@ call s:create_message_window()
889
899
  call s:focus_list_window() " to go list window
890
900
 
891
901
  " send window width
892
- call system(s:set_window_width_command . winwidth(1))
902
+ call s:system_with_error_handling(s:set_window_width_command . winwidth(1))
893
903
 
894
- "autocmd VimResized <buffer> call system(s:set_window_width_command . winwidth(1))
904
+ "autocmd VimResized <buffer> call s:system_with_error_handling(s:set_window_width_command . winwidth(1))
895
905
 
896
906
  autocmd bufreadpost *.txt call <SID>turn_into_compose_window()
897
907
  normal G
898
- call system(s:select_mailbox_command . shellescape(s:mailbox))
908
+ call s:system_with_error_handling(s:select_mailbox_command . shellescape(s:mailbox))
899
909
  call s:do_search()
900
910
 
@@ -52,6 +52,9 @@ module Vmail
52
52
  @imap = Net::IMAP.new(@imap_server, @imap_port, true, nil, false)
53
53
  log @imap.login(@username, @password)
54
54
  list_mailboxes # prefetch mailbox list
55
+ raise
56
+ rescue
57
+ puts "VMAIL_ERROR: #{[$!.message, $!.backtrace].join("\n")}"
55
58
  end
56
59
 
57
60
  # expects a block, closes on finish
@@ -1,3 +1,3 @@
1
1
  module Vmail
2
- VERSION = '2.3.5'
2
+ VERSION = '2.3.6'
3
3
  end
metadata CHANGED
@@ -1,70 +1,94 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: vmail
3
- version: !ruby/object:Gem::Version
4
- version: 2.3.5
5
- prerelease:
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 2
7
+ - 3
8
+ - 6
9
+ version: 2.3.6
6
10
  platform: ruby
7
- authors:
11
+ authors:
8
12
  - Daniel Choi
9
13
  autorequire:
10
14
  bindir: bin
11
15
  cert_chain: []
12
- date: 2011-11-17 00:00:00.000000000Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
16
+
17
+ date: 2011-11-18 00:00:00 -05:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
15
21
  name: mail
16
- requirement: &82190190 !ruby/object:Gem::Requirement
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
17
24
  none: false
18
- requirements:
19
- - - ! '>='
20
- - !ruby/object:Gem::Version
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ segments:
29
+ - 2
30
+ - 2
31
+ - 12
21
32
  version: 2.2.12
22
33
  type: :runtime
23
- prerelease: false
24
- version_requirements: *82190190
25
- - !ruby/object:Gem::Dependency
34
+ version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
26
36
  name: highline
27
- requirement: &82189950 !ruby/object:Gem::Requirement
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
28
39
  none: false
29
- requirements:
30
- - - ! '>='
31
- - !ruby/object:Gem::Version
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ segments:
44
+ - 1
45
+ - 6
46
+ - 1
32
47
  version: 1.6.1
33
48
  type: :runtime
34
- prerelease: false
35
- version_requirements: *82189950
36
- - !ruby/object:Gem::Dependency
49
+ version_requirements: *id002
50
+ - !ruby/object:Gem::Dependency
37
51
  name: sequel
38
- requirement: &82189700 !ruby/object:Gem::Requirement
52
+ prerelease: false
53
+ requirement: &id003 !ruby/object:Gem::Requirement
39
54
  none: false
40
- requirements:
41
- - - ! '>='
42
- - !ruby/object:Gem::Version
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ segments:
59
+ - 3
60
+ - 24
61
+ - 1
43
62
  version: 3.24.1
44
63
  type: :runtime
45
- prerelease: false
46
- version_requirements: *82189700
47
- - !ruby/object:Gem::Dependency
64
+ version_requirements: *id003
65
+ - !ruby/object:Gem::Dependency
48
66
  name: sqlite3
49
- requirement: &82189430 !ruby/object:Gem::Requirement
67
+ prerelease: false
68
+ requirement: &id004 !ruby/object:Gem::Requirement
50
69
  none: false
51
- requirements:
52
- - - ! '>='
53
- - !ruby/object:Gem::Version
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ segments:
74
+ - 1
75
+ - 3
76
+ - 3
54
77
  version: 1.3.3
55
78
  type: :runtime
56
- prerelease: false
57
- version_requirements: *82189430
79
+ version_requirements: *id004
58
80
  description: Manage your email with Vim
59
- email:
81
+ email:
60
82
  - dhchoi@gmail.com
61
- executables:
83
+ executables:
62
84
  - vmail
63
85
  - vmail_client
64
86
  - vmailsend
65
87
  extensions: []
88
+
66
89
  extra_rdoc_files: []
67
- files:
90
+
91
+ files:
68
92
  - .gitignore
69
93
  - MIT-LICENSE.txt
70
94
  - NOTES
@@ -112,28 +136,39 @@ files:
112
136
  - test/test_helper.rb
113
137
  - test/time_format_test.rb
114
138
  - vmail.gemspec
139
+ has_rdoc: true
115
140
  homepage: http://danielchoi.com/software/vmail.html
116
141
  licenses: []
142
+
117
143
  post_install_message:
118
144
  rdoc_options: []
119
- require_paths:
145
+
146
+ require_paths:
120
147
  - lib
121
- required_ruby_version: !ruby/object:Gem::Requirement
148
+ required_ruby_version: !ruby/object:Gem::Requirement
122
149
  none: false
123
- requirements:
124
- - - ! '>='
125
- - !ruby/object:Gem::Version
150
+ requirements:
151
+ - - ">="
152
+ - !ruby/object:Gem::Version
153
+ segments:
154
+ - 1
155
+ - 9
156
+ - 0
126
157
  version: 1.9.0
127
- required_rubygems_version: !ruby/object:Gem::Requirement
158
+ required_rubygems_version: !ruby/object:Gem::Requirement
128
159
  none: false
129
- requirements:
130
- - - ! '>='
131
- - !ruby/object:Gem::Version
132
- version: '0'
160
+ requirements:
161
+ - - ">="
162
+ - !ruby/object:Gem::Version
163
+ segments:
164
+ - 0
165
+ version: "0"
133
166
  requirements: []
167
+
134
168
  rubyforge_project: vmail
135
- rubygems_version: 1.8.11
169
+ rubygems_version: 1.3.7
136
170
  signing_key:
137
171
  specification_version: 3
138
172
  summary: A Vim interface to Gmail
139
173
  test_files: []
174
+