sup 0.21.0 → 0.22.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/CONTRIBUTORS +18 -17
  3. data/History.txt +8 -0
  4. data/Rakefile +0 -1
  5. data/bin/sup +0 -1
  6. data/bin/sup-add +1 -2
  7. data/bin/sup-config +0 -1
  8. data/bin/sup-dump +0 -1
  9. data/bin/sup-import-dump +1 -2
  10. data/bin/sup-sync +0 -1
  11. data/bin/sup-sync-back-maildir +0 -1
  12. data/bin/sup-tweak-labels +1 -2
  13. data/contrib/colorpicker.rb +0 -2
  14. data/devel/profile.rb +0 -1
  15. data/ext/mkrf_conf_xapian.rb +0 -2
  16. data/lib/sup.rb +0 -1
  17. data/lib/sup/crypto.rb +7 -6
  18. data/lib/sup/draft.rb +1 -1
  19. data/lib/sup/mode.rb +2 -2
  20. data/lib/sup/modes/thread_index_mode.rb +5 -1
  21. data/lib/sup/modes/thread_view_mode.rb +4 -3
  22. data/lib/sup/util.rb +1 -75
  23. data/lib/sup/version.rb +1 -1
  24. data/sup.gemspec +1 -1
  25. data/test/{messages → fixtures}/bad-content-transfer-encoding-1.eml +0 -0
  26. data/test/{messages → fixtures}/binary-content-transfer-encoding-2.eml +0 -0
  27. data/test/fixtures/blank-header-fields.eml +71 -0
  28. data/test/{unit/fixtures → fixtures}/contacts.txt +0 -0
  29. data/test/fixtures/malicious-attachment-names.eml +55 -0
  30. data/test/fixtures/missing-from-to.eml +18 -0
  31. data/test/{messages → fixtures}/missing-line.eml +0 -0
  32. data/test/fixtures/multi-part-2.eml +72 -0
  33. data/test/fixtures/multi-part.eml +61 -0
  34. data/test/fixtures/no-body.eml +18 -0
  35. data/test/fixtures/simple-message.eml +29 -0
  36. data/test/gnupg_test_home/key_ecc.gen +13 -0
  37. data/test/gnupg_test_home/pubring.gpg +0 -0
  38. data/test/gnupg_test_home/regen_keys.sh +3 -0
  39. data/test/test_crypto.rb +11 -1
  40. data/test/test_helper.rb +6 -3
  41. data/test/test_message.rb +25 -383
  42. data/test/test_messages_dir.rb +3 -9
  43. data/test/unit/test_contact.rb +1 -1
  44. metadata +41 -15
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7303df91a168cda15ce5be2bcb280676acafb4bb
4
- data.tar.gz: 3abfca06f5727c6efd4b179c12304773328a2d84
3
+ metadata.gz: 3d3899a57ac9c9c12a9169f7b7f6d0bbef7e6d9e
4
+ data.tar.gz: 0768bfb04caf6681aef3b16ac81b546d29a1ccd7
5
5
  SHA512:
6
- metadata.gz: 521dfa870e7caf37067677814ee4750f8c175fc4ab590e14f67fddab2f19923078b30c1f709c23e2af71cf8711a110b9ed576669f4c1dac30d67035742f53399
7
- data.tar.gz: 17f73b5cb16135dbd9b1d423a8e899e6c2bca4fd50c52d1107f353f2e7acf52715fda32d4586cf90fc5e6252a9fe6ea761e27d583e14d094bf9f85f1a8fe59c7
6
+ metadata.gz: 9affb8ec99b6873ba9ee5f17dfdc2c834d08a886bde0b71b9b7f06d5c1b9538c74d089712fdaa05e1c973ddf8d70aa3b5f80f69e2df4f31d8918c475d9cee9d6
7
+ data.tar.gz: b6d73929c911365ee14ce8948c2bbba478985d0b706375351c8f14e7aec72ecd285d35beca63fce9cb2d46fb70882c950c6960319d8632eb1f31aeed9ab0279f
@@ -3,16 +3,16 @@ Rich Lane <rlane at the club.cc.cmu dot edus>
3
3
  Gaute Hope <eg at the gaute.vetsj dot coms>
