sup 0.22.1 → 0.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +1 -3
  3. data/.travis.yml +11 -6
  4. data/CONTRIBUTORS +13 -5
  5. data/Gemfile +2 -1
  6. data/History.txt +51 -0
  7. data/README.md +26 -5
  8. data/bin/sup +7 -5
  9. data/bin/sup-add +14 -14
  10. data/bin/sup-config +30 -44
  11. data/bin/sup-dump +2 -2
  12. data/bin/sup-import-dump +4 -4
  13. data/bin/sup-sync +3 -3
  14. data/bin/sup-sync-back-maildir +2 -2
  15. data/bin/sup-tweak-labels +5 -5
  16. data/ext/mkrf_conf_xapian.rb +1 -1
  17. data/lib/sup.rb +1 -0
  18. data/lib/sup/crypto.rb +17 -8
  19. data/lib/sup/hook.rb +8 -8
  20. data/lib/sup/index.rb +18 -5
  21. data/lib/sup/logger.rb +1 -1
  22. data/lib/sup/message.rb +20 -10
  23. data/lib/sup/message_chunks.rb +3 -2
  24. data/lib/sup/mode.rb +1 -0
  25. data/lib/sup/modes/contact_list_mode.rb +1 -0
  26. data/lib/sup/modes/reply_mode.rb +3 -1
  27. data/lib/sup/modes/thread_index_mode.rb +1 -1
  28. data/lib/sup/modes/thread_view_mode.rb +14 -11
  29. data/lib/sup/source.rb +1 -1
  30. data/lib/sup/util.rb +14 -19
  31. data/lib/sup/util/axe.rb +17 -0
  32. data/lib/sup/util/ncurses.rb +3 -3
  33. data/lib/sup/version.rb +10 -1
  34. data/sup.gemspec +7 -6
  35. data/test/fixtures/mailing-list-header.eml +80 -0
  36. data/test/fixtures/text-attachments-with-charset.eml +46 -0
  37. data/test/fixtures/zimbra-quote-with-bottom-post.eml +27 -0
  38. data/test/gnupg_test_home/gpg.conf +2 -1
  39. data/test/gnupg_test_home/private-keys-v1.d/306D2EE90FF0014B5B9FD07E265C751791674140.key +0 -0
  40. data/test/gnupg_test_home/pubring.gpg +0 -0
  41. data/test/gnupg_test_home/receiver_pubring.gpg +0 -0
  42. data/test/gnupg_test_home/receiver_secring.gpg +0 -0
  43. data/test/gnupg_test_home/regen_keys.sh +69 -18
  44. data/test/gnupg_test_home/secring.gpg +0 -0
  45. data/test/gnupg_test_home/sup-test-2@foo.bar.asc +20 -22
  46. data/test/test_crypto.rb +2 -0
  47. data/test/test_message.rb +74 -0
  48. data/test/unit/util/test_query.rb +10 -4
  49. data/test/unit/util/test_string.rb +6 -0
  50. metadata +52 -38
  51. data/test/gnupg_test_home/key1.gen +0 -15
  52. data/test/gnupg_test_home/key2.gen +0 -15
  53. data/test/gnupg_test_home/key_ecc.gen +0 -13
@@ -58,7 +58,7 @@ class Source
58
58
  attr_accessor :id
59
59
 
60
60
  def initialize uri, usual=true, archived=false, id=nil
61
- raise ArgumentError, "id must be an integer: #{id.inspect}" unless id.is_a? Fixnum if id
61
+ raise ArgumentError, "id must be an integer: #{id.inspect}" unless id.is_a? Integer if id
62
62
 
63
63
  @uri = uri
64
64
  @usual = usual
@@ -8,6 +8,7 @@ require 'set'
8
8
  require 'enumerator'
9
9
  require 'benchmark'
10
10
  require 'unicode'
11
+ require 'unicode/display_width'
11
12
  require 'fileutils'
12
13
 
13
14
  class Lockfile
@@ -239,21 +240,14 @@ end
239
240
 
