]> git.cworth.org Git - sup/commitdiff
Use /etc/mailname if present to determine the hostname for Message-Id
authorAdeodato Simó <dato@net.com.org.es>
Thu, 9 Jul 2009 19:55:17 +0000 (21:55 +0200)
committerWilliam Morgan <wmorgan-sup@masanjin.net>
Mon, 27 Jul 2009 17:18:35 +0000 (13:18 -0400)
Signed-off-by: Adeodato Simó <dato@net.com.org.es>
lib/sup/modes/edit-message-mode.rb

index f956d6587948cb3cc01f0579faa98f548850c1d6..a48930aea521fd73d7c83f2bf9846d8be6a29025 100644 (file)
@@ -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