Commit notifications for all Sup repositories
 help / color / mirror / Atom feed
* [sup.git] branch develop updated (cf3a2e38 -> c9f29b8d)
@ 2026-10-18  1:52 Dan Callaghan
  2026-10-18  1:52 ` [sup.git] 01/06: prepend type:mail to every search before parsing Dan Callaghan
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Dan Callaghan @ 2026-10-18  1:52 UTC (permalink / raw)
  To: sup-commits

Pushed branch develop:
    from cf3a2e38 rewrite ThreadIndexMode#multi_kill to work like the other label methods
     new bcf87a86 prepend type:mail to every search before parsing
     new 38f50a6c always set MIME-Version header on outgoing mails
     new 42ee1215 unfold headers before further parsing
     new d37b2c29 delete unused load_header method
     new 70556535 move Source.parse_raw_email_header to EditMessageMode
     new c9f29b8d ncursesw: 1.4.13 → 1.4.14


Summary of changes:
 Manifest.txt                         |  1 +
 contrib/nix/Gemfile.lock             |  2 +-
 contrib/nix/gemset.nix               |  4 +--
 contrib/nix/ruby2.4-Gemfile.lock     |  2 +-
 contrib/nix/ruby2.4-gemset.nix       |  4 +--
 contrib/nix/ruby2.5-Gemfile.lock     |  2 +-
 contrib/nix/ruby2.5-gemset.nix       |  4 +--
 contrib/nix/ruby2.6-Gemfile.lock     |  2 +-
 contrib/nix/ruby2.6-gemset.nix       |  4 +--
 contrib/nix/ruby2.7-Gemfile.lock     |  2 +-
 contrib/nix/ruby2.7-gemset.nix       |  4 +--
 contrib/nix/ruby3.0-Gemfile.lock     |  2 +-
 contrib/nix/ruby3.0-gemset.nix       |  4 +--
 contrib/nix/ruby3.1-Gemfile.lock     |  2 +-
 contrib/nix/ruby3.1-gemset.nix       |  4 +--
 contrib/nix/ruby3.2-Gemfile.lock     |  2 +-
 contrib/nix/ruby3.2-gemset.nix       |  4 +--
 lib/sup/draft.rb                     |  4 ---
 lib/sup/index.rb                     |  4 +++
 lib/sup/maildir.rb                   |  4 ---
 lib/sup/mbox.rb                      | 10 --------
 lib/sup/message.rb                   |  9 +++----
 lib/sup/modes/edit_message_mode.rb   | 43 ++++++++++++++++++++++++++++++---
 lib/sup/source.rb                    | 47 ------------------------------------
 test/dummy_source.rb                 |  4 ---
 test/fixtures/folded-from-header.eml |  8 ++++++
 test/test_header_parsing.rb          | 18 +++++++-------
 test/test_message.rb                 | 15 +++++++++++-
 test/unit/test_index.rb              | 30 ++++++++++++++++++++---
 29 files changed, 131 insertions(+), 114 deletions(-)
 create mode 100644 test/fixtures/folded-from-header.eml

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [sup.git] 01/06: prepend type:mail to every search before parsing
  2026-10-18  1:52 [sup.git] branch develop updated (cf3a2e38 -> c9f29b8d) Dan Callaghan
@ 2026-10-18  1:52 ` Dan Callaghan
  2026-10-18  1:52 ` [sup.git] 02/06: always set MIME-Version header on outgoing mails Dan Callaghan
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Dan Callaghan @ 2026-10-18  1:52 UTC (permalink / raw)
  To: sup-commits

New commit on branch develop:
https://supmua.dev/git/sup/commit/bcf87a864c5543ee5daf459fd9466b5d92b57da4.html

commit bcf87a864c5543ee5daf459fd9466b5d92b57da4
Author: Dan Callaghan <djc@djc.id.au>
AuthorDate: Sun Oct 11 16:25:12 2026 +1100

    prepend type:mail to every search before parsing
    
    The type:mail term matches everything in the index. This works around
    Xapian's QueryParser refusing to parse a query containing only negated
    terms.
    
    Fixes #250.
---
 lib/sup/index.rb        |  4 ++++
 test/unit/test_index.rb | 30 +++++++++++++++++++++++++++---
 2 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/lib/sup/index.rb b/lib/sup/index.rb
index 70afc8d7..82f28657 100644
--- a/lib/sup/index.rb
+++ b/lib/sup/index.rb
@@ -406,11 +406,15 @@ EOS
     query = {}
 
     subs = HookManager.run("custom-search", :subs => s) || s
+
+    subs = "type:mail #{subs}"
+
     begin
       subs = SearchManager.expand subs
     rescue SearchManager::ExpansionError => e
       raise ParseError, e.message
     end
+
     subs = subs.gsub(/\b(to|from):(\S+)\b/) do
       field, value = $1, $2
       email_field, name_field = %w(email name).map { |x| "#{field}_#{x}" }
diff --git a/test/unit/test_index.rb b/test/unit/test_index.rb
index 3f2bc213..08221aa2 100644
--- a/test/unit/test_index.rb
+++ b/test/unit/test_index.rb
@@ -32,34 +32,58 @@ class TestIndex < Minitest::Test
     parsed = with_fake_time do
       Redwood::Index.parse_query "after:yesterday"
     end
-    expected_qobj = Xapian::Query.new(
+    expected_date_qobj = Xapian::Query.new(
       Xapian::Query::OP_VALUE_RANGE,
       Redwood::Index::DATE_VALUENO,
       Xapian.sortable_serialise(Time.utc(2000, 1, 1).to_i),
       Xapian.sortable_serialise(2**32),
     )
+    expected_qobj = Xapian::Query.new(
+      0.0,
+      Xapian::Query.new(
+        Xapian::Query::OP_AND,
+        expected_date_qobj,
+        Xapian::Query.new("Kmail"),
+      ),
+    )
     assert_equal expected_qobj.description, parsed[:qobj].description
 
     parsed = with_fake_time do
       Redwood::Index.parse_query "before:yesterday"
     end
-    expected_qobj = Xapian::Query.new(
+    expected_date_qobj = Xapian::Query.new(
       Xapian::Query::OP_VALUE_RANGE,
       Redwood::Index::DATE_VALUENO,
       Xapian.sortable_serialise(0),
       Xapian.sortable_serialise(Time.utc(2000, 1, 1).to_i),
     )
+    expected_qobj = Xapian::Query.new(
+      0.0,
+      Xapian::Query.new(
+        Xapian::Query::OP_AND,
+        expected_date_qobj,
+        Xapian::Query.new("Kmail"),
+      ),
+    )
     assert_equal expected_qobj.description, parsed[:qobj].description
 
     parsed = with_fake_time do
       Redwood::Index.parse_query "during:yesterday"
     end
-    expected_qobj = Xapian::Query.new(
+    expected_date_qobj = Xapian::Query.new(
       Xapian::Query::OP_VALUE_RANGE,
       Redwood::Index::DATE_VALUENO,
       Xapian.sortable_serialise(Time.utc(1999, 12, 31).to_i),
       Xapian.sortable_serialise(Time.utc(2000,  1,  1).to_i),
     )
+    expected_qobj = Xapian::Query.new(
+      0.0,
+      Xapian::Query.new(
+        Xapian::Query::OP_AND,
+        expected_date_qobj,
+        Xapian::Query.new("Kmail"),
+      ),
+    )
     assert_equal expected_qobj.description, parsed[:qobj].description
   end
 end

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [sup.git] 02/06: always set MIME-Version header on outgoing mails
  2026-10-18  1:52 [sup.git] branch develop updated (cf3a2e38 -> c9f29b8d) Dan Callaghan
  2026-10-18  1:52 ` [sup.git] 01/06: prepend type:mail to every search before parsing Dan Callaghan