240
241
  class String
241
242
  def display_length
242
- @display_length ||= Unicode.width(self.fix_encoding!, false)
243
-
244
- # if Unicode.width fails and returns -1, fall back to
245
- # regular String#length, see pull-request: #256.
246
- if @display_length < 0
247
- @display_length = self.length
248
- end
249
-
250
- @display_length
243
+ @display_length ||= Unicode::DisplayWidth.of(self)
251
244
  end
252
245
 
253
246
  def slice_by_display_length len
254
247
  each_char.each_with_object "" do |c, buffer|
255
- len -= c.display_length
256
- buffer << c if len >= 0
248
+ len -= Unicode::DisplayWidth.of(c)
249
+ return buffer if len < 0
250
+ buffer << c
257
251
  end
258
252
  end
259
253
 
@@ -341,13 +335,14 @@ class String
341
335
  ret = []
342
336
  s = self
343
337
  while s.display_length > len
344
- cut = s.slice_by_display_length(len).rindex(/\s/)
338
+ slice = s.slice_by_display_length(len)
339
+ cut = slice.rindex(/\s/)
345
340
  if cut
346
341
  ret << s[0 ... cut]
347
342
  s = s[(cut + 1) .. -1]
348
343
  else
349
- ret << s.slice_by_display_length(len)
350
- s = s[ret.last.length .. -1]
344
+ ret << slice
345
+ s = s[slice.length .. -1]
351
346
  end
352
347
  end
353
348
  ret << s
@@ -460,18 +455,18 @@ class Numeric
460
455
 
461
456
  def to_human_size
462
457
  if self < 1024
463
- to_s + "b"
458
+ to_s + "B"
464
459
  elsif self < (1024 * 1024)
465
- (self / 1024).to_s + "k"
460
+ (self / 1024).to_s + "KiB"
466
461
  elsif self < (1024 * 1024 * 1024)
467
- (self / 1024 / 1024).to_s + "m"
462
+ (self / 1024 / 1024).to_s + "MiB"
468
463
  else
469
- (self / 1024 / 1024 / 1024).to_s + "g"
464
+ (self / 1024 / 1024 / 1024).to_s + "GiB"
470
465
  end
471
466
  end
472
467
  end
473
468
 
474
- class Fixnum
469
+ class Integer
475
470
  def to_character
476
471
  if self < 128 && self >= 0
477
472
  chr
@@ -0,0 +1,17 @@
1
+ require 'highline'
2
+ @cli = HighLine.new
3
+
4
+ def axe q, default=nil
5
+ question = if default && !default.empty?
6
+ "#{q} (enter for \"#{default}\"): "
7
+ else
8
+ "#{q}: "
9
+ end
10
+ ans = @cli.ask question
11
+ ans.empty? ? default : ans.to_s
12
+ end
13
+
14
+ def axe_yes q, default="n"
15
+ axe(q, default) =~ /^y|yes$/i
16
+ end
17
+
@@ -76,7 +76,7 @@ module Ncurses
76
76
  @status = status
77
77
  c = "" if c.nil?
78
78
  return super("") if status == Ncurses::ERR
79
- c = enc_char(c) if c.is_a?(Fixnum)
79
+ c = enc_char(c) if c.is_a?(Integer)
80
80
  super c.length > 1 ? c[0,1] : c
81
81
  end
82
82
 
@@ -89,7 +89,7 @@ module Ncurses
89
89
  else
90
90
  @status = Ncurses::OK
91
91
  c = "" if c.nil?
92
- c = enc_char(c) if c.is_a?(Fixnum)
92
+ c = enc_char(c) if c.is_a?(Integer)
93
93
  super c.length > 1 ? c[0,1] : c
94
94
  end
95
95
  end
@@ -260,7 +260,7 @@ module Ncurses
260
260
  ## Ncurses::Form.form_driver_w wrapper for printable characters.
261
261
  def form_driver_char c
262
262
  form_driver CharCode.character(c)
263
- #c.is_a?(Fixnum) ? c : c.ord
263
+ #c.is_a?(Integer) ? c : c.ord
264
264
  end
