vmail 2.0.5 → 2.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/bin/vmail +4 -6
  2. data/lib/vmail.rb +0 -52
  3. data/lib/vmail/version.rb +1 -1
  4. metadata +1 -1
data/bin/vmail CHANGED
@@ -7,11 +7,9 @@ rescue LoadError
7
7
  require 'vmail'
8
8
  end
9
9
 
10
- if !STDOUT.tty?
11
- Vmail.noninteractive_list_messages
12
- elsif !STDIN.tty?
13
- Vmail.batch_run
14
- else
15
- Vmail.start
10
+ if !STDOUT.tty? || !STDIN.tty?
11
+ abort "Vmail non-interactive mode has been removed"
16
12
  end
17
13
 
14
+ Vmail.start
15
+
@@ -92,58 +92,6 @@ module Vmail
92
92
  exit
93
93
  end
94
94
 
95
- # non-interactive mode
96
- def noninteractive_list_messages
97
- check_lynx
98
- opts = Vmail::Options.new(ARGV)
99
- opts.config
100
- config = opts.config.merge 'logfile' => 'vmail.log'
101
- mailbox, query = parse_query
102
- query_string = Vmail::Query.args2string query
103
- imap_client = Vmail::ImapClient.new config
104
- imap_client.with_open do |vmail|
105
- vmail.select_mailbox mailbox
106
- vmail.search query_string
107
- end
108
- end
109
-
110
- # batch processing mode
111
- def batch_run
112
- check_lynx
113
- opts = Vmail::Options.new(ARGV)
114
- opts.config
115
- config = opts.config.merge 'logfile' => 'vmail.log'
116
- # no search query args, but command args
117
- imap_client = Vmail::ImapClient.new config
118
- lines = STDIN.readlines# .reverse
119
- mailbox = lines.shift.chomp
120
- puts "mailbox: #{mailbox}"
121
- uid_set = lines.map do |line|
122
- line[/(\d+)\s*$/,1].to_i
123
- end
124
- commands = {
125
- 'rm' => ["flag", "+FLAGS", "Deleted"],
126
- 'spam' => ["flag", "+FLAGS", "spam"],
127
- 'mv' => ["move_to"],
128
- 'cp' => ["copy_to"],
129
- 'print' => ["append_to_file"]
130
- }
131
- args = commands[ARGV.first]
132
- if args.nil?
133
- abort "Command '#{args.inspect}' not recognized"
134
- end
135
- command = args.shift
136
- imap_client.with_open do |vmail|
137
- puts "Selecting mailbox: #{mailbox}"
138
- vmail.select_mailbox mailbox
139
- uid_set.each_slice(5) do |uid_set|
140
- params = [uid_set.join(',')] + args + ARGV[1..-1]
141
- puts "Executing: #{command} #{params.join(' ')}"
142
- vmail.send command, *params
143
- end
144
- end
145
- end
146
-
147
95
  private
148
96
 
149
97
  def check_lynx
@@ -1,3 +1,3 @@
1
1
  module Vmail
2
- VERSION = '2.0.5'
2
+ VERSION = '2.0.6'
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: 2.0.5
5
+ version: 2.0.6
6
6
  platform: ruby
7
7
  authors:
8
8
  - Daniel Choi