sup 0.20.0 → 1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +2 -1
  3. data/.travis.yml +11 -6
  4. data/CONTRIBUTORS +27 -15
  5. data/Gemfile +2 -1
  6. data/History.txt +84 -0
  7. data/README.md +26 -5
  8. data/Rakefile +0 -1
  9. data/ReleaseNotes +7 -0
  10. data/bin/sup +17 -30
  11. data/bin/sup-add +15 -16
  12. data/bin/sup-config +30 -45
  13. data/bin/sup-dump +2 -3
  14. data/bin/sup-import-dump +5 -6
  15. data/bin/sup-sync +3 -4
  16. data/bin/sup-sync-back-maildir +3 -4
  17. data/bin/sup-tweak-labels +6 -7
  18. data/contrib/colorpicker.rb +0 -2
  19. data/contrib/completion/_sup.bash +102 -0
  20. data/devel/profile.rb +0 -1
  21. data/ext/mkrf_conf_xapian.rb +1 -1
  22. data/lib/sup.rb +8 -8
  23. data/lib/sup/colormap.rb +5 -2
  24. data/lib/sup/contact.rb +4 -2
  25. data/lib/sup/crypto.rb +58 -16
  26. data/lib/sup/draft.rb +8 -8
  27. data/lib/sup/hook.rb +9 -9
  28. data/lib/sup/index.rb +20 -7
  29. data/lib/sup/label.rb +1 -1
  30. data/lib/sup/logger.rb +1 -1
  31. data/lib/sup/maildir.rb +2 -2
  32. data/lib/sup/mbox.rb +2 -2
  33. data/lib/sup/message.rb +26 -10
  34. data/lib/sup/message_chunks.rb +7 -4
  35. data/lib/sup/mode.rb +34 -28
  36. data/lib/sup/modes/contact_list_mode.rb +1 -0
  37. data/lib/sup/modes/edit_message_mode.rb +1 -1
  38. data/lib/sup/modes/forward_mode.rb +22 -3
  39. data/lib/sup/modes/line_cursor_mode.rb +1 -1
  40. data/lib/sup/modes/reply_mode.rb +3 -1
  41. data/lib/sup/modes/text_mode.rb +6 -1
  42. data/lib/sup/modes/thread_index_mode.rb +6 -2
  43. data/lib/sup/modes/thread_view_mode.rb +63 -18
  44. data/lib/sup/person.rb +68 -61
  45. data/lib/sup/search.rb +1 -1
  46. data/lib/sup/sent.rb +1 -1
  47. data/lib/sup/source.rb +1 -1
  48. data/lib/sup/util.rb +15 -94
  49. data/lib/sup/util/axe.rb +17 -0
  50. data/lib/sup/util/locale_fiddler.rb +24 -0
  51. data/lib/sup/util/ncurses.rb +3 -3
  52. data/lib/sup/version.rb +10 -1
  53. data/sup.gemspec +12 -10
  54. data/test/{messages → fixtures}/bad-content-transfer-encoding-1.eml +0 -0
  55. data/test/{messages → fixtures}/binary-content-transfer-encoding-2.eml +0 -0
  56. data/test/fixtures/blank-header-fields.eml +71 -0
  57. data/test/fixtures/contacts.txt +1 -0
  58. data/test/fixtures/mailing-list-header.eml +80 -0
  59. data/test/fixtures/malicious-attachment-names.eml +55 -0
  60. data/test/fixtures/missing-from-to.eml +18 -0
  61. data/test/{messages → fixtures}/missing-line.eml +0 -0
  62. data/test/fixtures/multi-part-2.eml +72 -0
  63. data/test/fixtures/multi-part.eml +61 -0
  64. data/test/fixtures/no-body.eml +18 -0
  65. data/test/fixtures/simple-message.eml +29 -0
  66. data/test/fixtures/text-attachments-with-charset.eml +46 -0
  67. data/test/fixtures/zimbra-quote-with-bottom-post.eml +27 -0
  68. data/test/gnupg_test_home/gpg.conf +2 -1
  69. data/test/gnupg_test_home/private-keys-v1.d/306D2EE90FF0014B5B9FD07E265C751791674140.key +0 -0
  70. data/test/gnupg_test_home/pubring.gpg +0 -0
  71. data/test/gnupg_test_home/receiver_pubring.gpg +0 -0
  72. data/test/gnupg_test_home/receiver_secring.gpg +0 -0
  73. data/test/gnupg_test_home/regen_keys.sh +70 -16
  74. data/test/gnupg_test_home/secring.gpg +0 -0
  75. data/test/gnupg_test_home/sup-test-2@foo.bar.asc +20 -22
  76. data/test/integration/test_maildir.rb +1 -1
  77. data/test/integration/test_mbox.rb +1 -1
  78. data/test/test_crypto.rb +14 -2
  79. data/test/test_header_parsing.rb +1 -1
  80. data/test/test_helper.rb +6 -3
  81. data/test/test_message.rb +115 -341
  82. data/test/test_messages_dir.rb +4 -28
  83. data/test/test_yaml_regressions.rb +1 -1
  84. data/test/unit/test_contact.rb +33 -0
  85. data/test/unit/test_locale_fiddler.rb +15 -0
  86. data/test/unit/test_person.rb +37 -0
  87. data/test/unit/util/test_query.rb +10 -4
  88. data/test/unit/util/test_string.rb +6 -0
  89. metadata +107 -43
  90. data/test/gnupg_test_home/key1.gen +0 -15
  91. data/test/gnupg_test_home/key2.gen +0 -15
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: e7b5ce3c73c1c6d194d8103bb25de84981db2529
4
- data.tar.gz: a5d0868505c66e8c7974025d5131738d2a436ab6
2
+ SHA256:
3
+ metadata.gz: 304755e3fd6b2e9aa86139810adb852249b93d7491471f17b2bd57e84b25489b
4
+ data.tar.gz: 0c13ac3dd70310cae00eb59bcc2a90d13f8748e07fd3b38e74e9a7893cd18c1f
5
5
  SHA512:
