5 confdir = ENV['HOME'] + '/settings/mailvisa'
6 $ignorespamheaders = true
11 def remove_stream words, stream
13 next if line[0,6] == 'X-Spam'
14 tokenize(line).each do |word|
15 next if word.length > 40
23 words[word] = count - 1
29 usage = 'USAGE: ' + $0 + ' [options] <wordlist> [<message> ...]'
34 -c <path> Look for configuration files in <path>
35 (default: $HOME/settings/mailvisa)
36 -i Include X-Spam headers in analysis
41 ## Process command line
53 $stderr.puts 'Invalid option: ' + ARGV[i]
59 messages = ARGV[i..-1]
66 $stderr.puts 'No wordlist specified'
71 filename = confdir + '/' + filename if filename.index('/') == nil
76 print filename + ' not found, will create new file'
81 $stderr.print "Loading #{filename}..."
82 wordlist = load_wordlist fh
84 words = wordlist[:words]
85 message_count = wordlist[:messages]
86 $stderr.puts words.length.to_s + ' words loaded'
92 if messages.length > 0
94 $stderr.puts "Removing #{x}"
96 remove_stream words, fh
98 message_count = message_count - 1
101 remove_stream words, $stdin
102 message_count = message_count - 1
106 message_count = 0 if message_count < 0
109 :messages => message_count,
113 $stderr.print "Writing #{filename}..."
114 fh = open filename, 'w'
115 dump_wordlist wordlist, fh