265
265
 
266
266
  ## Ncurses::Form.form_driver_w wrapper for charcodes.
@@ -1,3 +1,12 @@
1
+ def git_suffix
2
+ revision = `GIT_DIR=#{__dir__}/../../.git git rev-parse HEAD 2>/dev/null`
3
+ if revision.empty?
4
+ "-git-unknown"
5
+ else
6
+ "-git-#{revision[0..7]}"
7
+ end
8
+ end
9
+
1
10
  module Redwood
2
- VERSION = "0.22.1"
11
+ VERSION = "0.23"
3
12
  end
@@ -9,8 +9,8 @@ Gem::Specification.new do |s|
9
9
  s.authors = ["William Morgan", "Gaute Hope", "Hamish Downer", "Matthieu Rakotojaona"]
10
10
  s.email = "supmua@googlegroups.com"
11
11
  s.summary = "A console-based email client with the best features of GMail, mutt and Emacs"
12
- s.homepage = "http://supmua.org"
13
- s.license = 'GPL-2'
12
+ s.homepage = "https://sup-heliotrope.github.io/"
13
+ s.license = 'GPL-2.0'
14
14
  s.description = <<-DESC
15
15
  Sup is a console-based email client for people with a lot of email.
16
16
 
@@ -51,16 +51,17 @@ SUP: please note that our old mailing lists have been shut down,
51
51
  ## ext/mkrf_conf_xapian.rb and Gemfile.
52
52
 
53
53
  s.add_runtime_dependency "ncursesw", "~> 1.4.0"
54
- s.add_runtime_dependency "rmail-sup", "~> 1.0.1"
54
+ s.add_runtime_dependency "rmail", "~> 1.1"
55
55
  s.add_runtime_dependency "highline"
56
- s.add_runtime_dependency "trollop", ">= 1.12"
56
+ s.add_runtime_dependency "optimist"
57
57
  s.add_runtime_dependency "lockfile"
58
58
  s.add_runtime_dependency "mime-types", "> 2.0"
59
59
  s.add_runtime_dependency "locale", "~> 2.0"
60
- s.add_runtime_dependency "chronic", "~> 0.9.1"
60
+ s.add_runtime_dependency "chronic"
61
61
  s.add_runtime_dependency "unicode", "~> 0.4.4"
62
+ s.add_runtime_dependency "unicode-display_width"
62
63
 
63
- s.add_development_dependency "bundler", "~> 1.3"
64
+ s.add_development_dependency "bundler", ">= 1.3", "< 3"
64
65
  s.add_development_dependency "rake"
65
66
  s.add_development_dependency 'minitest', '~> 5.5.1'
66
67
  s.add_development_dependency "rr", "~> 1.1"