6
- metadata.gz: 8b44f362bd82be161b1d9451d805af1a9d73d962df4c54196703dec1bbca383fb7bd5f2c0bf6479c1fc57bc27b37ec17a65fc2b24abab838e7f2797bfb64687a
7
- data.tar.gz: e3a2eaaebf74bec788b18c28be9d9a2bee2b8fa06487780f3199aa7446ec386ac5ffc731595245e40be6423dfc1708bed14fe74ada70eab06097655ccc4fd47a
6
+ metadata.gz: 62e6e7e76826426f53870b6fe8d8959777752360b6ff9aca1e5644e33e2e31b399b251007a4dc5a439f68419610a2a99b32a005117615d1d293c16283379150d
7
+ data.tar.gz: 3cb2caa77a89ba1595365a93975e3caa006065a73787e075a2672e23670ecb3384c0f5c3a0e7bdb141fa31a3668e2870991097ece67de9d2d6b9a3fe1cbb2324
data/.gitignore CHANGED
@@ -16,4 +16,5 @@ Gemfile.lock
16
16
  # generated file for gnupg test
17
17
  test/gnupg_test_home/random_seed
18
18
  test/gnupg_test_home/trustdb.gpg
19
-
19
+ test/gnupg_test_home/.gpg-v21-migrated
20
+ test/gnupg_test_home/openpgp-revocs.d
@@ -1,13 +1,18 @@
1
1
  language: ruby
2
2
 
3
+ dist: focal
4
+
3
5
  rvm:
4
- - 2.1.1
5
- - 2.0.0
6
- - 1.9.3
6
+ - 2.5
7
+ - 2.6
8
+ - 2.7
7
9
 
8
10
  before_install:
9
- - sudo apt-get update -qq
10
- - sudo apt-get install -qq uuid-dev uuid libncursesw5-dev libncursesw5 gnupg2 pandoc
11
+ - sudo apt update -qq
12
+ - sudo apt install -qq uuid-dev uuid libncursesw5-dev libncursesw5 gnupg2 pandoc
11
13
  - git submodule update --init --recursive