@ 2026-10-18  1:52 ` Dan Callaghan
  2026-10-18  1:52 ` [sup.git] 03/06: unfold headers before further parsing Dan Callaghan
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Dan Callaghan @ 2026-10-18  1:52 UTC (permalink / raw)
  To: sup-commits

New commit on branch develop:
https://supmua.dev/git/sup/commit/38f50a6ce02eaaa0041407e149a7480fc04cea70.html

commit 38f50a6ce02eaaa0041407e149a7480fc04cea70
Author: Dan Callaghan <djc@djc.id.au>
AuthorDate: Sun Oct 11 16:32:24 2026 +1100

    always set MIME-Version header on outgoing mails
    
    Sup unconditionally fills Content-Type and Content-Transfer-Encoding
    headers and these are supposedly MIME headers, and thus a corresponding
    MIME-Version header is also required.
    
    Rspamd applies a penalty to mails originating from Sup because of the
    missing MIME-Version header.
    
    Add MIME-Version unconditionally.
    
    Also move the Content-Type header down lower to sit alongside
    Content-Transfer-Encoding, rather than at the very top of the message,
    just for tidiness' sake.
---
 lib/sup/modes/edit_message_mode.rb | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/sup/modes/edit_message_mode.rb b/lib/sup/modes/edit_message_mode.rb
index a9978cd3..8cba15ba 100644
--- a/lib/sup/modes/edit_message_mode.rb
+++ b/lib/sup/modes/edit_message_mode.rb
@@ -553,7 +553,6 @@ protected
 
   def build_message date
     m = RMail::Message.new
-    m.header["Content-Type"] = "text/plain; charset=#{$encoding}"
     m.body = @body.join("\n")
     m.body += "\n" + sig_lines.join("\n") unless @sig_edited
     ## body must end in a newline or GPG signatures will be WRONG!
@@ -601,8 +600,9 @@ protected
     m.header["Date"] = date.rfc2822
     m.header["Message-Id"] = @message_id
     m.header["User-Agent"] = "Sup/#{Redwood::VERSION}"
+    m.header["Content-Type"] = "text/plain; charset=#{$encoding}"
     m.header["Content-Transfer-Encoding"] ||= +"8bit"
-    m.header["MIME-Version"] = +"1.0" if m.multipart?
+    m.header["MIME-Version"] = +"1.0"
     m
   end
 

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [sup.git] 03/06: unfold headers before further parsing
  2026-10-18  1:52 [sup.git] branch develop updated (cf3a2e38 -> c9f29b8d) Dan Callaghan
  2026-10-18  1:52 ` [sup.git] 01/06: prepend type:mail to every search before parsing Dan Callaghan
  2026-10-18  1:52 ` [sup.git] 02/06: always set MIME-Version header on outgoing mails Dan Callaghan
@ 2026-10-18  1:52 ` Dan Callaghan
  2026-10-18  1:52 ` [sup.git] 04/06: delete unused load_header method Dan Callaghan
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Dan Callaghan @ 2026-10-18  1:52 UTC (permalink / raw)
  To: sup-commits

New commit on branch develop:
https://supmua.dev/git/sup/commit/42ee12157508704adbd4869a252be45c759c4b05.html