4
4
  Whyme Lyu <callme5long at the gmail dot coms>
5
5
  Hamish Downer <dmishd at the gmail dot coms>
6
+ Zeger-Jan van de Weg <mail at the zjvandeweg dot nls>
6
7
  Damien Leone <damien.leone at the fensalir dot frs>
7
8
  Sascha Silbe <sascha-pgp at the silbe dot orgs>
8
9
  Eric Weikl <eric.weikl at the gmx dot nets>
9
10
  Paweł Wilk <siefca at the gnu dot orgs>
10
11
  Ismo Puustinen <ismo at the iki dot fis>
11
- Nicolas Pouillard <nicolas.pouillard at the gmail dot coms>
12
12
  Matthieu Rakotojaona <matthieu.rakotojaona at the gmail dot coms>
13
+ Nicolas Pouillard <nicolas.pouillard at the gmail dot coms>
13
14
  Michael Stapelberg <michael at the stapelberg dot des>
14
15
  Eric Sherman <hyperbolist at the gmail dot coms>
15
- Zeger-Jan van de Weg <mail at the zjvandeweg dot nls>
16
16
  Tero Tilus <tero at the tilus dot nets>
17
17
  Ben Walton <bwalton at the artsci.utoronto dot cas>
18
18
  Scott Bonds <scott at the ggr dot coms>
@@ -25,8 +25,8 @@ Marcus Williams <marcus-sup at the bar-coded dot nets>
25
25
  Lionel Ott <white.magic at the gmx dot des>
26
26
  Gaudenz Steinlin <gaudenz at the soziologie dot chs>
27
27
  Per Andersson <avtobiff at the gmail dot coms>
28
- Ingmar Vanhassel <ingmar at the exherbo dot orgs>
29
28
  Mark Alexander <marka at the pobox dot coms>
29
+ Ingmar Vanhassel <ingmar at the exherbo dot orgs>
30
30
  Edward Z. Yang <ezyang at the mit dot edus>
31
31
  julien@macbook <julien.stechele at the gmail dot coms>
32
32
  Christopher Warrington <chrisw at the rice dot edus>
@@ -40,24 +40,24 @@ Markus Klinik <mkl at the lambdanaut dot nets>
40
40
  Bo Borgerson <gigabo at the gmail dot coms>
41
41
  Atte Kojo <atte.kojo at the reaktor dot fis>
42
42
  Michael Hamann <michael at the content-space dot des>
43
- William Erik Baxter <web at the superscript dot coms>
44
43
  Jonathan Lassoff <jof at the thejof dot coms>
44
+ William Erik Baxter <web at the superscript dot coms>
45
45
  Grant Hollingworth <grant at the antiflux dot orgs>
46
46
  Ico Doornekamp <ico at the pruts dot nls>
47
47
  Adeodato Simó <dato at the net.com.org dot ess>
48
48
  Daniel Schoepe <daniel.schoepe at the googlemail dot coms>
49
- Jason Petsod <jason at the petsod dot orgs>
50
49
  James Taylor <james at the jamestaylor dot orgs>
51
- Steve Goldman <sgoldman at the tower-research dot coms>
50
+ Jason Petsod <jason at the petsod dot orgs>
52
51
  Robin Burchell <viroteck at the viroteck dot nets>
52
+ Steve Goldman <sgoldman at the tower-research dot coms>
53
53
  Peter Harkins <ph at the malaprop dot orgs>
54
- Decklin Foster <decklin at the red-bean dot coms>
55
54
  rjg-vB <rthrd at the web dot des>
55
+ Decklin Foster <decklin at the red-bean dot coms>
56
56
  Cameron Matheson <cam+sup at the cammunism dot orgs>
57
- Alex Vandiver <alex at the chmrr dot nets>
58
57
  Carl Worth <cworth at the cworth dot orgs>
