sup

A curses threads-with-tags style email client

sup.git

git clone https://supmua.dev/git/sup/
commit ca49d467ac8b90116b62c1b12ad009b90100603a
parent 681cdf3e3947b6afb8b5fa875b4d0790c1ce0af1
Author: Zeger-Jan van de Weg <mail@zjvandeweg.nl>
Date:   Wed,  8 Apr 2015 20:30:35 +0200

Hashes are also linked list, thus ordered

Diffstat:
M lib/sup/crypto.rb | 12 ++++++------
M lib/sup/modes/thread_view_mode.rb | 7 ++++---
M lib/sup/util.rb | 26 --------------------------
3 files changed, 10 insertions(+), 35 deletions(-)
diff --git a/lib/sup/crypto.rb b/lib/sup/crypto.rb
@@ -10,11 +10,11 @@ class CryptoManager
 
   class Error < StandardError; end
 
-  OUTGOING_MESSAGE_OPERATIONS = OrderedHash.new(
-    [:sign, "Sign"],
-    [:sign_and_encrypt, "Sign and encrypt"],
-    [:encrypt, "Encrypt only"]
-  )
+  OUTGOING_MESSAGE_OPERATIONS = {
+    sign: "Sign",
+    sign_and_encrypt: "Sign and encrypt",
+    encrypt: "Encrypt only"
+  }
 
   KEY_PATTERN = /(-----BEGIN PGP PUBLIC KEY BLOCK.*-----END PGP PUBLIC KEY BLOCK)/m
   KEYSERVER_URL = "http://pool.sks-keyservers.net:11371/pks/lookup"
@@ -476,7 +476,7 @@ private
   # elsif only one account,            then leave blank so gpg default will be user
   # else                                    set --local-user from_email_address
   # NOTE: multiple signers doesn't seem to work with gpgme (2.0.2, 1.0.8)
-  #       
+  #
   def gen_sign_user_opts from
     account = AccountManager.account_for from
     account ||= AccountManager.default_account
diff --git a/lib/sup/modes/thread_view_mode.rb b/lib/sup/modes/thread_view_mode.rb
@@ -940,9 +940,10 @@ private
         addressee_lines += format_person_list "   Bcc: ", m.bcc
       end
 
-      headers = OrderedHash.new
-      headers["Date"] = "#{m.date.to_message_nice_s} (#{m.date.to_nice_distance_s})"
-      headers["Subject"] = m.subj
+      headers = {
+        "Date" => "#{m.date.to_message_nice_s} (#{m.date.to_nice_distance_s})",
+        "Subject" => m.subj
+      }
 
       show_labels = @thread.labels - LabelManager::HIDDEN_RESERVED_LABELS
       unless show_labels.empty?
diff --git a/lib/sup/util.rb b/lib/sup/util.rb
@@ -669,32 +669,6 @@ class SavingHash
   defer_all_other_method_calls_to :hash
 end
 
-class OrderedHash < Hash
-  alias_method :store, :[]=
-  alias_method :each_pair, :each
-  attr_reader :keys
-
-  def initialize *a
-    @keys = []
-    a.each { |k, v| self[k] = v }
-  end
-
-  def []= key, val
-    @keys << key unless member?(key)
-    super
-  end
-
-  def values; keys.map { |k| self[k] } end
-  def index key; @keys.index key end
-
-  def delete key
-    @keys.delete key
-    super
-  end
-
-  def each; @keys.each { |k| yield k, self[k] } end
-end
-
 ## easy thread-safe class for determining who's the "winner" in a race (i.e.
 ## first person to hit the finish line
 class FinishLine