commit 42ee12157508704adbd4869a252be45c759c4b05
Author: Dan Callaghan <djc@djc.id.au>
AuthorDate: Sat Oct 17 11:00:31 2026 +1100

    unfold headers before further parsing
    
    Fixes handling of From headers where a CRLF fold appears inside the
    quoted name portion.
---
 Manifest.txt                         |  1 +
 lib/sup/message.rb                   |  5 ++++-
 test/fixtures/folded-from-header.eml |  8 ++++++++
 test/test_message.rb                 | 15 ++++++++++++++-
 4 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/Manifest.txt b/Manifest.txt
index a05e069e..768c91b5 100644
--- a/Manifest.txt
+++ b/Manifest.txt
@@ -146,6 +146,7 @@ test/fixtures/blank-header-fields.eml
 test/fixtures/contacts.txt
 test/fixtures/embedded-message-rfc6532.eml
 test/fixtures/embedded-message.eml
+test/fixtures/folded-from-header.eml
 test/fixtures/invalid-date.eml
 test/fixtures/mailing-list-header.eml
 test/fixtures/malicious-attachment-names.eml
diff --git a/lib/sup/message.rb b/lib/sup/message.rb
index 35f78256..24e5464c 100644
--- a/lib/sup/message.rb
+++ b/lib/sup/message.rb
@@ -72,9 +72,12 @@ class Message
     return unless v
     return v unless v.is_a? String
     return unless v.size < MAX_HEADER_VALUE_SIZE # avoid regex blowup on spam
+    ## Unfold per RFC 5322 2.2.3: remove each CRLF immediately followed
+    ## by WSP, leaving the WSP in place.
+    v = v.gsub(/\r?\n(?=[ \t])/, "")
     ## Header values should be either 7-bit with RFC2047-encoded words
     ## or UTF-8 as per RFC6532. Replace any invalid high bytes with U+FFFD.
-    Rfc2047.decode_to $encoding, v.dup.force_encoding(Encoding::UTF_8).scrub
+    Rfc2047.decode_to $encoding, v.force_encoding(Encoding::UTF_8).scrub
   end
 
   def parse_header encoded_header
diff --git a/test/fixtures/folded-from-header.eml b/test/fixtures/folded-from-header.eml
new file mode 100644
index 00000000..3a56ed31
--- /dev/null
+++ b/test/fixtures/folded-from-header.eml
@@ -0,0 +1,8 @@
+From: "Kevin Frazier, Juliana Schroeder, Brian Frye, Nathanael Fast,
+ and Rob Greer" <user@rss2email.invalid>
+To: someone@example.invalid
+Subject: folded From header
+Date: Fri, 16 Oct 2026 10:00:00 +0000
+Message-Id: <folded-from-header@example.invalid>
+
+body
diff --git a/test/test_message.rb b/test/test_message.rb
index 1e5c431b..097ceb8a 100644
--- a/test/test_message.rb
+++ b/test/test_message.rb
@@ -234,12 +234,25 @@ class TestMessage < Minitest::Test
 
     # Look at another header field whose first line was blank.
     list_unsubscribe = sup_message.list_unsubscribe