59
- Jeff Balogh <its.jeff.balogh at the gmail dot coms>
58
+ Alex Vandiver <alex at the chmrr dot nets>
60
59
  Andrew Pimlott <andrew at the pimlott dot nets>
60
+ Jeff Balogh <its.jeff.balogh at the gmail dot coms>
61
61
  Matías Aguirre <matiasaguirre at the gmail dot coms>
62
62
  PaulSmecker <paul.smecker at the gmail dot coms>
63
63
  Ruthard Baudach <rthrd at the web dot des>
@@ -67,23 +67,24 @@ madhat2r <MaDhAt2r at the dukefoo dot coms>
67
67
  Kevin Riggle <kevinr at the free-dissociation dot coms>
68
68
  Giorgio Lando <patroclo7 at the gmail dot coms>
69
69
  Benoît PIERRE <benoit.pierre at the gmail dot coms>
70
- Alvaro Herrera <alvherre at the alvh.no-ip dot orgs>
71
70
  Steven Lawrance <stl at the koffein dot nets>
71
+ Alvaro Herrera <alvherre at the alvh.no-ip dot orgs>
72
72
  Jonah <Jonah at the GoodCoffee dot cas>
73
73
  ian <itaylor at the uark dot edus>
74
- Todd Eisenberger <teisenbe at the andrew.cmu dot edus>
75
- MichaelRevell <mikearevell at the gmail dot coms>
76
- Adam Lloyd <adam at the alloy-d dot nets>
74
+ Elias Norberg <xyzzy at the kudzu dot ses>
77
75
  0xACE <0xACE at the users.noreply.github dot coms>
76
+ MichaelRevell <mikearevell at the gmail dot coms>
78
77
  Gregor Hoffleit <gregor at the sam.mediasupervision dot des>
78
+ Adam Lloyd <adam at the alloy-d dot nets>
79
+ Todd Eisenberger <teisenbe at the andrew.cmu dot edus>
80
+ Johannes Larsen <mail at the johslarsen dot nets>
79
81
  Sharif Olorin <sio at the tesser dot orgs>
80
- Steven Walter <swalter at the monarch.(none)>
81
82
  Steven Schmeiser <steven at the schmeiser dot orgs>
82
- Stefan Lundström <lundst at the snabb.(none)>
83
+ Steven Walter <swalter at the monarch.(none)>
83
84
  William A. Kennington III <william at the wkennington dot coms>
84
85
  akojo <atte.kojo at the gmail dot coms>
85
86
  Horacio Sanson <horacio at the skillupjapan.co dot jps>
86
- Jon M. Dugan <jdugan at the es dot nets>
87
87
  Matthias Vallentin <vallentin at the icir dot orgs>
88
- Johannes Larsen <johs.a.larsen at the gmail dot coms>
88
+ Jon M. Dugan <jdugan at the es dot nets>
89
+ Stefan Lundström <lundst at the snabb.(none)>
89
90
  Kirill Smelkov <kirr at the landau.phys.spbu dot rus>
@@ -1,3 +1,11 @@
1
+ == 0.22.0 / 2015-06-16
2
+
3
+ * Use mime-types 2
4
+ * Fix ruby style (Zeger-Jan van de Weg)
5
+ * Johannes Larsen: fix long-standing bug with draft-id mixups causing
6
+ drafts to disappear.
7
+ * Various bugs and minor improvements.
8
+
1
9
  == 0.21.0 / 2015-02-12
2
10
 
3
11
  * Key binding to fetch GPG key from keyserver (Matthieu Rakotojaona)
data/Rakefile CHANGED
@@ -1,4 +1,3 @@
1
- require 'rubygems'
2
1
  require 'rake/testtask'
3
2
  require "bundler/gem_tasks"
4
3
 
data/bin/sup CHANGED
@@ -3,7 +3,6 @@
3
3
 
4
4
  $:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
5
5
 
6
- require 'rubygems'
7
6
  require 'ncursesw'
8
7
 
9
8
  require 'sup/util/ncurses'
@@ -3,7 +3,6 @@
3
3
  $:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
