Archive of RubyForge sup-talk mailing list
 help / color / mirror / Atom feed
* [sup-talk] [PATCH] Use /etc/mailname if present to determine the hostname for Message-Id
@ 2009-07-09 19:55 Adeodato Simó
  2009-07-27 17:19 ` William Morgan
  0 siblings, 1 reply; 2+ messages in thread
From: Adeodato Simó @ 2009-07-09 19:55 UTC (permalink / 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



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

* [sup-talk] [PATCH] Use /etc/mailname if present to determine the hostname for Message-Id
  2009-07-09 19:55 [sup-talk] [PATCH] Use /etc/mailname if present to determine the hostname for Message-Id Adeodato Simó
@ 2009-07-27 17:19 ` William Morgan
  0 siblings, 0 replies; 2+ messages in thread
From: William Morgan @ 2009-07-27 17:19 UTC (permalink / raw)


Reformatted excerpts from Adeodato Sim?'s message of 2009-07-09:
> 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.

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


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

end of thread, other threads:[~2009-07-27 17:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-09 19:55 [sup-talk] [PATCH] Use /etc/mailname if present to determine the hostname for Message-Id Adeodato Simó
2009-07-27 17:19 ` William Morgan

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