12
14
 
13
- script: bundle exec rake travis
15
+ script:
16
+ - bundle exec rake travis
17
+ - bundle exec gem install pkg/sup-*.gem
18
+
@@ -3,30 +3,34 @@ Rich Lane
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>
11
+ Matthieu Rakotojaona <matthieu.rakotojaona at the gmail dot coms>
10
12
  Ismo Puustinen <ismo at the iki dot fis>
13
+ Dan Callaghan <djc at the djc.id dot aus>
11
14
  Nicolas Pouillard <nicolas.pouillard at the gmail dot coms>
12
15
  Michael Stapelberg <michael at the stapelberg dot des>
13
16
  Eric Sherman <hyperbolist at the gmail dot coms>
14
17
  Tero Tilus <tero at the tilus dot nets>
15
18
  Ben Walton <bwalton at the artsci.utoronto dot cas>
16
19
  Scott Bonds <scott at the ggr dot coms>
20
+ Iain Parris <ipv2.vcs at the parris dot orgs>
17
21
  Mike Stipicevic <stipim at the rpi dot edus>
18
22
  Martin Bähr <mbaehr at the societyserver dot orgs>
19
- Matthieu Rakotojaona <matthieu.rakotojaona at the gmail dot coms>
23
+ Timon Vonk <timonv at the gmail dot coms>
20
24
  Clint Byrum <clint at the ubuntu dot coms>
21
25
  Wael M. Nasreddine <wael.nasreddine at the gmail dot coms>
22
26
  Marcus Williams <marcus-sup at the bar-coded dot nets>
23
27
  Lionel Ott <white.magic at the gmx dot des>
28
+ Per Andersson <avtobiff at the gmail dot coms>
24
29
  Gaudenz Steinlin <gaudenz at the soziologie dot chs>
25
- Ingmar Vanhassel <ingmar at the exherbo dot orgs>
26
30
  Mark Alexander <marka at the pobox dot coms>
31
+ Ingmar Vanhassel <ingmar at the exherbo dot orgs>
27
32
  Edward Z. Yang <ezyang at the mit dot edus>
28
- Timon Vonk <timonv at the gmail dot coms>
29
- julien@macbook <julien.stechele at the gmail dot coms>
33
+ julien at the macbook <julien.stechele at the gmail dot coms>
30
34
  Christopher Warrington <chrisw at the rice dot edus>
31
35
  W. Trevor King <wking at the drexel dot edus>
32
36
  Richard Brown <rbrown at the exherbo dot orgs>
@@ -46,41 +50,49 @@ Adeodato Simó
46
50
  Daniel Schoepe <daniel.schoepe at the googlemail dot coms>
47
51
  James Taylor <james at the jamestaylor dot orgs>
48
52
  Jason Petsod <jason at the petsod dot orgs>
49
- Steve Goldman <sgoldman at the tower-research dot coms>
50
53
  Robin Burchell <viroteck at the viroteck dot nets>
54
+ Steve Goldman <sgoldman at the tower-research dot coms>
51
55
  Peter Harkins <ph at the malaprop dot orgs>
56
+ rjg-vB <rthrd at the web dot des>
52
57
  Decklin Foster <decklin at the red-bean dot coms>
53
58
  Cameron Matheson <cam+sup at the cammunism dot orgs>
54
59
  Carl Worth <cworth at the cworth dot orgs>
55
60
  Alex Vandiver <alex at the chmrr dot nets>
56
- Jeff Balogh <its.jeff.balogh at the gmail dot coms>
57
61
  Andrew Pimlott <andrew at the pimlott dot nets>
62
+ Jeff Balogh <its.jeff.balogh at the gmail dot coms>
58
63
  Matías Aguirre <matiasaguirre at the gmail dot coms>
59
64
  PaulSmecker <paul.smecker at the gmail dot coms>
60
- Per Andersson <avtobiff at the gmail dot coms>
61
65
  Ruthard Baudach <rthrd at the web dot des>