4
4
 
5
5
  require 'uri'
6
- require 'rubygems'
7
6
  require 'highline/import'
8
7
  require 'trollop'
9
8
  require "sup"
@@ -95,7 +94,7 @@ begin
95
94
  next
96
95
  end
97
96
 
98
- parsed_uri = URI(uri)
97
+ parsed_uri = URI(URI.escape(uri))
99
98
 
100
99
  source =
101
100
  case parsed_uri.scheme
@@ -2,7 +2,6 @@
2
2
 
3
3
  $:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
4
4
 
5
- require 'rubygems'
6
5
  require 'highline/import'
7
6
  require 'trollop'
8
7
  require "sup"
@@ -2,7 +2,6 @@
2
2
 
3
3
  $:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
4
4
 
5
- require 'rubygems'
6
5
  require 'xapian'
7
6
  require 'trollop'
8
7
  require 'set'
@@ -3,7 +3,6 @@
3
3
  $:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
4
4
 
5
5
  require 'uri'
6
- require 'rubygems'
7
6
  require 'trollop'
8
7
  require "sup"
9
8
 
@@ -82,7 +81,7 @@ begin
82
81
  next if opts[:dry_run]
83
82
 
84
83
  m.labels = new_labels
85
- index.update_message_state m
84
+ index.update_message_state [m, false]
86
85
  end
87
86
 
88
87
  index.commit_transaction if opts[:atomic]
@@ -3,7 +3,6 @@
3
3
  $:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
4
4
 
5
5
  require 'uri'
6
- require 'rubygems'
7
6
  require 'trollop'
8
7
  require "sup"
9
8
 
@@ -3,7 +3,6 @@
3
3
 
4
4
  $:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
5
5
 
6
- require 'rubygems'
7
6
  require 'trollop'
8
7
  require "sup"
9
8
 
@@ -2,7 +2,6 @@
2
2
 
3
3
  $:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
4
4
 
5
- require 'rubygems'
6
5
  require 'trollop'
7
6
  require "sup"
8
7
 
@@ -83,7 +82,7 @@ begin
83
82
  ## query to only messages with those labels
84
83
  query += " (" + remove_labels.map { |l| "label:#{l}" }.join(" OR ") + ")"
85
84
  end
86
- query += ' ' + opts[:query] if opts[:query]
85
+ query += ' AND ' + opts[:query] if opts[:query]
87
86
 
88
87
  parsed_query = index.parse_query query
89
88
  parsed_query.merge! :load_spam => true, :load_deleted => true, :load_killed => true
@@ -1,5 +1,3 @@
1
- require 'rubygems'
2
-
3
1
  require 'ncursesw'
4
2
 
5
3
  Ncurses.initscr
@@ -1,4 +1,3 @@
1
- require 'rubygems'
2
1
  require 'ruby-prof'
3
2
  require "redwood"
4
3
 
@@ -1,6 +1,4 @@
1
1
  require 'rubygems'
2
- require 'rubygems/command.rb'
3
- require 'rubygems/dependency_installer.rb'
4
2
  require 'rbconfig'
5
3
 
6
4
  begin
data/lib/sup.rb CHANGED
@@ -1,6 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
- require 'rubygems'
4
3
  require 'yaml'
5
4
  require 'zlib'
6
5
  require 'thread'
@@ -10,11 +10,11 @@ class CryptoManager
10
10
 
11
11
  class Error < StandardError; end
12
12
 
13
- OUTGOING_MESSAGE_OPERATIONS = OrderedHash.new(
14
- [:sign, "Sign"],
15
- [:sign_and_encrypt, "Sign and encrypt"],
16
- [:encrypt, "Encrypt only"]
17
- )
13
+ OUTGOING_MESSAGE_OPERATIONS = {
14
+ sign: "Sign",
15
+ sign_and_encrypt: "Sign and encrypt",
16
+ encrypt: "Encrypt only"
17
+ }
18
18
 
