Subject: [sup-talk] [PATCH] Use /etc/mailname if present to determine the hostname for Message-Id

From: [email-masked] (Adeodato Simó)
Date: Thu, 9 Jul 2009 21:55:17 +0200

Signed-off-by: Adeodato Sim? <dato at net.com.org.es>
---
Hello,

on many systems (notably Debian-based systems), the /etc/mailname file 
can be created to specify the public mail name for a host. If that file
exists, it'd be good to use its contents for generating the Message-Id 
header.
                                                     
I'd be grateful if you'd consider applying this patch.

 lib/sup/modes/edit-message-mode.rb |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/lib/sup/modes/edit-message-mode.rb b/lib/sup/modes/edit-message-mode.rb
index f956d65..a48930a 100644
--- a/lib/sup/modes/edit-message-mode.rb
+++ b/lib/sup/modes/edit-message-mode.rb
@@ -73,7 +73,14 @@ EOS
       @attachment_names = []
     end
 
-    @message_id = "<#{Time.now.to_i}-sup-#{rand 10000}@#{Socket.gethostname}>"
+    begin
+      hostname = File.open("/etc/mailname", "r").gets.chomp
+    rescue
+        nil
+    end
+    hostname = Socket.gethostname if hostname.nil? or hostname.empty?
+
+    @message_id = "<#{Time.now.to_i}-sup-#{rand 10000}@#{hostname}>"
     @edited = false
     @selectors = []
     @selector_label_width = 0
-- 
1.6.3.3

---

From: [email-masked] (William Morgan)
Date: Mon, 27 Jul 2009 10:19:14 -0700

Reformatted excerpts from Adeodato Sim?'s message of 2009-07-09:
> can be created to specify the public mail name for a host. If that
> file exists, it'd be good to use its contents for generating the
> Message-Id header.

Excellent idea. Applied directly to master. Thanks!
-- 
William <wmorgan-sup at masanjin.net>