66
+ Vickenty Fesunov <kent at the setattr dot nets>
62
67
  Kornilios Kourtis <kkourt at the cslab.ece.ntua dot grs>
68
+ Antoni Kaniowski <a at the generativestuff dot coms>
63
69
  Lars Fischer <fischer at the wiwi.uni-siegen dot des>
70
+ Sharif Olorin <sio at the tesser dot orgs>
71
+ Steven Lawrance <stl at the koffein dot nets>
64
72
  madhat2r <MaDhAt2r at the dukefoo dot coms>
65
- Giorgio Lando <patroclo7 at the gmail dot coms>
66
73
  Kevin Riggle <kevinr at the free-dissociation dot coms>
74
+ Giorgio Lando <patroclo7 at the gmail dot coms>
67
75
  Benoît PIERRE <benoit.pierre at the gmail dot coms>
76
+ Seva Zhidkov <zhidkovseva at the gmail dot coms>
68
77
  Alvaro Herrera <alvherre at the alvh.no-ip dot orgs>
69
- Steven Lawrance <stl at the koffein dot nets>
70
78
  Jonah <Jonah at the GoodCoffee dot cas>
71
79
  ian <itaylor at the uark dot edus>
72
- Adam Lloyd <adam at the alloy-d dot nets>
73
- Todd Eisenberger <teisenbe at the andrew.cmu dot edus>
80
+ Simon Tatham <anakin at the pobox dot coms>
81
+ Elias Norberg <xyzzy at the kudzu dot ses>
74
82
  0xACE <0xACE at the users.noreply.github dot coms>
75
83
  MichaelRevell <mikearevell at the gmail dot coms>
76
84
  Gregor Hoffleit <gregor at the sam.mediasupervision dot des>
85
+ Adam Lloyd <adam at the alloy-d dot nets>
86
+ Todd Eisenberger <teisenbe at the andrew.cmu dot edus>
87
+ Johannes Larsen <mail at the johslarsen dot nets>
77
88
  Steven Schmeiser <steven at the schmeiser dot orgs>
78
89
  Steven Walter <swalter at the monarch.(none)>
79
- Jon M. Dugan <jdugan at the es dot nets>
80
- Horacio Sanson <horacio at the skillupjapan.co dot jps>
81
- Stefan Lundström <lundst at the snabb.(none)>
90
+ Michael Dwyer <mdwyer at the michaelmdwyer dot coms>
91
+ Kyle Hunt <Kyle_Hunt at the ymail dot coms>
82
92
  William A. Kennington III <william at the wkennington dot coms>
83
93
  akojo <atte.kojo at the gmail dot coms>
94
+ Horacio Sanson <horacio at the skillupjapan.co dot jps>
84
95
  Matthias Vallentin <vallentin at the icir dot orgs>
85
- Johannes Larsen <johs.a.larsen at the gmail dot coms>
96
+ Jon M. Dugan <jdugan at the es dot nets>
97
+ Stefan Lundström <lundst at the snabb.(none)>
86
98
  Kirill Smelkov <kirr at the landau.phys.spbu dot rus>
data/Gemfile CHANGED
@@ -1,7 +1,8 @@
1
1
  source 'https://rubygems.org/'
2
2
 
3
3
  if !RbConfig::CONFIG['arch'].include?('openbsd')
4
- gem 'xapian-ruby', '~> 1.2.15'
4
+ # update version in ext/mkrf_conf_xapian.rb as well.
5
+ gem 'xapian-ruby', '~> 1.2'
5
6
  end
6
7
 
7
8
  gemspec