19
19
  KEY_PATTERN = /(-----BEGIN PGP PUBLIC KEY BLOCK.*-----END PGP PUBLIC KEY BLOCK)/m
20
20
  KEYSERVER_URL = "http://pool.sks-keyservers.net:11371/pks/lookup"
@@ -467,6 +467,7 @@ private
467
467
  when GPGME::PK_DSA then "DSA "
468
468
  when GPGME::PK_ELG then "ElGamel "
469
469
  when GPGME::PK_ELG_E then "ElGamel "
470
+ else "unknown key type (#{subkey.pubkey_algo}) "
470
471
  end
471
472
  end
472
473
 
@@ -475,7 +476,7 @@ private
475
476
  # elsif only one account, then leave blank so gpg default will be user
476
477
  # else set --local-user from_email_address
477
478
  # NOTE: multiple signers doesn't seem to work with gpgme (2.0.2, 1.0.8)
478
- #
479
+ #
479
480
  def gen_sign_user_opts from
480
481
  account = AccountManager.account_for from
481
482
  account ||= AccountManager.default_account
@@ -61,7 +61,7 @@ class DraftLoader < Source
61
61
  end
62
62
 
63
63
  def gen_offset
64
- i = 0
64
+ i = @cur_offset
65
65
  while File.exist? fn_for_offset(i)
66
66
  i += 1
67
67
  end
@@ -46,7 +46,7 @@ class Mode
46
46
  end
47
47
 
48
48
  def resolve_input c
49
- ancestors.each do |klass| # try all keymaps in order of ancestry
49
+ self.class.ancestors.each do |klass| # try all keymaps in order of ancestry
50
50
  next unless @@keymaps.member?(klass)
51
51
  action = BufferManager.resolve_input_with_keymap c, @@keymaps[klass]
52
52
  return action if action
@@ -62,7 +62,7 @@ class Mode
62
62
 
63
63
  def help_text
64
64
  used_keys = {}
65
- ancestors.map do |klass|
65
+ self.class.ancestors.map do |klass|
66
66
  km = @@keymaps[klass] or next
67
67
  title = "Keybindings from #{Mode.make_name klass.name}"
68
68
  s = <<EOS
@@ -1026,7 +1026,11 @@ private
1026
1026
  end
1027
1027
 
1028
1028
  def from_width
1029
- [(buffer.content_width.to_f * 0.2).to_i, MIN_FROM_WIDTH].max if buffer else MIN_FROM_WIDTH # not sure why the buffer is gone
1029
+ if buffer
1030
+ [(buffer.content_width.to_f * 0.2).to_i, MIN_FROM_WIDTH].max
1031
+ else
1032
+ MIN_FROM_WIDTH # not sure why the buffer is gone
1033
+ end
1030
1034
  end
1031
1035
 
1032
1036
  def initialize_threads
@@ -940,9 +940,10 @@ private
940
940
  addressee_lines += format_person_list " Bcc: ", m.bcc
941
941
  end
942
942
 
943
- headers = OrderedHash.new
944
- headers["Date"] = "#{m.date.to_message_nice_s} (#{m.date.to_nice_distance_s})"
945
- headers["Subject"] = m.subj
943
+ headers = {
944
+ "Date" => "#{m.date.to_message_nice_s} (#{m.date.to_nice_distance_s})",
945
+ "Subject" => m.subj
946
+ }
946
947
 
947
948
  show_labels = @thread.labels - LabelManager::HIDDEN_RESERVED_LABELS
948
949
  unless show_labels.empty?
@@ -10,15 +10,6 @@ require 'benchmark'
10
10
  require 'unicode'
11
11
  require 'fileutils'
12
12
 
13
- ## time for some monkeypatching!
14
- class Symbol
15
- unless method_defined? :to_proc
16
- def to_proc
17
- proc { |obj, *args| obj.send(self, *args) }
18
- end
19
- end
20
- end
21
-
22
13
  class Lockfile
23
14
  def gen_lock_id
