whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject [whimsy] branch master updated: WHIMSY-213 Allow for 2-line message-ID
Date Thu, 25 Oct 2018 22:35:03 GMT
This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git


The following commit(s) were added to refs/heads/master by this push:
     new b9dbbf6  WHIMSY-213 Allow for 2-line message-ID
b9dbbf6 is described below

commit b9dbbf6c22719f81c055baeabef085b4f807a1b3
Author: Sebb <sebb@apache.org>
AuthorDate: Thu Oct 25 23:34:49 2018 +0100

    WHIMSY-213 Allow for 2-line message-ID
---
 www/secretary/workbench/models/message.rb | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/www/secretary/workbench/models/message.rb b/www/secretary/workbench/models/message.rb
index cf94995..9ce90bc 100644
--- a/www/secretary/workbench/models/message.rb
+++ b/www/secretary/workbench/models/message.rb
@@ -310,11 +310,21 @@ class Message
     mail
   end
 
+  # get the message ID
+  def self.getmid(hdrs)
+    mid = hdrs[/^Message-ID:.*/i]
+    if mid =~ /^Message-ID:\s*$/i # no mid on the first line
+      # capture the next line and join them together
+      mid = hdrs[/^Message-ID:.*\r?\n .*/i].sub(/\r?\n/,'')
+    end
+    mid
+  end
+
   #
   # What to use as a hash for mail
   #
   def self.hash(message)
-    Digest::SHA1.hexdigest(message[/^Message-ID:.*/i] || message)[0..9]
+    Digest::SHA1.hexdigest(getmid(message) || message)[0..9]
   end
 
   #


Mime
View raw message