@@ -1,3 +1,87 @@
1
+ == 1.0 / 2020-07-12
2
+
3
+ No changes. The version number is incremented to 1.0 to reflect the fact that
4
+ Sup is mature and no further backwards-incompatible changes are planned.
5
+
6
+ == 0.23 / 2020-07-10
7
+
8
+ * #505: Shell metacharacters in attachment filenames are no longer escaped when
9
+ saving the attachment to disk using 's'. Fixes attachments being saved with
10
+ unnecessary \ escapes in their filename. (Felix Van der Jeugt)
11
+ * When saving attachments, Sup now creates all parent directories of the
12
+ destination path. (Matthieu Rakotojaona)
13
+ * The '@' key now reloads all messages in thread view. (Seva Zhidkov)
14
+ * #517: The 'g' key now correctly opens each selected URL if multiple URLs are
15
+ under the cursor, instead of opening the last URL multiple times.
16
+ (Matthieu Rakotojaona)
17
+ * The 'g' key now works when the cursor is over a URL inside a signature block.
18
+ (Michael Dwyer)
19
+ * The 'reply-to' hook is now passed a 'message' variable, the message being
20
+ replied to, so that the hook can choose the reply mode based on properties of
21
+ the message like the list address. (Simon Tatham)
22
+ * The contacts list now shows also email addresses supplied by the
23
+ 'extra-contract-addresses' hook. (Matthieu Rakotojaona)
24
+ * #510: The micalg= parameter is now set correctly when sending
25
+ multipart/signed messages. Fixes issues with other mail clients which fail to
26
+ handle a missing micalg= parameter on signed messages. (Dan Callaghan)
27
+ * Attachments with text/plain MIME type are now correctly decoded according to
28
+ their charset= parameter. (Dan Callaghan)
29
+ * Strings returned by the 'mime-decode' hook are now kept in their original
30
+ encoding and displayed as is, instead of being wrongly transcoded.
31
+ (Dan Callaghan)
32
+ * Rendering speed of thread list views is improved. (Vickenty Fesunov)
33
+ * Fixed display width calculation for emoji. Previously, sender names and
34
+ thread subjects using emoji would be incorrectly truncated, if the terminal
35
+ emulator displays emoji as double-width. (Dan Callaghan)
36
+ * List address is parsed from the non-standard Mailing-List header used by
37
+ Groups.io. (Dan Callaghan)
38
+ * Fixed misinterpretation of quoted text where the quote uses both an
39
+ "---- Original Message ----" marker and > delimiters, for example from
40
+ Zimbra users. (Steven Lawrance)
41
+ * Added a new option 'indent_spaces' in config.yaml, to control the number of
42
+ spaces for indenting each child message when displaying the thread view.
43
+ The default remains 2. (Antoni Kaniowski)
44
+ * Attachment sizes are now displayed using standard unit abbreviations like
45
+ "MiB". (Sharif Olorin)
46
+ * Sup now gives a hint if a search query results in an empty search after
47
+ tokenization (for example, if the user tries to search for only punctuation).
48
+ (Per Andersson)
49
+ * The --list-hooks option now takes an additional option --hooks-matching, to
50
+ filter the listed hooks. (Matthieu Rakotojaona)
51
+ * Fixed ArgumentError in logging methods on Ruby 2.7. (Dan Callaghan)
52
+ * Fixed FrozenError in verified_ok? method on Ruby 2.7. (Iain Parris)
53
+ * Fixed Fixnum deprecation warnings on Ruby 2.4+. (Dan Callaghan)
54
+ * Several dependency version updates. The optimist gem replaces trollop. The
55
+ unicode-display_width gem is a new dependency.
56
+
57
+ == 0.22.1 / 2015-06-18
58
+
59
+ * Fix bug (#429) in gem build / install.
60
+
61
+ == 0.22.0 / 2015-06-16
62
+
63
+ * Use mime-types 2
64
+ * Fix ruby style (Zeger-Jan van de Weg)
65
+ * Johannes Larsen: fix long-standing bug with draft-id mixups causing
66
+ drafts to disappear.
67
+ * Various bugs and minor improvements.
68
+
69
+ == 0.21.0 / 2015-02-12
70
+
71
+ * Key binding to fetch GPG key from keyserver (Matthieu Rakotojaona)
72
+ * Replace occurences of File.exists? with File.exist? (Zeger-Jan van de
73
+ Weg)
74
+ * You can now unsubscribe from mailinglists using an url, if you have a
75
+ goto-hook setup (Timon Vonk).
76
+ * Forward attribution can be customized using the forward-attribution
77
+ hook (Ruthard Baudach)
78
+ * Do a few more checks for buffer not nil in the hope to fix a few
79
+ random crashes
80
+ * Add bash completion (Per Andersson)
81
+ * Replace dl/import with Fiddle (Timon Vonk)
82
+ * Drop support for ruby 1.9.3
83
+ * Add tests for contact manager and persons (Zeger-Jan van de Weg)
84
+
1
85
  == 0.20.0 / 2014-10-06
2
86
 
3
87
  * add man-pages (generated from wiki) (Per Andersson)!
data/README.md CHANGED
@@ -1,7 +1,8 @@
1
1
  # Sup
2
2
 
3
- A console-based email client with the best features of GMail, mutt and
4
- Emacs.
3
+ Sup is a console-based email client for people with a lot of email.
4
+
5
+ <img src="https://sup-heliotrope.github.io/images/old_screenshot_1.png" />
5
6
 
6
7
  ## Installation
7
8
 
@@ -30,20 +31,40 @@ Current limitations:
30
31
 
31
32
  ## Problems
32
33
 
33
- Please report bugs to the [Github issue tracker](https://github.com/sup-heliotrope/sup/issues).
34
+ Please report bugs to the [GitHub issue tracker](https://github.com/sup-heliotrope/sup/issues).
34
35
 
35
36
  ## Links
36
37
 
37
- * [Homepage](http://supmua.org/)
38
+ * [Homepage](https://sup-heliotrope.github.io/)
38
39
  * [Code repository](https://github.com/sup-heliotrope/sup)
39
40
  * [Wiki](https://github.com/sup-heliotrope/sup/wiki)
40
41
  * IRC: [#sup @ freenode.net](http://webchat.freenode.net/?channels=#sup)
41
42
  * Mailing list: supmua@googlegroups.com (subscribe: supmua+subscribe@googlegroups.com, archive: https://groups.google.com/d/forum/supmua )
42
43
 
44
+ ## Maintenance status
45
+
46
+ Sup is a mature, production-quality mail client. The maintainers are also
47
+ long-term users, and mainly focus on preserving the current feature set. Pull
48
+ requests are very welcome, especially to fix bugs or improve compatibility,
49
+ however pull requests for major new features are unlikely to be merged.
50
+
51
+ ## Alternatives
52
+
53
+ If Sup is missing a feature you are interested in, it might be possible to
54
+ accomplish using Sup's [powerful hooks mechanism][hooks]. Otherwise, here are
55
+ some alternatives to consider:
56
+
57
+ * [Notmuch](https://notmuchmail.org/) was inspired by Sup. There are a wide
58
+ variety of [Notmuch clients](https://notmuchmail.org/frontends/) available.
59
+ The most similar to Sup's look-and-feel is
60
+ [Alot](https://github.com/pazz/alot) &mdash; also a curses-based frontend.
61
+ Alot even ships with a built-in
62
+ [Sup theme](https://github.com/pazz/alot/blob/master/extra/themes/sup)!
63
+
43
64
  ## License
44
65
 
45
66
  ```
46
- Copyright (c) 2013 Sup developers.
67
+ Copyright (c) 2013-- Sup developers.
47
68
  Copyright (c) 2006--2009 William Morgan.
48
69
 
49
70
  This program is free software; you can redistribute it and/or
data/Rakefile CHANGED
@@ -1,4 +1,3 @@
1
- require 'rubygems'
2
1
  require 'rake/testtask'
3
2
  require "bundler/gem_tasks"
4
3
 
@@ -1,3 +1,10 @@
1
+ Release 0.21.0:
2
+
3
+ Several small features as well as polishing (including fetching a GPG key with
4
+ a shortcut and unsubscribing from mailinglist using an url). Several old
5
+ deprecated parts of sup have been modernized. Support for Ruby 1.9.3 has been
6
+ dropped. Have a look in History.txt for the details.
7
+
1
8
  Release 0.20.0:
2
9
 
3
10
  We've got man pages (Mr. Andersson)! We've got OpenBSD support (Scott Bonds)!
data/bin/sup CHANGED
@@ -3,10 +3,11 @@
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'
9
+ require 'sup/util/locale_fiddler'
10
+ require 'sup/util/axe'
10
11
 
11
12
  no_gpgme = false
12
13
  begin
@@ -16,7 +17,7 @@ rescue LoadError
16
17
  end
17
18
 
18
19
  require 'fileutils'
19
- require 'trollop'
20
+ require 'optimist'
20
21
  require "sup"
21
22
 
22
23
  if ENV['SUP_PROFILE']
@@ -28,7 +29,7 @@ if no_gpgme
28
29
  info "No 'gpgme' gem detected. Install it for email encryption, decryption and signatures."
29
30
  end
30
31
 
31
- $opts = Trollop::options do
32
+ $opts = Optimist::options do
32
33
  version "sup v#{Redwood::VERSION}"
33
34
  banner <<EOS
34
35
  Sup is a curses-based email client.
@@ -38,7 +39,8 @@ Usage:
38
39
 
39
40
  Options are:
40
41
  EOS
41
- opt :list_hooks, "List all hooks and descriptions, and quit."
42
+ opt :list_hooks, "List all hooks and descriptions, and quit. Use --hooks-matching to filter."
43
+ opt :hooks_matching, "If given, list all hooks and descriptions matching the given pattern. Needs the --list-hooks option", short: "m", default: ""
42
44
  opt :no_threads, "Turn off threading. Helps with debugging. (Necessarily disables background polling for new messages.)"
43
45
  opt :no_initial_poll, "Don't poll for new messages when starting."
44
46
  opt :search, "Search for this query upon startup", :type => String
@@ -46,7 +48,7 @@ EOS
46
48
  opt :subject, "When composing, use this subject", :type => String, :short => "j"
47
49
  end
48
50
 
49
- Trollop::die :subject, "requires --compose" if $opts[:subject] && !$opts[:compose]
51
+ Optimist::die :subject, "requires --compose" if $opts[:subject] && !$opts[:compose]
50
52
 
51
53
  Redwood::HookManager.register "startup", <<EOS
52
54
  Executes at startup
@@ -64,7 +66,7 @@ EOS
64
66
 
65
67
  if $opts[:list_hooks]
66
68
  Redwood.start
67
- Redwood::HookManager.print_hooks
69
+ Redwood::HookManager.print_hooks $opts[:hooks_matching]
68
70
  exit
69
71
  end
70
72
 
@@ -102,32 +104,17 @@ global_keymap = Keymap.new do |k|
102
104
  end
103
105
  end
104
106
 
105
- ## the following magic enables wide characters when used with a ruby
106
- ## ncurses.so that's been compiled against libncursesw. (note the w.) why
107
- ## this works, i have no idea. much like pretty much every aspect of
108
- ## dealing with curses. cargo cult programming at its best.
109
107
  require 'rbconfig'
110
- unless RbConfig::CONFIG['arch'] =~ /openbsd/
111
- require 'dl/import'
112
- module LibC
113
- extend DL.const_defined?(:Importer) ? DL::Importer : DL::Importable
114
- setlocale_lib = case RbConfig::CONFIG['arch']
115
- when /darwin/; "libc.dylib"
116
- when /cygwin/; "cygwin1.dll"
117
- when /freebsd/; "libc.so.7"
118
- else; "libc.so.6"
119
- end
120
108
 
121
- debug "dynamically loading setlocale() from #{setlocale_lib}"
122
- begin
123
- dlload setlocale_lib
124
- extern "void setlocale(int, const char *)"
125
- debug "setting locale..."
126
- LibC.setlocale(6, "") # LC_ALL == 6
127
- rescue RuntimeError => e
128
- warn "cannot dlload setlocale(); ncurses wide character support probably broken."
129
- warn "dlload error was #{e.class}: #{e.message}"
130
- end
109
+ unless RbConfig::CONFIG['arch'] =~ /openbsd/
110
+ debug "dynamically loading setlocale()"
111
+ begin
112
+ class LibC; extend LocaleFiddler; end
113
+ debug "setting locale..."
114
+ LibC.setlocale(6, "")
115
+ rescue RuntimeError => e
116
+ warn "cannot dlload setlocale(); ncurses wide character support probably broken."
117
+ warn "dlload error was #{e.class}: #{e.message}"
131
118
  end
132
119
  end
133
120
 
@@ -3,12 +3,11 @@
3
3
  $:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
4
4
 
5
5
  require 'uri'
6
- require 'rubygems'
7
- require 'highline/import'
8
- require 'trollop'
6
+ require 'optimist'
9
7
  require "sup"
8
+ require 'sup/util/axe'
10
9
 
11
- $opts = Trollop::options do
10
+ $opts = Optimist::options do
12
11
  version "sup-add (sup #{Redwood::VERSION})"
13
12
  banner <<EOS
14
13
  Adds a source to the Sup source list.
@@ -36,7 +35,7 @@ EOS
36
35
  opt :force_account, "Reuse previously defined account user@hostname.", :type => String
37
36
  end
38
37
 
39
- Trollop::die "require one or more sources" if ARGV.empty?
38
+ Optimist::die "require one or more sources" if ARGV.empty?
40
39
 
41
40
  ## for sources that require login information, prompt the user for
42
41
  ## that. also provide a list of previously-defined login info to
@@ -54,11 +53,11 @@ def get_login_info uri, sources
54
53
  if $opts[:force_account]
55
54
  host, username, password = accounts.find { |h, u, p| $opts[:force_account] == "#{u}@#{h}" }
56
55
  unless username && password
57
- say "No previous account #{$opts[:force_account].inspect} found."
56
+ @cli.say "No previous account #{$opts[:force_account].inspect} found."
58
57
  end
59
58
  else
60
- say "Would you like to use the same account as for a previous source for #{uri}?"
61
- choose do |menu|
59
+ @cli.say "Would you like to use the same account as for a previous source for #{uri}?"
60
+ @cli.choose do |menu|
62
61
  accounts.each do |host, olduser, oldpw|
63
62
  menu.choice("Use the account info for #{olduser}@#{host}") { username, password = olduser, oldpw }
64
63
  end
@@ -69,15 +68,15 @@ def get_login_info uri, sources
69
68
  end
70
69
 
71
70
  unless username && password
72
- username = ask("Username for #{uri.host}: ");
73
- password = ask("Password for #{uri.host}: ") { |q| q.echo = false }
71
+ username = @cli.ask("Username for #{uri.host}: ");
72
+ password = @cli.ask("Password for #{uri.host}: ") { |q| q.echo = false }
74
73
  puts # why?
75
74
  end
76
75
 
77
76
  [username, password]
78
77
  end
79
78
 
80
- $terminal.wrap_at = :auto
79
+ @cli.wrap_at = :auto
81
80
  Redwood::start
82
81
  index = Redwood::Index.init
83
82
  index.load
@@ -91,11 +90,11 @@ begin
91
90
  labels = $opts[:labels] ? $opts[:labels].split(/\s*,\s*/).uniq : []
92
91
 
93
92
  if !$opts[:force_new] && Redwood::SourceManager.source_for(uri)
94
- say "Already know about #{uri}; skipping."
93
+ @cli.say "Already know about #{uri}; skipping."
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
@@ -104,11 +103,11 @@ begin
104
103
  when "mbox"
105
104
  Redwood::MBox.new uri, !$opts[:unusual], $opts[:archive], nil, labels
106
105
  when nil
107
- Trollop::die "Sources must be specified with an URI"
106
+ Optimist::die "Sources must be specified with an URI"
108
107
  else
109
- Trollop::die "Unknown source type #{parsed_uri.scheme.inspect}"
108
+ Optimist::die "Unknown source type #{parsed_uri.scheme.inspect}"
110
109
  end
111
- say "Adding #{source}..."
110
+ @cli.say "Adding #{source}..."
112
111
  Redwood::SourceManager.add_source source
113
112
  end
114
113
  ensure