24
15
  Hash[
@@ -89,7 +80,7 @@ module RMail
89
80
  end
90
81
 
91
82
  def charset
92
- if header.field?("content-type") && header.fetch("content-type") =~ /charset="?(.*?)"?(;|$)/i
83
+ if header.field?("content-type") && header.fetch("content-type") =~ /charset\s*=\s*"?(.*?)"?(;|$)/i
93
84
  $1
94
85
  end
95
86
  end
@@ -170,13 +161,6 @@ module RMail
170
161
  end
171
162
  end
172
163
 
173
- class Range
174
- ## only valid for integer ranges (unless I guess it's exclusive)
175
- def size
176
- last - first + (exclude_end? ? 0 : 1)
177
- end
178
- end
179
-
180
164
  class Module
181
165
  def bool_reader *args
182
166
  args.each { |sym| class_eval %{ def #{sym}?; @#{sym}; end } }
@@ -198,17 +182,6 @@ class Module
198
182
  end
199
183
 
200
184
  class Object
201
- def ancestors
202
- ret = []
203
- klass = self.class
204
-
205
- until klass == Object
206
- ret << klass
207
- klass = klass.superclass
208
- end
209
- ret
210
- end
211
-
212
185
  ## "k combinator"
213
186
  def returning x; yield x; x; end
214
187
 
@@ -382,8 +355,6 @@ class String
382
355
 
383
356
  # Fix the damn string! make sure it is valid utf-8, then convert to
384
357
  # user encoding.
385
- #
386
- # Not Ruby 1.8 compatible
387
358
  def fix_encoding!
388
359
  # first try to encode to utf-8 from whatever current encoding
389
360
  encode!('UTF-8', :invalid => :replace, :undef => :replace)
@@ -406,8 +377,6 @@ class String
406
377
 
407
378
  # transcode the string if original encoding is know
408
379
  # fix if broken.
409
- #
410
- # Not Ruby 1.8 compatible
411
380
  def transcode to_encoding, from_encoding
412
381
  begin
413
382
  encode!(to_encoding, from_encoding, :invalid => :replace, :undef => :replace)
@@ -474,13 +443,6 @@ class String
474
443
  out = out.fix_encoding! # this should now be an utf-8 string of ascii
475
444
  # compat chars.
476
445
  end
477
-
478
- unless method_defined? :ascii_only?
479
- def ascii_only?
480
- size.times { |i| return false if self[i] & 128 != 0 }
481
- return true
482
- end
483
- end
484
446
  end
485
447
 
486
448
  class Numeric
@@ -518,12 +480,6 @@ class Fixnum
518
480
  end
519
481
  end
520
482
 
521
- unless method_defined?(:ord)
522
- def ord
523
- self
524
- end
525
- end
526
-
527
483
  ## hacking the english language
528
484
  def pluralize s
529
485
  to_s + " " +
@@ -607,10 +563,6 @@ module Enumerable
607
563
  end
608
564
  end
609
565
 
610
- unless Object.const_defined? :Enumerator
611
- Enumerator = Enumerable::Enumerator
612
- end
613
-
614
566
  class Array
615
567
  def flatten_one_level
616
568
  inject([]) { |a, e| a + e }
@@ -706,32 +658,6 @@ class SavingHash
706
658
  defer_all_other_method_calls_to :hash
707
659
  end
708
660
 
709
- class OrderedHash < Hash
710
- alias_method :store, :[]=
711
- alias_method :each_pair, :each
712
- attr_reader :keys
713
-
714
- def initialize *a
715
- @keys = []
716
- a.each { |k, v| self[k] = v }
717
- end
718
-
719
- def []= key, val
720
- @keys << key unless member?(key)
721
- super
722
- end
723
-
724
- def values; keys.map { |k| self[k] } end
725
- def index key; @keys.index key end
726
-
727
- def delete key
728
- @keys.delete key
729
- super
730
- end
731
-
732
- def each; @keys.each { |k| yield k, self[k] } end
733
- end
734
-
735
661
  ## easy thread-safe class for determining who's the "winner" in a race (i.e.
736
662
  ## first person to hit the finish line
737
663
  class FinishLine