Index: lisp/ChangeLog =================================================================== RCS file: /usr/local/cvsroot/gnus/lisp/ChangeLog,v retrieving revision 6.2020 diff -u -r6.2020 ChangeLog --- lisp/ChangeLog 20 Feb 2003 02:39:08 -0000 6.2020 +++ lisp/ChangeLog 20 Feb 2003 21:52:47 -0000 @@ -1,3 +1,9 @@ +2003-02-20 Reiner Steib + + * message.el (message-user-fqdn, message-valid-fqdn-regexp): New + variables. + (message-make-fqdn): Use it. Improved validity check. + 2003-02-20 Jesper Harder * gnus-sum.el (gnus-simplify-subject-fully, gnus-subject-equal) Index: lisp/message.el =================================================================== RCS file: /usr/local/cvsroot/gnus/lisp/message.el,v retrieving revision 6.301 diff -u -r6.301 message.el --- lisp/message.el 20 Feb 2003 00:39:05 -0000 6.301 +++ lisp/message.el 20 Feb 2003 21:52:47 -0000 @@ -1273,6 +1273,12 @@ :group 'message-headers :type 'boolean) +(defcustom message-user-fqdn nil + "*Domain part of Messsage-Ids." + :group 'message-headers + :link '(custom-manual "(message)News Headers") + :type 'string) + ;;; Internal variables. (defvar message-sending-message "Sending...") @@ -1381,6 +1387,19 @@ (defvar message-bogus-system-names "^localhost\\." "The regexp of bogus system names.") +(defcustom message-valid-fqdn-regexp + (concat "[a-z0-9][-.a-z0-9]+\\." ;; [hostname.subdomain.]domain. + ;; valid TLDs: + "\\([a-z][a-z]" ;; two letter country TDLs + "\\|biz\\|com\\|edu\\|gov\\|int\\|mil\\|net\\|org" + "\\|aero\\|coop\\|info\\|name\\|museum" + "\\|arpa\\|pro\\|uucp\\|bitnet\\|bofh" ;; old style? + "\\)") + "Regular expression that matches a valid FQDN." + ;; see also: gnus-button-valid-fqdn-regexp + :group 'message-headers + :type 'regexp) + (eval-and-compile (autoload 'message-setup-toolbar "messagexmas") (autoload 'mh-new-draft-name "mh-comp") @@ -4483,23 +4502,34 @@ (defun message-make-fqdn () "Return user's fully qualified domain name." - (let ((system-name (system-name)) - (user-mail (message-user-mail-address))) + (let* ((system-name (system-name)) + (user-mail (message-user-mail-address)) + (user-domain + (if (string-match "@\\(.*\\)\\'" user-mail) + (match-string 1 user-mail)))) (cond - ((and (string-match "[^.]\\.[^.]" system-name) + ((and message-user-fqdn + (stringp message-user-fqdn) + (string-match message-valid-fqdn-regexp message-user-fqdn) + (not (string-match message-bogus-system-names message-user-fqdn))) + message-user-fqdn) + ;; `message-user-fqdn' seems to be valid + ((and (string-match message-valid-fqdn-regexp system-name) (not (string-match message-bogus-system-names system-name))) ;; `system-name' returned the right result. system-name) ;; Try `mail-host-address'. ((and (boundp 'mail-host-address) (stringp mail-host-address) - (string-match "\\." mail-host-address)) + (string-match message-valid-fqdn-regexp mail-host-address) + (not (string-match message-bogus-system-names mail-host-address))) mail-host-address) ;; We try `user-mail-address' as a backup. - ((and user-mail - (string-match "\\." user-mail) - (string-match "@\\(.*\\)\\'" user-mail)) - (match-string 1 user-mail)) + ((and user-domain + (stringp user-domain) + (string-match message-valid-fqdn-regexp user-domain) + (not (string-match message-bogus-system-names user-domain))) + user-domain) ;; Default to this bogus thing. (t (concat system-name ".i-did-not-set--mail-host-address--so-tickle-me"))))) Index: texi/ChangeLog =================================================================== RCS file: /usr/local/cvsroot/gnus/texi/ChangeLog,v retrieving revision 6.457 diff -u -r6.457 ChangeLog --- texi/ChangeLog 18 Feb 2003 20:32:24 -0000 6.457 +++ texi/ChangeLog 20 Feb 2003 21:52:47 -0000 @@ -1,3 +1,7 @@ +2003-02-20 Reiner Steib + + * message.texi (News Headers): Update description of Message-ID. + 2003-02-18 Reiner Steib * gnus.texi (Article Washing): Mention `g'. Index: texi/message.texi =================================================================== RCS file: /usr/local/cvsroot/gnus/texi/message.texi,v retrieving revision 6.66 diff -u -r6.66 message.texi --- texi/message.texi 5 Feb 2003 10:10:19 -0000 6.66 +++ texi/message.texi 20 Feb 2003 21:52:47 -0000 @@ -1466,14 +1466,18 @@ @item Message-ID @cindex Message-ID +@vindex message-user-fqdn @vindex mail-host-address +@vindex user-mail-address @findex system-name @cindex Sun +@cindex i-did-not-set--mail-host-address--so-tickle-me This required header will be generated by Message. A unique ID will be -created based on the date, time, user name and system name. Message -will use @code{system-name} to determine the name of the system. If -this isn't a fully qualified domain name (FQDN), Message will use -@code{mail-host-address} as the FQDN of the machine. +created based on the date, time, user name and system name. For the +domain part, message will look (in this order) at +@code{message-user-fqdn}, @code{system-name}, @code{mail-host-address} +and @code{message-user-mail-address} (i.e. @code{user-mail-address}) +until a probably valid fully qualified domain name (FQDN) was found. @item User-Agent @cindex User-Agent