@@ -0,0 +1,80 @@
1
+ Return-Path: <bounce+67613+84234+3618174+8024896@lists.openembedded.org>
2
+ Delivered-To: unknown
3
+ Received: (qmail 702 invoked from network); 7 May 2020 06:15:54 -0000
4
+ Received: from web01.groups.io (HELO web01.groups.io) (66.175.222.12) by
5
+ server-33.tower-414.messagelabs.com with ECDHE-RSA-AES256-GCM-SHA384
6
+ encrypted SMTP; 7 May 2020 06:15:54 -0000
7
+ From: "Yu, Mingli" <mingli.yu@windriver.com>
8
+ To: <openembedded-devel@lists.openembedded.org>
9
+ Subject:
10
+ [oe] [meta-python][PATCH] python3-ntplib: add missing python3-io RDEPENDS
11
+ Date: Thu, 7 May 2020 14:15:26 +0800
12
+ Message-ID: <1588832126-393701-1-git-send-email-mingli.yu@windriver.com>
13
+ Precedence: Bulk
14
+ List-Unsubscribe: <https://lists.openembedded.org/g/openembedded-devel/unsub>
15
+ Sender: <openembedded-devel@lists.openembedded.org>
16
+ List-Id: <openembedded-devel.lists.openembedded.org>
17
+ Mailing-List: list openembedded-devel@lists.openembedded.org; contact
18
+ openembedded-devel+owner@lists.openembedded.org
19
+ Delivered-To: mailing list openembedded-devel@lists.openembedded.org
20
+ Reply-To: <openembedded-devel@lists.openembedded.org>
21
+ Content-Type: multipart/mixed; boundary="YleAvGBsp4tLsYxU5fi4"
22
+ MIME-Version: 1.0
23
+
24
+ --YleAvGBsp4tLsYxU5fi4
25
+ Content-Type: text/plain; charset="utf-8"
26
+ Content-Transfer-Encoding: 7bit
27
+ MIME-Version: 1.0
28
+
29
+ From: Mingli Yu <mingli.yu@windriver.com>
30
+
31
+ Add the missing python3-io RDEPENDS to fix
32
+ below error:
33
+ # python3
34
+ Python 3.8.2 (default, Apr 27 2020, 08:51:00)
35
+ [GCC 9.3.0] on linux
36
+ Type "help", "copyright", "credits" or "license" for more information.
37
+ >>> import ntplib
38
+ Traceback (most recent call last):
39
+ File "<stdin>", line 1, in <module>
40
+ File "/usr/lib64/python3.8/site-packages/ntplib.py", line 32, in <module>
41
+ import socket
42
+ ModuleNotFoundError: No module named 'socket'
43
+
44
+ Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
45
+ ---
46
+ meta-python/recipes-devtools/python/python3-ntplib_0.3.3.bb | 2 +-
47
+ 1 file changed, 1 insertion(+), 1 deletion(-)
48
+
49
+ diff --git a/meta-python/recipes-devtools/python/python3-ntplib_0.3.3.bb b/meta-python/recipes-devtools/python/python3-ntplib_0.3.3.bb
50
+ index 93df83a..ce2618b 100644
51
+ --- a/meta-python/recipes-devtools/python/python3-ntplib_0.3.3.bb
52
+ +++ b/meta-python/recipes-devtools/python/python3-ntplib_0.3.3.bb
53
+ @@ -11,4 +11,4 @@ S = "${WORKDIR}/${SRCNAME}-${PV}"
54
+
55
+ inherit setuptools3 python3native pypi
56
+
57
+ -RDEPENDS_${PN} += "${PYTHON_PN}-datetime"
58
+ +RDEPENDS_${PN} += "${PYTHON_PN}-datetime ${PYTHON_PN}-io"
59
+ --
60
+ 2.7.4
61
+
62
+
63
+ --YleAvGBsp4tLsYxU5fi4
64
+ Content-Type: text/plain; charset="utf-8"
65
+ Content-Transfer-Encoding: quoted-printable
66
+ Content-Disposition: inline
67
+
68
+ -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-
69
+ Links: You receive all messages sent to this group.
70
+
71
+ View/Reply Online (#84234): https://lists.openembedded.org/g/openembedded-d=
72
+ evel/message/84234
73
+ Mute This Topic: https://lists.openembedded.org/mt/74045486/3618174
74
+ Group Owner: openembedded-devel+owner@lists.openembedded.org
75
+ Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/leave/8024=
76
+ 896/1667129725/xyzzy [dan.callaghan@opengear.com]
77
+ -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-
78
+
79
+ --YleAvGBsp4tLsYxU5fi4--
80
+
@@ -0,0 +1,46 @@
1
+ From: Fake Sender <fake_sender@example.invalid>
2
+ To: Fake Receiver <fake_receiver@localhost>
3
+ Date: Sun, 21 Jun 2020 06:25:49 -0000
4
+ Subject: Attachments with charset
5
+ MIME-Version: 1.0
6
+ Content-Type: multipart/mixed; boundary="===============2385509127900810307=="
7
+
8
+ --===============2385509127900810307==
9
+ Content-Type: text/plain; charset="utf-8"
10
+ Content-Transfer-Encoding: 7bit
11
+
12
+ This is the body.
13
+
14
+ --===============2385509127900810307==
15
+ Content-Type: text/plain; charset="us-ascii"
16
+ Content-Transfer-Encoding: 7bit
17
+ MIME-Version: 1.0
18
+ Content-Disposition: attachment; filename="ascii.txt"
19
+
20
+ This is ASCII
21
+
22
+ --===============2385509127900810307==
23
+ Content-Type: text/plain; charset="koi8-r"
24
+ Content-Transfer-Encoding: quoted-printable
25
+ MIME-Version: 1.0
26
+ Content-Disposition: attachment; filename="cyrillic.txt"
27
+
28
+ =F0=D2=C9=D7=C5=D4
29
+
30
+ --===============2385509127900810307==
31
+ Content-Type: text/plain; charset="utf-8"
32
+ Content-Transfer-Encoding: base64
33
+ MIME-Version: 1.0
34
+ Content-Disposition: attachment; filename="emoji.txt"
35
+
36
+ 8J+Yggo=
37
+
38
+ --===============2385509127900810307==
39
+ Content-Type: text/plain
40
+ Content-Transfer-Encoding: quoted-printable
41
+ Content-Disposition: attachment; filename="bad.txt"
42
+ MIME-Version: 1.0
43
+
44
+ Embedded=F0garbage
45
+ --===============2385509127900810307==--
46
+
@@ -0,0 +1,27 @@
1
+ Return-Path: <zimbra.user@example.invalid>
2
+ Delivered-To: <recipient@example.invalid>
3
+ Received: from zmail16.collab.prod.int.phx2.redhat.com (zmail16.collab.prod.int.phx2.redhat.com [10.5.83.18])
4
+ by mx4-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q3A5xQ06025053
5
+ for <recipient@example.invalid>; Tue, 10 Apr 2012 01:59:26 -0400
6
+ Date: Tue, 10 Apr 2012 01:59:26 -0400 (EDT)
7
+ From: Zimbra User <zimbra.user@example.invalid>
8
+ To: Recipient <recipient@example.invalid>
9
+ Subject: Re: Zimbra
10
+ Message-ID: <0fe105df-e67b-419e-8599-50aaff7260e8@zmail16.collab.prod.int.phx2.redhat.com>
11
+ In-Reply-To: <1334037315-sup-8577@example.invalid>
12
+ Content-Type: text/plain; charset=utf-8
13
+ Content-Transfer-Encoding: 7bit
14
+ MIME-Version: 1.0
15
+ X-Mailer: Zimbra 7.1.2_GA_3268 (ZimbraWebClient - FF3.0 (Linux)/7.1.2_GA_3268)
16
+
17
+ ----- Original Message -----
18
+ > From: "Recipient" <recipient@example.invalid>
19
+ > To: "Zimbra User" <zimbra.user@example.invalid>
20
+ > Sent: Tuesday, April 10, 2012 3:56:15 PM
21
+ > Subject: Re: Zimbra
22
+ >
23
+ > This is the quoted original message.
24
+ >
25
+
26
+
27
+ This is the reply from the Zimbra user.
@@ -1,2 +1,3 @@
1
1
  trust-model always
2
-
2
+ # Set preferred hash algo to the one expected in the test suite
3
+ personal-digest-preferences sha256
@@ -1,38 +1,89 @@
1
- #! /bin/bash
1
+ #!/bin/bash
2
2
  #
3
3
  # re-generate test keys for the sup test base
4
4
  #
5
5
  # https://github.com/sup-heliotrope/sup/wiki/Development%3A-Crypto
6
+ #
7
+ # Requires GPG 2.1+ installed as "gpg2"
8
+ #
9
+ # GPG 2.1+ by default uses pubring.kbx - but this isn't backwards compatible
10
+ # with GPG 1 or GPG 2.0.
11
+ # Workaround:
12
+ # - Create empty pubring.gpg file, which causes GPG 2.1+ to use this
13
+ # backwards-compatible store.
14
+ # - Manually export private key copy to secring.gpg, which would be used
15
+ # by GPG 1.
16
+
17
+ set -e -u -o pipefail
6
18
 
7
19
  pushd $(dirname $0)
8
20
 
9
- export GNUPGHOME="$(pwd)"
21
+ echo "Generating keys in: $(pwd)..."
10
22
 
11
- echo "genrating keys in: $GNUPGHOME.."
23
+ echo "Checking gpg2 version"
24
+ gpg2 --version | head -1
12
25
 
13
- rm *.gpg *.asc
26
+ echo "Deleting all existing test keys"
27
+ rm -f \
28
+ *.gpg \
29
+ *.asc \
30
+ private-keys-v1.d/*.key \
31
+ .gpg-v21-migrated
14
32
 
15
- echo "generate receiver key.."
16
- gpg --batch --gen-key key2.gen
33
+ echo "Generating key pair for test receiver (email sup-test-2@foo.bar.asc)"
34
+ touch pubring.gpg # So GPG 2.1+ writes to pubring.gpg instead of pubring.kbx
35
+ gpg2 \
36
+ --homedir . \
37
+ --batch \
38
+ --pinentry-mode loopback \
39
+ --passphrase '' \
40
+ --quick-generate-key sup-test-2@foo.bar rsa encrypt,sign 0
17
41
 
18
- echo "export receiver key.."
42
+ echo "Exporting public key only for test receiver (file sup-test-2@foo.bar.asc)"
43
+ gpg2 \
44
+ --homedir . \
45
+ --armor \
46
+ --output sup-test-2@foo.bar.asc \
47
+ --export sup-test-2@foo.bar
19
48
 
20
- gpg --output sup-test-2@foo.bar.asc --armor --export sup-test-2@foo.bar
49
+ echo "Backing up secret key for test receiver (file receiver_secring.gpg)"
50
+ gpg2 \
51
+ --homedir . \
52
+ --export-secret-keys \
53
+ >receiver_secring.gpg
21
54
 
22
- mv trustdb.gpg receiver_trustdb.gpg
23
- mv secring.gpg receiver_secring.gpg
24
- mv pubring.gpg receiver_pubring.gpg
55
+ echo "Backing up pubring.gpg for test receiver (file receiver_pubring.gpg)"
56
+ cp -a pubring.gpg receiver_pubring.gpg
25
57
 
26
- echo "generate sender key.."
27
- gpg --batch --gen-key key1.gen
58
+ echo "Clearing key store, so we can start from a blank slate for next key(s)"
59
+ rm -f pubring.gpg trustdb.gpg private-keys-v1.d/*.key .gpg-v21-migrated
28
60
 
29
- echo "generate ecc key.."
30
- gpg --batch --gen-key key_ecc.gen
61
+ echo "Generating key pair for sender (email sup-test-1@foo.bar)"
62
+ touch pubring.gpg # So GPG 2.1+ writes to pubring.gpg instead of pubring.kbx
63
+ gpg2 \
64
+ --homedir . \
65
+ --batch \
66
+ --pinentry-mode loopback \
67
+ --passphrase '' \
68
+ --quick-generate-key sup-test-1@foo.bar rsa encrypt,sign 0
31
69
 
32
- echo "import receiver key.."
33
- gpg --import sup-test-2@foo.bar.asc
70
+ echo "Importing public key for receiver, into sender's key store"
71
+ gpg2 \
72
+ --homedir . \
73
+ --import sup-test-2@foo.bar.asc
34
74
 
75
+ echo "Copy private key also to secring.gpg (old format used by GPG 1)"
76
+ gpg2 \
77
+ --homedir . \
78
+ --export-secret-keys \
79
+ >secring.gpg
35
80
 
81
+ echo "Done."
36
82
 
37
- popd
83
+ echo "We now have two non-expiring public keys (receiver & sender):"
84
+ gpg2 --homedir . --list-keys
38
85
 
86
+ echo "And we also have only *one* corresponding private key (sender only):"
87
+ gpg2 --homedir . --list-secret-keys
88
+
89
+ popd