-    assert_equal("<http://mailman2.widget.com/mailman/listinfo/monitor-list>,\n\t" +
+    assert_equal("<http://mailman2.widget.com/mailman/listinfo/monitor-list>,\t" +
                  "<mailto:monitor-list-request@widget.com?subject=unsubscribe>",
                  list_unsubscribe)
 
   end
 
+  def test_folded_from_header
+    source = DummySource.new("sup-test://test_folded_from_header")
+    source.messages = [ fixture_path("folded-from-header.eml") ]
+    source_info = 0
+
+    sup_message = Message.build_from_source(source, source_info)
+    sup_message.load_from_source!
+
+    assert_equal "Kevin Frazier, Juliana Schroeder, Brian Frye, " +
+                 "Nathanael Fast, and Rob Greer", sup_message.from.name
+    assert_equal "user@rss2email.invalid", sup_message.from.email
+  end
+
   def test_rfc2047_header_encoding
     source = DummySource.new("sup-test://test_rfc2047_header_encoding")
     source.messages = [ fixture_path("rfc2047-header-encoding.eml") ]

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [sup.git] 04/06: delete unused load_header method
  2026-10-18  1:52 [sup.git] branch develop updated (cf3a2e38 -> c9f29b8d) Dan Callaghan
                   ` (2 preceding siblings ...)
  2026-10-18  1:52 ` [sup.git] 03/06: unfold headers before further parsing Dan Callaghan
@ 2026-10-18  1:52 ` Dan Callaghan
  2026-10-18  1:52 ` [sup.git] 05/06: move Source.parse_raw_email_header to EditMessageMode Dan Callaghan
  2026-10-18  1:52 ` [sup.git] 06/06: ncursesw: 1.4.13 → 1.4.14 Dan Callaghan
  5 siblings, 0 replies; 7+ messages in thread
From: Dan Callaghan @ 2026-10-18  1:52 UTC (permalink / raw)
  To: sup-commits

New commit on branch develop:
https://supmua.dev/git/sup/commit/d37b2c2965c5e164207e2021eee9e83ea08079d5.html

commit d37b2c2965c5e164207e2021eee9e83ea08079d5
Author: Dan Callaghan <djc@djc.id.au>
AuthorDate: Sat Oct 17 13:09:39 2026 +1100

    delete unused load_header method
---
 lib/sup/draft.rb     |  4 ----
 lib/sup/maildir.rb   |  4 ----
 lib/sup/mbox.rb      | 10 ----------
 lib/sup/message.rb   |  4 ----
 lib/sup/source.rb    |  1 -
 test/dummy_source.rb |  4 ----
 6 files changed, 27 deletions(-)

diff --git a/lib/sup/draft.rb b/lib/sup/draft.rb
index 775f796a..2428f113 100644
--- a/lib/sup/draft.rb
+++ b/lib/sup/draft.rb
@@ -70,10 +70,6 @@ class DraftLoader < Source
 
   def fn_for_offset o; File.join(@dir, o.to_s); end
 
-  def load_header offset
-    File.open(fn_for_offset(offset)) { |f| parse_raw_email_header f }
-  end
-
   def load_message offset
     raise SourceError, "Draft not found" unless File.exist? fn_for_offset(offset)
     File.open(fn_for_offset(offset)) do |f|
diff --git a/lib/sup/maildir.rb b/lib/sup/maildir.rb
index 1c3aecd1..488698f1 100644
--- a/lib/sup/maildir.rb
+++ b/lib/sup/maildir.rb
@@ -84,10 +84,6 @@ class Maildir < Source
     end
   end
 
-  def load_header id
-    with_file_for(id) { |f| parse_raw_email_header f }
-  end
-
   def load_message id
     with_file_for(id) { |f| RMail::Parser.read f }
   end
diff --git a/lib/sup/mbox.rb b/lib/sup/mbox.rb
index 04dc47b0..471b89a6 100644
--- a/lib/sup/mbox.rb
+++ b/lib/sup/mbox.rb
@@ -69,16 +69,6 @@ class MBox < Source
     end
   end
 
-  def load_header offset
-    header = nil
-    @mutex.synchronize do
-      ensure_open
-      @f.seek offset
-      header = parse_raw_email_header @f
-    end
-    header
-  end
-
   def load_message offset
     @mutex.synchronize do
       ensure_open
diff --git a/lib/sup/message.rb b/lib/sup/message.rb
index 24e5464c..ce5e1757 100644
--- a/lib/sup/message.rb
+++ b/lib/sup/message.rb
@@ -48,8 +48,6 @@ class Message
 
   attr_accessor :locations
 
-  ## if you specify a :header, will use values from that. otherwise,
-  ## will try and load the header from the source.
   def initialize opts
     @locations = opts[:locations] or raise ArgumentError, "locations can't be nil"
     @snippet = opts[:snippet]
@@ -64,8 +62,6 @@ class Message
     ## we need to initialize this. see comments in parse_header as to
     ## why.
     @refs = []
-
-    #parse_header(opts[:header] || @source.load_header(@source_info))
   end
 
   def decode_header_field v
diff --git a/lib/sup/source.rb b/lib/sup/source.rb
index 4d672cae..29120c18 100644
--- a/lib/sup/source.rb
+++ b/lib/sup/source.rb
@@ -33,7 +33,6 @@ class Source
   ## To write a new source, subclass this class, and implement:
   ##
   ## - initialize
-  ## - load_header offset
   ## - load_message offset
   ## - raw_header offset
   ## - raw_message offset
diff --git a/test/dummy_source.rb b/test/dummy_source.rb
index 1e2492a0..0389db2c 100644
--- a/test/dummy_source.rb
+++ b/test/dummy_source.rb
@@ -32,10 +32,6 @@ class DummySource < Source
     File.open(fn, 'rb') { |f| yield f }
   end
 
-  def load_header id
-    with_file_for(id) { |f| parse_raw_email_header f }
-  end
-
   def load_message id
     with_file_for(id) { |f| RMail::Parser.read f }
   end

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [sup.git] 05/06: move Source.parse_raw_email_header to EditMessageMode
  2026-10-18  1:52 [sup.git] branch develop updated (cf3a2e38 -> c9f29b8d) Dan Callaghan
                   ` (3 preceding siblings ...)
  2026-10-18  1:52 ` [sup.git] 04/06: delete unused load_header method Dan Callaghan
@ 2026-10-18  1:52 ` Dan Callaghan
  2026-10-18  1:52 ` [sup.git] 06/06: ncursesw: 1.4.13 → 1.4.14 Dan Callaghan
  5 siblings, 0 replies; 7+ messages in thread
From: Dan Callaghan @ 2026-10-18  1:52 UTC (permalink / raw)
  To: sup-commits

New commit on branch develop:
https://supmua.dev/git/sup/commit/7055653583756e8d35928158f50dd7a0accf61ef.html

commit 7055653583756e8d35928158f50dd7a0accf61ef
Author: Dan Callaghan <djc@djc.id.au>
AuthorDate: Sat Oct 17 13:54:32 2026 +1100

    move Source.parse_raw_email_header to EditMessageMode
    
    This method was originally used to parse all mail headers for indexing
    and display, but nowadays Sup uses RMail for this purpose instead. The
    only remaining caller of this method is EditMessageMode when loading
    messages composed by the user in their editor.
    
    Since this parsing behaviour is looser than Rmail, and maybe more
    friendly for humans editing mail by hand in their editor, preserve it as
    is but move it to EditMessageMode so its actual purpose is clear. And
    remove the inaccurate comment about being "speed-critical".
---
 lib/sup/modes/edit_message_mode.rb | 39 +++++++++++++++++++++++++++++++-
 lib/sup/source.rb                  | 46 --------------------------------------
 test/test_header_parsing.rb        | 18 +++++++--------
 3 files changed, 47 insertions(+), 56 deletions(-)

diff --git a/lib/sup/modes/edit_message_mode.rb b/lib/sup/modes/edit_message_mode.rb
index 8cba15ba..e69a9bcc 100644
--- a/lib/sup/modes/edit_message_mode.rb
+++ b/lib/sup/modes/edit_message_mode.rb
@@ -451,9 +451,46 @@ protected
     end
   end
 
+  ## utility method to read a raw email header from an IO stream and turn it
+  ## into a hash of key-value pairs. minor special semantics for certain headers.
+  def self.parse_raw_email_header f
+    header = {}
+    last = nil
+
+    while(line = f.gets)
+      case line
+      ## these three can occur multiple times, and we want the first one
+      when /^(Delivered-To|X-Original-To|Envelope-To):\s*(.*?)\s*$/i; header[last = $1.downcase] ||= $2
+      ## regular header: overwrite (not that we should see more than one)
+      ## TODO: figure out whether just using the first occurrence changes
+      ## anything (which would simplify the logic slightly)
+      when /^([^:\s]+):\s*(.*?)\s*$/i; header[last = $1.downcase] = $2
+      when /^\r*$/; break # blank line signifies end of header
+      else
+        if last
+          header[last] << " " unless header[last].empty?
+          header[last] << line.strip
+        end
+      end
+    end
+
+    %w(subject from to cc bcc).each do |k|
+      v = header[k] or next
+      next unless Rfc2047.is_encoded? v
+      header[k] = begin
+        Rfc2047.decode_to $encoding, v
+      rescue Errno::EINVAL, Iconv::InvalidEncoding, Iconv::IllegalSequence
+        v
+      end
+    end
+    header
+  end
+
+  def parse_raw_email_header f; self.class.parse_raw_email_header f end
+
   def parse_file fn
     File.open(fn) do |f|
-      header = Source.parse_raw_email_header(f).inject({}) { |h, (k, v)| h[k.capitalize] = v; h } # lousy HACK
+      header = parse_raw_email_header(f).inject({}) { |h, (k, v)| h[k.capitalize] = v; h } # lousy HACK
       body = f.readlines.map { |l| l.chomp }
 
       header.delete_if { |k, v| NON_EDITABLE_HEADERS.member? k }
diff --git a/lib/sup/source.rb b/lib/sup/source.rb
index 29120c18..56d2e7d7 100644
--- a/lib/sup/source.rb
+++ b/lib/sup/source.rb
@@ -121,52 +121,6 @@ class Source
     debug "lock released for: #{self}"
   end
 
-  ## utility method to read a raw email header from an IO stream and turn it
-  ## into a hash of key-value pairs. minor special semantics for certain headers.
-  ##
-  ## THIS IS A SPEED-CRITICAL SECTION. Everything you do here will have a
-  ## significant effect on Sup's processing speed of email from ALL sources.
-  ## Little things like string interpolation, regexp interpolation, += vs <<,
-  ## all have DRAMATIC effects. BE CAREFUL WHAT YOU DO!
-  def self.parse_raw_email_header f
-    header = {}
-    last = nil
-
-    while(line = f.gets)
-      case line
-      ## these three can occur multiple times, and we want the first one
-      when /^(Delivered-To|X-Original-To|Envelope-To):\s*(.*?)\s*$/i; header[last = $1.downcase] ||= $2
-      ## regular header: overwrite (not that we should see more than one)
-      ## TODO: figure out whether just using the first occurrence changes
-      ## anything (which would simplify the logic slightly)
-      when /^([^:\s]+):\s*(.*?)\s*$/i; header[last = $1.downcase] = $2
-      when /^\r*$/; break # blank line signifies end of header
-      else
-        if last
-          header[last] << " " unless header[last].empty?
-          header[last] << line.strip
-        end
-      end
-    end
-
-    %w(subject from to cc bcc).each do |k|
-      v = header[k] or next
-      next unless Rfc2047.is_encoded? v
-      header[k] = begin
-        Rfc2047.decode_to $encoding, v
-      rescue Errno::EINVAL, Iconv::InvalidEncoding, Iconv::IllegalSequence
-        #debug "warning: error decoding RFC 2047 header (#{e.class.name}): #{e.message}"
-        v
-      end
-    end
-    header
-  end
-
-protected
-
-  ## convenience function
-  def parse_raw_email_header f; self.class.parse_raw_email_header f end
-
   def Source.expand_filesystem_uri uri
     uri.gsub "~", File.expand_path("~")
   end
diff --git a/test/test_header_parsing.rb b/test/test_header_parsing.rb
index 7008834f..5ccc20ea 100644
--- a/test/test_header_parsing.rb
+++ b/test/test_header_parsing.rb
@@ -24,7 +24,7 @@ class TestMBoxParsing < Minitest::Test
   end
 
   def test_normal_headers
-    h = Source.parse_raw_email_header StringIO.new(<<EOS)
+    h = EditMessageMode.parse_raw_email_header StringIO.new(<<EOS)
 From: Bob <bob@bob.com>
 To: Sally <sally@sally.com>
 EOS
@@ -35,7 +35,7 @@ EOS
   end
 
   def test_multiline
-    h = Source.parse_raw_email_header StringIO.new(<<EOS)
+    h = EditMessageMode.parse_raw_email_header StringIO.new(<<EOS)
 From: Bob <bob@bob.com>
 Subject: one two three
   four five six
@@ -57,7 +57,7 @@ EOS
       "Subject:   one two  three   end    \n",
     ]
     variants.each do |s|
-      h = Source.parse_raw_email_header StringIO.new(s)
+      h = EditMessageMode.parse_raw_email_header StringIO.new(s)
       assert_equal "one two  three   end", h["subject"]
     end
   end
@@ -68,13 +68,13 @@ EOS
       "Message-Id:<one@bob.com>       \n",
     ]
     variants.each do |s|
-      h = Source.parse_raw_email_header StringIO.new(s)
+      h = EditMessageMode.parse_raw_email_header StringIO.new(s)
       assert_equal "<one@bob.com>", h["message-id"]
     end
   end
 
   def test_blank_lines
-    h = Source.parse_raw_email_header StringIO.new("")
+    h = EditMessageMode.parse_raw_email_header StringIO.new("")
     assert_nil h["message-id"]
   end
 
@@ -84,13 +84,13 @@ EOS
       "Message-Id:\n",
     ]
     variants.each do |s|
-      h = Source.parse_raw_email_header StringIO.new(s)
+      h = EditMessageMode.parse_raw_email_header StringIO.new(s)
       assert_equal "", h["message-id"]
     end
   end
 
   def test_detect_end_of_headers
-    h = Source.parse_raw_email_header StringIO.new(<<EOS)
+    h = EditMessageMode.parse_raw_email_header StringIO.new(<<EOS)
 From: Bob <bob@bob.com>
 
 To: a dear friend
@@ -98,7 +98,7 @@ EOS
   assert_equal "Bob <bob@bob.com>", h["from"]
   assert_nil h["to"]
 
-  h = Source.parse_raw_email_header StringIO.new(<<EOS)
+  h = EditMessageMode.parse_raw_email_header StringIO.new(<<EOS)
 From: Bob <bob@bob.com>
 \r
 To: a dear friend
@@ -106,7 +106,7 @@ EOS
   assert_equal "Bob <bob@bob.com>", h["from"]
   assert_nil h["to"]
 
-  h = Source.parse_raw_email_header StringIO.new(<<EOS)
+  h = EditMessageMode.parse_raw_email_header StringIO.new(<<EOS)
 From: Bob <bob@bob.com>
 \r\n\r
 To: a dear friend

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [sup.git] 06/06: ncursesw: 1.4.13 → 1.4.14
  2026-10-18  1:52 [sup.git] branch develop updated (cf3a2e38 -> c9f29b8d) Dan Callaghan
                   ` (4 preceding siblings ...)
  2026-10-18  1:52 ` [sup.git] 05/06: move Source.parse_raw_email_header to EditMessageMode Dan Callaghan
@ 2026-10-18  1:52 ` Dan Callaghan
  5 siblings, 0 replies; 7+ messages in thread
From: Dan Callaghan @ 2026-10-18  1:52 UTC (permalink / raw)
  To: sup-commits

New commit on branch develop:
https://supmua.dev/git/sup/commit/c9f29b8dbb57c4f6d3eeafd014391110d0686883.html

commit c9f29b8dbb57c4f6d3eeafd014391110d0686883
Author: Dan Callaghan <djc@djc.id.au>
AuthorDate: Sat Oct 17 14:33:28 2026 +1100

    ncursesw: 1.4.13 → 1.4.14
---
 contrib/nix/Gemfile.lock         | 2 +-
 contrib/nix/gemset.nix           | 4 ++--
 contrib/nix/ruby2.4-Gemfile.lock | 2 +-
 contrib/nix/ruby2.4-gemset.nix   | 4 ++--
 contrib/nix/ruby2.5-Gemfile.lock | 2 +-
 contrib/nix/ruby2.5-gemset.nix   | 4 ++--
 contrib/nix/ruby2.6-Gemfile.lock | 2 +-
 contrib/nix/ruby2.6-gemset.nix   | 4 ++--
 contrib/nix/ruby2.7-Gemfile.lock | 2 +-
 contrib/nix/ruby2.7-gemset.nix   | 4 ++--
 contrib/nix/ruby3.0-Gemfile.lock | 2 +-
 contrib/nix/ruby3.0-gemset.nix   | 4 ++--
 contrib/nix/ruby3.1-Gemfile.lock | 2 +-
 contrib/nix/ruby3.1-gemset.nix   | 4 ++--
 contrib/nix/ruby3.2-Gemfile.lock | 2 +-
 contrib/nix/ruby3.2-gemset.nix   | 4 ++--
 16 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/contrib/nix/Gemfile.lock b/contrib/nix/Gemfile.lock
index 32a29b24..f0244147 100644
--- a/contrib/nix/Gemfile.lock
+++ b/contrib/nix/Gemfile.lock
@@ -25,7 +25,7 @@ GEM
     mime-types-data (3.2026.0922)
     mini_portile2 (2.8.9)
     minitest (5.27.0)
-    ncursesw (1.4.13)
+    ncursesw (1.4.14)
     optimist (3.2.1)
     parallel (2.2.0)
     parser (3.3.12.0)
diff --git a/contrib/nix/gemset.nix b/contrib/nix/gemset.nix
index adb5ed3e..184e8ba1 100644
--- a/contrib/nix/gemset.nix
+++ b/contrib/nix/gemset.nix
@@ -198,10 +198,10 @@
     platforms = [];
     source = {
       remotes = ["https://rubygems.org"];
-      sha256 = "1x06374njjl4xfxwkp6nq71akhazmqp9fyhkgxf6gac81p5wwdk6";
+      sha256 = "1dgc3hzgc0w3mbcvyhwjn0vng81dkibcgd73jx0br2p1a41l6sdp";
       type = "gem";
     };
-    version = "1.4.13";
+    version = "1.4.14";
   };
   optimist = {
     groups = ["default"];
diff --git a/contrib/nix/ruby2.4-Gemfile.lock b/contrib/nix/ruby2.4-Gemfile.lock
index 26b4a4e3..2a364603 100644
--- a/contrib/nix/ruby2.4-Gemfile.lock
+++ b/contrib/nix/ruby2.4-Gemfile.lock
@@ -17,7 +17,7 @@ GEM
     mime-types-data (3.2022.0105)
     mini_portile2 (2.8.0)
     minitest (5.15.0)
-    ncursesw (1.4.13)
+    ncursesw (1.4.14)
     optimist (3.0.1)
     parallel (1.20.1)
     parser (3.1.2.0)
diff --git a/contrib/nix/ruby2.4-gemset.nix b/contrib/nix/ruby2.4-gemset.nix
index 0a98f80c..eddeb8c0 100644
--- a/contrib/nix/ruby2.4-gemset.nix
+++ b/contrib/nix/ruby2.4-gemset.nix
@@ -146,10 +146,10 @@
     platforms = [];
     source = {
       remotes = ["https://rubygems.org"];
-      sha256 = "1x06374njjl4xfxwkp6nq71akhazmqp9fyhkgxf6gac81p5wwdk6";
+      sha256 = "1dgc3hzgc0w3mbcvyhwjn0vng81dkibcgd73jx0br2p1a41l6sdp";
       type = "gem";
     };
-    version = "1.4.13";
+    version = "1.4.14";
   };
   optimist = {
     groups = ["default"];
diff --git a/contrib/nix/ruby2.5-Gemfile.lock b/contrib/nix/ruby2.5-Gemfile.lock
index 91c84045..d2f654cb 100644
--- a/contrib/nix/ruby2.5-Gemfile.lock
+++ b/contrib/nix/ruby2.5-Gemfile.lock
@@ -17,7 +17,7 @@ GEM
     mime-types-data (3.2022.0105)
     mini_portile2 (2.8.0)
     minitest (5.16.2)
-    ncursesw (1.4.13)
+    ncursesw (1.4.14)
     optimist (3.0.1)
     parallel (1.22.1)
     parser (3.1.2.0)
diff --git a/contrib/nix/ruby2.5-gemset.nix b/contrib/nix/ruby2.5-gemset.nix
index 15bb17af..d66c1678 100644
--- a/contrib/nix/ruby2.5-gemset.nix
+++ b/contrib/nix/ruby2.5-gemset.nix
@@ -146,10 +146,10 @@
     platforms = [];
     source = {
       remotes = ["https://rubygems.org"];
-      sha256 = "1x06374njjl4xfxwkp6nq71akhazmqp9fyhkgxf6gac81p5wwdk6";
+      sha256 = "1dgc3hzgc0w3mbcvyhwjn0vng81dkibcgd73jx0br2p1a41l6sdp";
       type = "gem";
     };
-    version = "1.4.13";
+    version = "1.4.14";
   };
   optimist = {
     groups = ["default"];
diff --git a/contrib/nix/ruby2.6-Gemfile.lock b/contrib/nix/ruby2.6-Gemfile.lock
index 51286afe..c225e596 100644
--- a/contrib/nix/ruby2.6-Gemfile.lock
+++ b/contrib/nix/ruby2.6-Gemfile.lock
@@ -18,7 +18,7 @@ GEM
     mime-types-data (3.2022.0105)
     mini_portile2 (2.8.5)
     minitest (5.16.2)
-    ncursesw (1.4.13)
+    ncursesw (1.4.14)
     optimist (3.0.1)
     parallel (1.22.1)
     parser (3.1.2.0)
diff --git a/contrib/nix/ruby2.6-gemset.nix b/contrib/nix/ruby2.6-gemset.nix
index f6319668..1d3faccc 100644
--- a/contrib/nix/ruby2.6-gemset.nix
+++ b/contrib/nix/ruby2.6-gemset.nix
@@ -156,10 +156,10 @@
     platforms = [];
     source = {
       remotes = ["https://rubygems.org"];
-      sha256 = "1x06374njjl4xfxwkp6nq71akhazmqp9fyhkgxf6gac81p5wwdk6";
+      sha256 = "1dgc3hzgc0w3mbcvyhwjn0vng81dkibcgd73jx0br2p1a41l6sdp";
       type = "gem";
     };
-    version = "1.4.13";
+    version = "1.4.14";
   };
   optimist = {
     groups = ["default"];
diff --git a/contrib/nix/ruby2.7-Gemfile.lock b/contrib/nix/ruby2.7-Gemfile.lock
index f616302a..7da79305 100644
--- a/contrib/nix/ruby2.7-Gemfile.lock
+++ b/contrib/nix/ruby2.7-Gemfile.lock
@@ -19,7 +19,7 @@ GEM
     mime-types-data (3.2024.0305)
     mini_portile2 (2.8.6)
     minitest (5.22.3)
-    ncursesw (1.4.13)
+    ncursesw (1.4.14)
     optimist (3.1.0)
     parallel (1.24.0)
     parser (3.3.0.5)
diff --git a/contrib/nix/ruby2.7-gemset.nix b/contrib/nix/ruby2.7-gemset.nix
index ff0e5e05..5f863c39 100644
--- a/contrib/nix/ruby2.7-gemset.nix
+++ b/contrib/nix/ruby2.7-gemset.nix
@@ -166,10 +166,10 @@
     platforms = [];
     source = {
       remotes = ["https://rubygems.org"];
-      sha256 = "1x06374njjl4xfxwkp6nq71akhazmqp9fyhkgxf6gac81p5wwdk6";
+      sha256 = "1dgc3hzgc0w3mbcvyhwjn0vng81dkibcgd73jx0br2p1a41l6sdp";
       type = "gem";
     };
-    version = "1.4.13";
+    version = "1.4.14";
   };
   optimist = {
     groups = ["default"];
diff --git a/contrib/nix/ruby3.0-Gemfile.lock b/contrib/nix/ruby3.0-Gemfile.lock
index 39a6d5fb..0baa7419 100644
--- a/contrib/nix/ruby3.0-Gemfile.lock
+++ b/contrib/nix/ruby3.0-Gemfile.lock
@@ -19,7 +19,7 @@ GEM
     mime-types-data (3.2024.0305)
     mini_portile2 (2.8.6)
     minitest (5.22.3)
-    ncursesw (1.4.13)
+    ncursesw (1.4.14)
     optimist (3.1.0)
     parallel (1.24.0)
     parser (3.3.0.5)
diff --git a/contrib/nix/ruby3.0-gemset.nix b/contrib/nix/ruby3.0-gemset.nix
index 8308a9eb..5a619c12 100644
--- a/contrib/nix/ruby3.0-gemset.nix
+++ b/contrib/nix/ruby3.0-gemset.nix
@@ -166,10 +166,10 @@
     platforms = [];
     source = {
       remotes = ["https://rubygems.org"];
-      sha256 = "1x06374njjl4xfxwkp6nq71akhazmqp9fyhkgxf6gac81p5wwdk6";
+      sha256 = "1dgc3hzgc0w3mbcvyhwjn0vng81dkibcgd73jx0br2p1a41l6sdp";
       type = "gem";
     };
-    version = "1.4.13";
+    version = "1.4.14";
   };
   optimist = {
     groups = ["default"];
diff --git a/contrib/nix/ruby3.1-Gemfile.lock b/contrib/nix/ruby3.1-Gemfile.lock
index 20beb05f..d4759ebc 100644
--- a/contrib/nix/ruby3.1-Gemfile.lock
+++ b/contrib/nix/ruby3.1-Gemfile.lock
@@ -23,7 +23,7 @@ GEM
     mime-types-data (3.2025.0402)
     mini_portile2 (2.8.8)
     minitest (5.25.5)
-    ncursesw (1.4.13)
+    ncursesw (1.4.14)
     optimist (3.2.1)
     parallel (1.26.3)
     parser (3.3.7.4)
diff --git a/contrib/nix/ruby3.1-gemset.nix b/contrib/nix/ruby3.1-gemset.nix
index 1adb100d..b2bd36e8 100644
--- a/contrib/nix/ruby3.1-gemset.nix
+++ b/contrib/nix/ruby3.1-gemset.nix
@@ -187,10 +187,10 @@
     platforms = [];
     source = {
       remotes = ["https://rubygems.org"];
-      sha256 = "1x06374njjl4xfxwkp6nq71akhazmqp9fyhkgxf6gac81p5wwdk6";
+      sha256 = "1dgc3hzgc0w3mbcvyhwjn0vng81dkibcgd73jx0br2p1a41l6sdp";
       type = "gem";
     };
-    version = "1.4.13";
+    version = "1.4.14";
   };
   optimist = {
     groups = ["default"];
diff --git a/contrib/nix/ruby3.2-Gemfile.lock b/contrib/nix/ruby3.2-Gemfile.lock
index 20beb05f..d4759ebc 100644
--- a/contrib/nix/ruby3.2-Gemfile.lock
+++ b/contrib/nix/ruby3.2-Gemfile.lock
@@ -23,7 +23,7 @@ GEM
     mime-types-data (3.2025.0402)
     mini_portile2 (2.8.8)
     minitest (5.25.5)
-    ncursesw (1.4.13)
+    ncursesw (1.4.14)
     optimist (3.2.1)
     parallel (1.26.3)
     parser (3.3.7.4)
diff --git a/contrib/nix/ruby3.2-gemset.nix b/contrib/nix/ruby3.2-gemset.nix
index 1adb100d..b2bd36e8 100644
--- a/contrib/nix/ruby3.2-gemset.nix
+++ b/contrib/nix/ruby3.2-gemset.nix
@@ -187,10 +187,10 @@
     platforms = [];
     source = {
       remotes = ["https://rubygems.org"];
-      sha256 = "1x06374njjl4xfxwkp6nq71akhazmqp9fyhkgxf6gac81p5wwdk6";
+      sha256 = "1dgc3hzgc0w3mbcvyhwjn0vng81dkibcgd73jx0br2p1a41l6sdp";
       type = "gem";
     };
-    version = "1.4.13";
+    version = "1.4.14";
   };
   optimist = {
     groups = ["default"];

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-10-18  1:52 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-18  1:52 [sup.git] branch develop updated (cf3a2e38 -> c9f29b8d) Dan Callaghan
2026-10-18  1:52 ` [sup.git] 01/06: prepend type:mail to every search before parsing Dan Callaghan
2026-10-18  1:52 ` [sup.git] 02/06: always set MIME-Version header on outgoing mails Dan Callaghan
2026-10-18  1:52 ` [sup.git] 03/06: unfold headers before further parsing Dan Callaghan
2026-10-18  1:52 ` [sup.git] 04/06: delete unused load_header method Dan Callaghan
2026-10-18  1:52 ` [sup.git] 05/06: move Source.parse_raw_email_header to EditMessageMode Dan Callaghan
2026-10-18  1:52 ` [sup.git] 06/06: ncursesw: 1.4.13 → 1.4.14 Dan Callaghan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox