From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/50220 Path: main.gmane.org!not-for-mail From: Reiner Steib <4.uce.03.r.s@nurfuerspam.de> Newsgroups: gmane.emacs.gnus.general Subject: messsage-user-fqdn Date: Thu, 20 Feb 2003 22:50:53 +0100 Sender: owner-ding@hpc.uh.edu Message-ID: Reply-To: reiner.steib@gmx.de NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: main.gmane.org 1045777962 29515 80.91.224.249 (20 Feb 2003 21:52:42 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Thu, 20 Feb 2003 21:52:42 +0000 (UTC) Return-path: Original-Received: from malifon.math.uh.edu ([129.7.128.13]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18lycR-0007fi-00 for ; Thu, 20 Feb 2003 22:52:40 +0100 Original-Received: from sina.hpc.uh.edu ([129.7.128.10] ident=lists) by malifon.math.uh.edu with esmtp (Exim 3.20 #1) id 18lybC-0005lo-00; Thu, 20 Feb 2003 15:51:22 -0600 Original-Received: by sina.hpc.uh.edu (TLB v0.09a (1.20 tibbs 1996/10/09 22:03:07)); Thu, 20 Feb 2003 15:52:21 -0600 (CST) Original-Received: from sclp3.sclp.com (sclp3.sclp.com [66.230.238.2]) by sina.hpc.uh.edu (8.9.3/8.9.3) with SMTP id PAA24445 for ; Thu, 20 Feb 2003 15:52:03 -0600 (CST) Original-Received: (qmail 19158 invoked by alias); 20 Feb 2003 21:50:56 -0000 Original-Received: (qmail 19153 invoked from network); 20 Feb 2003 21:50:56 -0000 Original-Received: from theotp5.physik.uni-ulm.de (134.60.10.145) by 66.230.238.6 with SMTP; 20 Feb 2003 21:50:56 -0000 Original-Received: (from ste@localhost) by theotp5.physik.uni-ulm.de (8.11.2/8.11.2) id h1KLosL32307; Thu, 20 Feb 2003 22:50:54 +0100 X-Authentication-Warning: theotp5.physik.uni-ulm.de: ste set sender to 4.uce.03.r.s@nurfuerspam.de using -f Original-To: ding@gnus.org X-Face: .*T0'iU(sujq_j9\J>-d4fg;N/1++U#U$_5ii6k.=|"-n'?5O:Hyz&wi'-!I~,}7~GgT=0S /&-R5sbkNy5+Xo1y{Tw2KKxi@Xh"g@]Qc|.U<*]WDd)qvGowFDvfU1F]{EDho:7P0@|oOD=Bc{K4?> WP68K[Mx:}=`ZT'6g4'f+g?;`vri2!)xGy}3:=l'(/Cea0l4lo^H5#@/Z3ev Mail-Copies-To: nobody Mail-Followup-To: ding@gnus.org User-Agent: Gnus/5.090016 (Oort Gnus v0.16) Emacs/21.2.95 Precedence: list X-Majordomo: 1.94.jlt7 Xref: main.gmane.org gmane.emacs.gnus.general:50220 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:50220 --=-=-= Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Hi, nowadays, many people don't a have properly configured system, so that `system-name' often isn't useful for the generation of the domain name of Message-Ids. Additionally, many people have the own FQDN (e.g. from their provider, like CIS-DFN) or the have their own domain. People often ask how to set the FQDN[1]. They are often advised to redefine `message-make-fqdn' or `message-make-message-id' (ugly hacks, IMHO) or to set `mail-host-address': ,---- | (defun message-make-fqdn () | "copy docstring from orig def" | "hotmail.com") | (defun message-make-message-id () | (concat | "<" (message-unique-id)"@some domain name You like>")) `---- But there only very rough checks in `message.el' concerning the validity of this string (does it contain a dot? localhost.*?). Ref. [1] also is a nice example about invalid domain parts: "@a.z=AB". :-( I propose to add a variable `messsage-user-fqdn' *and* add a better validity check for the domain part as well. ,---- | 2003-02-20 Reiner Steib |=20 | * message.el (message-user-fqdn, message-valid-fqdn-regexp): New | variables. | (message-make-fqdn): Use it. Improved validity check. |=20 | 2003-02-20 Reiner Steib |=20 | * message.texi (News Headers): Update description of Message-ID. `---- The new variable `message-valid-fqdn-regexp' is a duplication of `gnus-button-valid-fqdn-regexp'. But AFAIK, it's not allowed to require `gnus-art' from `message.el', is it? What about the other way round? Other possibilities? --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=message.messsage-user-fqdn.patch Content-Description: message.messsage-user-fqdn.patch 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 --=-=-= Bye, Reiner. [1] E.g. -- ,,, (o o) ---ooO-(_)-Ooo--- PGP key available via WWW http://rsteib.home.pages.de/ --=-=-=--