sup 0.14.0 → 0.14.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of sup might be problematic. Click here for more details.
- data/CONTRIBUTORS +7 -7
- data/History.txt +5 -0
- data/ReleaseNotes +4 -0
- data/bin/sup +3 -3
- data/lib/sup.rb +3 -3
- data/lib/sup/account.rb +1 -1
- data/lib/sup/buffer.rb +5 -5
- data/lib/sup/crypto.rb +1 -1
- data/lib/sup/logger.rb +4 -1
- data/lib/sup/message.rb +2 -2
- data/lib/sup/modes/edit_message_mode.rb +9 -5
- data/lib/sup/modes/search_list_mode.rb +5 -1
- data/lib/sup/modes/search_results_mode.rb +5 -1
- data/lib/sup/search.rb +21 -2
- data/lib/sup/textfield.rb +1 -1
- data/lib/sup/util.rb +6 -6
- data/lib/sup/version.rb +1 -1
- metadata +8 -7
data/CONTRIBUTORS
CHANGED
@@ -25,44 +25,44 @@ Richard Brown <rbrown at the exherbo dot orgs>
|
|
25
25
|
Anthony Martinez <pi+sup at the pihost dot uss>
|
26
26
|
Marc Hartstein <marc.hartstein at the alum.vassar dot edus>
|
27
27
|
Israel Herraiz <israel.herraiz at the gmail dot coms>
|
28
|
+
Matthieu Rakotojaona <matthieu.rakotojaona at the gmail dot coms>
|
28
29
|
Bo Borgerson <gigabo at the gmail dot coms>
|
29
30
|
Michael Hamann <michael at the content-space dot des>
|
30
31
|
Jonathan Lassoff <jof at the thejof dot coms>
|
31
32
|
William Erik Baxter <web at the superscript dot coms>
|
32
33
|
Grant Hollingworth <grant at the antiflux dot orgs>
|
33
|
-
Markus Klinik <markus.klinik at the gmx dot des>
|
34
34
|
Ico Doornekamp <ico at the pruts dot nls>
|
35
|
+
Markus Klinik <markus.klinik at the gmx dot des>
|
35
36
|
Adeodato Simó <dato at the net.com.org dot ess>
|
36
37
|
Daniel Schoepe <daniel.schoepe at the googlemail dot coms>
|
37
38
|
Jason Petsod <jason at the petsod dot orgs>
|
38
39
|
Edward Z. Yang <edwardzyang at the thewritingpot dot coms>
|
39
|
-
Robin Burchell <viroteck at the viroteck dot nets>
|
40
40
|
Steve Goldman <sgoldman at the tower-research dot coms>
|
41
|
+
Robin Burchell <viroteck at the viroteck dot nets>
|
41
42
|
Peter Harkins <ph at the malaprop dot orgs>
|
42
43
|
Decklin Foster <decklin at the red-bean dot coms>
|
43
44
|
Cameron Matheson <cam+sup at the cammunism dot orgs>
|
44
45
|
Carl Worth <cworth at the cworth dot orgs>
|
45
46
|
Alex Vandiver <alex at the chmrr dot nets>
|
46
|
-
Andrew Pimlott <andrew at the pimlott dot nets>
|
47
47
|
Jeff Balogh <its.jeff.balogh at the gmail dot coms>
|
48
|
+
Andrew Pimlott <andrew at the pimlott dot nets>
|
48
49
|
Matías Aguirre <matiasaguirre at the gmail dot coms>
|
49
50
|
Kornilios Kourtis <kkourt at the cslab.ece.ntua dot grs>
|
50
51
|
Kevin Riggle <kevinr at the free-dissociation dot coms>
|
51
52
|
Giorgio Lando <patroclo7 at the gmail dot coms>
|
52
53
|
Benoît PIERRE <benoit.pierre at the gmail dot coms>
|
53
|
-
Matthieu Rakotojaona <matthieu.rakotojaona at the gmail dot coms>
|
54
54
|
Alvaro Herrera <alvherre at the alvh.no-ip dot orgs>
|
55
55
|
Steven Lawrance <stl at the koffein dot nets>
|
56
56
|
Jonah <Jonah at the GoodCoffee dot cas>
|
57
57
|
ian <itaylor at the uark dot edus>
|
58
|
-
Todd Eisenberger <teisenbe at the andrew.cmu dot edus>
|
59
58
|
Adam Lloyd <adam at the alloy-d dot nets>
|
59
|
+
Todd Eisenberger <teisenbe at the andrew.cmu dot edus>
|
60
|
+
Gregor Hoffleit <gregor at the sam.mediasupervision dot des>
|
60
61
|
MichaelRevell <mikearevell at the gmail dot coms>
|
61
62
|
Per Andersson <avtobiff at the gmail dot coms>
|
62
|
-
Gregor Hoffleit <gregor at the sam.mediasupervision dot des>
|
63
63
|
Steven Walter <swalter at the monarch.(none)>
|
64
|
-
Jon M. Dugan <jdugan at the es dot nets>
|
65
64
|
Matthias Vallentin <vallentin at the icir dot orgs>
|
65
|
+
Jon M. Dugan <jdugan at the es dot nets>
|
66
66
|
Stefan Lundström <lundst at the snabb.(none)>
|
67
67
|
Horacio Sanson <horacio at the skillupjapan.co dot jps>
|
68
68
|
Kirill Smelkov <kirr at the landau.phys.spbu dot rus>
|
data/History.txt
CHANGED
data/ReleaseNotes
CHANGED
data/bin/sup
CHANGED
@@ -293,7 +293,7 @@ begin
|
|
293
293
|
b.mode.load_in_background if new
|
294
294
|
when :search
|
295
295
|
completions = LabelManager.all_labels.map { |l| "label:#{LabelManager.string_for l}" }
|
296
|
-
completions = completions.each { |l| l.fix_encoding }
|
296
|
+
completions = completions.each { |l| l.fix_encoding! }
|
297
297
|
completions += Index::COMPL_PREFIXES
|
298
298
|
query = BufferManager.ask_many_with_completions :search, "Search all messages (enter for saved searches): ", completions
|
299
299
|
unless query.nil?
|
@@ -307,7 +307,7 @@ begin
|
|
307
307
|
SearchResultsMode.spawn_from_query "is:unread"
|
308
308
|
when :list_labels
|
309
309
|
labels = LabelManager.all_labels.map { |l| LabelManager.string_for l }
|
310
|
-
labels = labels.each { |l| l.fix_encoding }
|
310
|
+
labels = labels.each { |l| l.fix_encoding! }
|
311
311
|
|
312
312
|
user_label = bm.ask_with_completions :label, "Show threads with label (enter for listing): ", labels
|
313
313
|
unless user_label.nil?
|
@@ -375,7 +375,7 @@ ensure
|
|
375
375
|
Index.stop_lock_update_thread
|
376
376
|
end
|
377
377
|
|
378
|
-
HookManager.run "shutdown"
|
378
|
+
HookManager.run "shutdown" if HookManager.instantiated?
|
379
379
|
|
380
380
|
Index.stop_sync_worker
|
381
381
|
Redwood::finish
|
data/lib/sup.rb
CHANGED
@@ -271,7 +271,7 @@ EOM
|
|
271
271
|
else
|
272
272
|
require 'etc'
|
273
273
|
require 'socket'
|
274
|
-
name = Etc.getpwnam(ENV["USER"]).gecos.split(/,/).first.force_encoding($encoding).fix_encoding rescue nil
|
274
|
+
name = Etc.getpwnam(ENV["USER"]).gecos.split(/,/).first.force_encoding($encoding).fix_encoding! rescue nil
|
275
275
|
name ||= ENV["USER"]
|
276
276
|
email = ENV["USER"] + "@" +
|
277
277
|
begin
|
@@ -283,8 +283,8 @@ EOM
|
|
283
283
|
config = {
|
284
284
|
:accounts => {
|
285
285
|
:default => {
|
286
|
-
:name => name.fix_encoding
|
287
|
-
:email => email.fix_encoding
|
286
|
+
:name => name.dup.fix_encoding!,
|
287
|
+
:email => email.dup.fix_encoding!,
|
288
288
|
:alternates => [],
|
289
289
|
:sendmail => "/usr/sbin/sendmail -oem -ti",
|
290
290
|
:signature => File.join(ENV["HOME"], ".signature"),
|
data/lib/sup/account.rb
CHANGED
@@ -52,7 +52,7 @@ class AccountManager
|
|
52
52
|
hash[:alternates] ||= []
|
53
53
|
fail "alternative emails are not an array: #{hash[:alternates]}" unless hash[:alternates].kind_of? Array
|
54
54
|
|
55
|
-
[:name, :signature].each { |x| hash[x] ? hash[x].fix_encoding : nil }
|
55
|
+
[:name, :signature].each { |x| hash[x] ? hash[x].fix_encoding! : nil }
|
56
56
|
|
57
57
|
a = Account.new hash
|
58
58
|
@accounts[a] = true
|
data/lib/sup/buffer.rb
CHANGED
@@ -449,7 +449,7 @@ EOS
|
|
449
449
|
|
450
450
|
def ask_with_completions domain, question, completions, default=nil
|
451
451
|
ask domain, question, default do |s|
|
452
|
-
s.fix_encoding
|
452
|
+
s.fix_encoding!
|
453
453
|
completions.select { |x| x =~ /^#{Regexp::escape s}/iu }.map { |x| [x, x] }
|
454
454
|
end
|
455
455
|
end
|
@@ -466,8 +466,8 @@ EOS
|
|
466
466
|
raise "william screwed up completion: #{partial.inspect}"
|
467
467
|
end
|
468
468
|
|
469
|
-
prefix.fix_encoding
|
470
|
-
target.fix_encoding
|
469
|
+
prefix.fix_encoding!
|
470
|
+
target.fix_encoding!
|
471
471
|
completions.select { |x| x =~ /^#{Regexp::escape target}/iu }.map { |x| [prefix + x, x] }
|
472
472
|
end
|
473
473
|
end
|
@@ -476,10 +476,10 @@ EOS
|
|
476
476
|
ask domain, question, default do |partial|
|
477
477
|
prefix, target = partial.split_on_commas_with_remainder
|
478
478
|
target ||= prefix.pop || ""
|
479
|
-
target.fix_encoding
|
479
|
+
target.fix_encoding!
|
480
480
|
|
481
481
|
prefix = prefix.join(", ") + (prefix.empty? ? "" : ", ")
|
482
|
-
prefix.fix_encoding
|
482
|
+
prefix.fix_encoding!
|
483
483
|
|
484
484
|
completions.select { |x| x =~ /^#{Regexp::escape target}/iu }.sort_by { |c| [ContactManager.contact_for(c) ? 0 : 1, c] }.map { |x| [prefix + x, x] }
|
485
485
|
end
|
data/lib/sup/crypto.rb
CHANGED
@@ -340,7 +340,7 @@ EOS
|
|
340
340
|
msg = RMail::Parser.read output
|
341
341
|
if msg.header.content_type =~ %r{^multipart/} && !msg.multipart?
|
342
342
|
output = "MIME-Version: 1.0\n" + output
|
343
|
-
output.fix_encoding
|
343
|
+
output.fix_encoding!
|
344
344
|
msg = RMail::Parser.read output
|
345
345
|
end
|
346
346
|
end
|
data/lib/sup/logger.rb
CHANGED
@@ -60,7 +60,10 @@ private
|
|
60
60
|
## actually distribute the message
|
61
61
|
def send_message m
|
62
62
|
@mutex.synchronize do
|
63
|
-
@sinks.each
|
63
|
+
@sinks.each do |sink|
|
64
|
+
sink << m
|
65
|
+
sink.flush if sink.respond_to?(:flush) and level == "debug"
|
66
|
+
end
|
64
67
|
@buf << m
|
65
68
|
end
|
66
69
|
end
|
data/lib/sup/message.rb
CHANGED
@@ -112,7 +112,7 @@ class Message
|
|
112
112
|
end
|
113
113
|
|
114
114
|
subj = header["subject"]
|
115
|
-
subj = subj ? subj.fix_encoding : nil
|
115
|
+
subj = subj ? subj.fix_encoding! : nil
|
116
116
|
@subj = subj ? subj.gsub(/\s+/, " ").gsub(/\s+$/, "") : DEFAULT_SUBJECT
|
117
117
|
@to = Person.from_address_list header["to"]
|
118
118
|
@cc = Person.from_address_list header["cc"]
|
@@ -309,7 +309,7 @@ EOS
|
|
309
309
|
end
|
310
310
|
|
311
311
|
def indexable_chunks
|
312
|
-
chunks.select { |c| c.is_a? Chunk::Text }
|
312
|
+
chunks.select { |c| c.is_a? Chunk::Text } || []
|
313
313
|
end
|
314
314
|
|
315
315
|
def indexable_subject
|
@@ -178,7 +178,7 @@ EOS
|
|
178
178
|
def handle_new_text header, body; end
|
179
179
|
|
180
180
|
def edit_message_or_field
|
181
|
-
lines = DECORATION_LINES + @selectors.size
|
181
|
+
lines = (@selectors.empty? ? 0 : DECORATION_LINES) + @selectors.size
|
182
182
|
if lines > curpos
|
183
183
|
return
|
184
184
|
elsif (curpos - lines) >= @header_lines.length
|
@@ -489,7 +489,7 @@ protected
|
|
489
489
|
return false
|
490
490
|
end
|
491
491
|
else
|
492
|
-
IO.popen(acct.sendmail, "w") { |p| p.puts m }
|
492
|
+
IO.popen(acct.sendmail, "w:UTF-8") { |p| p.puts m }
|
493
493
|
raise SendmailCommandFailed, "Couldn't execute #{acct.sendmail}" unless $? == 0
|
494
494
|
end
|
495
495
|
|
@@ -517,6 +517,7 @@ protected
|
|
517
517
|
m.body += "\n" + sig_lines.join("\n") unless @sig_edited
|
518
518
|
## body must end in a newline or GPG signatures will be WRONG!
|
519
519
|
m.body += "\n" unless m.body =~ /\n\Z/
|
520
|
+
m.body = m.body.fix_encoding!
|
520
521
|
|
521
522
|
## there are attachments, so wrap body in an attachment of its own
|
522
523
|
unless @attachments.empty?
|
@@ -525,7 +526,10 @@ protected
|
|
525
526
|
m = RMail::Message.new
|
526
527
|
|
527
528
|
m.add_part body_m
|
528
|
-
@attachments.each
|
529
|
+
@attachments.each do |a|
|
530
|
+
a.body = a.body.fix_encoding! if a.body.kind_of? String
|
531
|
+
m.add_part a
|
532
|
+
end
|
529
533
|
end
|
530
534
|
|
531
535
|
## do whatever crypto transformation is necessary
|
@@ -547,9 +551,9 @@ protected
|
|
547
551
|
m.header[k] =
|
548
552
|
case v
|
549
553
|
when String
|
550
|
-
k.match(/subject/i) ? mime_encode_subject(v) : mime_encode_address(v)
|
554
|
+
(k.match(/subject/i) ? mime_encode_subject(v) : mime_encode_address(v)).fix_encoding!
|
551
555
|
when Array
|
552
|
-
v.map { |v| mime_encode_address v }.join ", "
|
556
|
+
(v.map { |v| mime_encode_address v }.join ", ").fix_encoding!
|
553
557
|
end
|
554
558
|
end
|
555
559
|
|
@@ -86,7 +86,11 @@ protected
|
|
86
86
|
counted = searches.map do |name|
|
87
87
|
search_string = SearchManager.search_string_for name
|
88
88
|
begin
|
89
|
-
|
89
|
+
if SearchManager.predefined_queries.has_key? search_string
|
90
|
+
query = SearchManager.predefined_queries[search_string]
|
91
|
+
else
|
92
|
+
query = Index.parse_query search_string
|
93
|
+
end
|
90
94
|
total = Index.num_results_for :qobj => query[:qobj]
|
91
95
|
unread = Index.num_results_for :qobj => query[:qobj], :label => :unread
|
92
96
|
rescue Index::ParseError => e
|
@@ -40,7 +40,11 @@ class SearchResultsMode < ThreadIndexMode
|
|
40
40
|
|
41
41
|
def self.spawn_from_query text
|
42
42
|
begin
|
43
|
-
|
43
|
+
if SearchManager.predefined_queries.has_key? text
|
44
|
+
query = SearchManager.predefined_queries[text]
|
45
|
+
else
|
46
|
+
query = Index.parse_query(text)
|
47
|
+
end
|
44
48
|
return unless query
|
45
49
|
short_text = text.length < 20 ? text : text[0 ... 20] + "..."
|
46
50
|
mode = SearchResultsMode.new query
|
data/lib/sup/search.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
1
3
|
module Redwood
|
2
4
|
|
3
5
|
class SearchManager
|
@@ -15,10 +17,27 @@ class SearchManager
|
|
15
17
|
end
|
16
18
|
end
|
17
19
|
@modified = false
|
20
|
+
|
21
|
+
@predefined_searches = { 'All mail' => 'Search all mail.' }
|
22
|
+
@predefined_queries = { 'All mail'.to_sym => { :qobj => Xapian::Query.new('Kmail'),
|
23
|
+
:load_spam => false,
|
24
|
+
:load_deleted => false,
|
25
|
+
:load_killed => false,
|
26
|
+
:text => 'Search all mail.'}
|
27
|
+
}
|
28
|
+
@predefined_searches.each do |k,v|
|
29
|
+
@searches[k] = v
|
30
|
+
end
|
18
31
|
end
|
19
32
|
|
33
|
+
def predefined_queries; return @predefined_queries; end
|
20
34
|
def all_searches; return @searches.keys.sort; end
|
21
|
-
def search_string_for name;
|
35
|
+
def search_string_for name;
|
36
|
+
if @predefined_searches.keys.member? name
|
37
|
+
return name.to_sym
|
38
|
+
end
|
39
|
+
return @searches[name];
|
40
|
+
end
|
22
41
|
def valid_name? name; name =~ /^[\w-]+$/; end
|
23
42
|
def name_format_hint; "letters, numbers, underscores and dashes only"; end
|
24
43
|
|
@@ -65,7 +84,7 @@ class SearchManager
|
|
65
84
|
|
66
85
|
def save
|
67
86
|
return unless @modified
|
68
|
-
File.open(@fn, "w") { |f| @searches.sort.each { |(n, s)| f.puts "#{n}: #{s}" } }
|
87
|
+
File.open(@fn, "w:UTF-8") { |f| (@searches - @predefined_searches.keys).sort.each { |(n, s)| f.puts "#{n}: #{s}" } }
|
69
88
|
@modified = false
|
70
89
|
end
|
71
90
|
end
|
data/lib/sup/textfield.rb
CHANGED
@@ -177,7 +177,7 @@ private
|
|
177
177
|
# encoding) will produce erronous results, but will also do that for
|
178
178
|
# a log of other programs since it is impossible to detect which is
|
179
179
|
# which and what encoding the inputted byte chars are supposed to have.
|
180
|
-
v.force_encoding($encoding).fix_encoding
|
180
|
+
v.force_encoding($encoding).fix_encoding!
|
181
181
|
end
|
182
182
|
|
183
183
|
def remove_extra_space
|
data/lib/sup/util.rb
CHANGED
@@ -125,7 +125,7 @@ module RMail
|
|
125
125
|
class << self
|
126
126
|
def parse(field)
|
127
127
|
field = field.dup.to_s
|
128
|
-
field = field.fix_encoding
|
128
|
+
field = field.fix_encoding!.ascii
|
129
129
|
if field =~ EXTRACT_FIELD_NAME_RE
|
130
130
|
[ $1, $'.chomp ]
|
131
131
|
else
|
@@ -256,7 +256,7 @@ end
|
|
256
256
|
|
257
257
|
class String
|
258
258
|
def display_length
|
259
|
-
@display_length ||= Unicode.width(self
|
259
|
+
@display_length ||= Unicode.width(self.fix_encoding!, false)
|
260
260
|
end
|
261
261
|
|
262
262
|
def slice_by_display_length len
|
@@ -366,7 +366,7 @@ class String
|
|
366
366
|
# user encoding.
|
367
367
|
#
|
368
368
|
# Not Ruby 1.8 compatible
|
369
|
-
def fix_encoding
|
369
|
+
def fix_encoding!
|
370
370
|
# first try to encode to utf-8 from whatever current encoding
|
371
371
|
encode!('UTF-8', :invalid => :replace, :undef => :replace)
|
372
372
|
|
@@ -402,7 +402,7 @@ class String
|
|
402
402
|
|
403
403
|
rescue Encoding::ConverterNotFoundError
|
404
404
|
debug "Encoding converter not found for #{from_encoding.inspect} or #{to_encoding.inspect}, fixing string: '#{self.to_s}', but expect weird characters."
|
405
|
-
fix_encoding
|
405
|
+
fix_encoding!
|
406
406
|
end
|
407
407
|
|
408
408
|
fail "Could not create valid #{to_encoding.inspect} string out of: '#{self.to_s}'." unless valid_encoding?
|
@@ -411,7 +411,7 @@ class String
|
|
411
411
|
end
|
412
412
|
|
413
413
|
def normalize_whitespace
|
414
|
-
fix_encoding
|
414
|
+
fix_encoding!
|
415
415
|
gsub(/\t/, " ").gsub(/\r/, "")
|
416
416
|
end
|
417
417
|
|
@@ -453,7 +453,7 @@ class String
|
|
453
453
|
out << b.chr
|
454
454
|
end
|
455
455
|
end
|
456
|
-
out = out.fix_encoding # this should now be an utf-8 string of ascii
|
456
|
+
out = out.fix_encoding! # this should now be an utf-8 string of ascii
|
457
457
|
# compat chars.
|
458
458
|
end
|
459
459
|
|
data/lib/sup/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.14.
|
4
|
+
version: 0.14.1
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 14
|
9
|
-
-
|
10
|
-
hash:
|
9
|
+
- 1
|
10
|
+
hash: -2902532426715311422
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- William Morgan
|
@@ -17,7 +17,7 @@ authors:
|
|
17
17
|
autorequire:
|
18
18
|
bindir: bin
|
19
19
|
cert_chain: []
|
20
|
-
date: 2013-08-
|
20
|
+
date: 2013-08-31 00:00:00.000000000 Z
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
23
23
|
name: xapian-ruby
|
@@ -362,9 +362,10 @@ files:
|
|
362
362
|
homepage: http://supmua.org
|
363
363
|
licenses:
|
364
364
|
- GPL-2
|
365
|
-
post_install_message: ! "SUP:
|
366
|
-
|
367
|
-
\
|
365
|
+
post_install_message: ! "SUP: If you are upgrading Sup from before version 0.14.0:
|
366
|
+
Please\n run `sup-psych-ify-config-files` to migrate from 0.13 to 0.14.\n\n
|
367
|
+
\ Check https://github.com/sup-heliotrope/sup/wiki/Migration-0.13-to-0.14\n for
|
368
|
+
more detailed and up-to-date instructions.\n"
|
368
369
|
rdoc_options: []
|
369
370
|
require_paths:
|
370
371
|
- lib
|