Archive of RubyForge sup-talk mailing list
 help / color / mirror / Atom feed
From: dato@net.com.org.es (Adeodato Simó)
Subject: [sup-talk] [PATCH] Use /etc/mailname if present to determine the hostname for Message-Id
Date: Thu,  9 Jul 2009 21:55:17 +0200	[thread overview]
Message-ID: <e23a0f3ed1ae4e2007d0f8144207e0e2fe3d8c11.1247169308.git.dato@net.com.org.es> (raw)

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



             reply	other threads:[~2009-07-09 19:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-09 19:55 Adeodato Simó [this message]
2009-07-27 17:19 ` William Morgan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e23a0f3ed1ae4e2007d0f8144207e0e2fe3d8c11.1247169308.git.dato@net.com.org.es \
    --to=dato@net.com.org.es \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox