From fa74bd480bc28ae6274351f0d5718876c8ffc10b Mon Sep 17 00:00:00 2001 From: yamaoka Date: Sun, 23 Feb 2003 14:56:14 +0000 Subject: [PATCH] Synch to Oort Gnus. --- lisp/ChangeLog | 20 ++++++++++++++++++ lisp/gnus-art.el | 2 +- lisp/gnus-msg.el | 10 +++++++++ lisp/gnus-util.el | 6 ++++++ lisp/message.el | 57 +++++++++++++++++++++++++++++++++++++++----------- texi/ChangeLog | 4 ++++ texi/message-ja.texi | 13 +++++++----- texi/message.texi | 12 +++++++---- 8 files changed, 102 insertions(+), 22 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index be3b1b2..ca94795 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,23 @@ +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-23 Lars Magne Ingebrigtsen + + * message.el (message-user-mail-address): Check whether + user-mail-address looks valid. + + * gnus-msg.el (gnus-mailing-list-followup-to): New function. + + * gnus-util.el (gnus-fetch-original-field): New function. + +2003-02-23 Kai Gro,A_(Bjohann + + * message.el (message-mode): \\(...\\) around additional + paragraph-separate alternative. + 2003-02-23 Jesper Harder * gnus-art.el (gnus-mime-button-commands): Add ellipsis. diff --git a/lisp/gnus-art.el b/lisp/gnus-art.el index b311518..bd7499a 100644 --- a/lisp/gnus-art.el +++ b/lisp/gnus-art.el @@ -4431,7 +4431,7 @@ If no internal viewer is available, use an external viewer." (interactive (list (completing-read "Action: " gnus-mime-action-alist nil t))) (gnus-article-check-buffer) - (let ((action-pair (assoc action gnus-mime-action-alistq))) + (let ((action-pair (assoc action gnus-mime-action-alist))) (if action-pair (funcall (cdr action-pair))))) diff --git a/lisp/gnus-msg.el b/lisp/gnus-msg.el index 2a66888..9f7512b 100644 --- a/lisp/gnus-msg.el +++ b/lisp/gnus-msg.el @@ -1959,6 +1959,16 @@ this is a reply." (insert " "))) (insert "\n"))))))) +(defun gnus-mailing-list-followup-to () + "Look at the headers in the current buffer and return a Mail-Followup-To address." + (let ((x-been-there (gnus-fetch-original-field "x-beenthere")) + (list-post (gnus-fetch-original-field "list-post"))) + (when (and list-post + (string-match "mailto:\\([^>]+\\)" list-post)) + (setq list-post (match-string 1 list-post))) + (or list-post + x-been-there))) + ;;; Posting styles. (defun gnus-configure-posting-styles (&optional group-name) diff --git a/lisp/gnus-util.el b/lisp/gnus-util.el index b6d5740..dd785d9 100644 --- a/lisp/gnus-util.el +++ b/lisp/gnus-util.el @@ -224,6 +224,12 @@ (nnheader-narrow-to-headers) (message-fetch-field field))))) +(defun gnus-fetch-original-field (field) + "Fetch FIELD from the original version of the current article." + (with-current-buffer gnus-original-article-buffer + (gnus-fetch-field field))) + + (defun gnus-goto-colon () (beginning-of-line) (let ((eol (gnus-point-at-eol))) diff --git a/lisp/message.el b/lisp/message.el index 9a56341..5f6eec5 100644 --- a/lisp/message.el +++ b/lisp/message.el @@ -1489,6 +1489,12 @@ no, only reply back to the author." :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...") @@ -1597,6 +1603,19 @@ no, only reply back to the author." (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") @@ -2514,9 +2533,11 @@ M-RET `message-newline-and-reformat' (break the line and reformat)." (setq message-parameter-alist (copy-sequence message-startup-parameter-alist)) (message-setup-fill-variables) - (set (make-local-variable 'paragraph-separate) - (concat paragraph-separate - "\\|<#!*/?\\(multipart\\|part\\|external\\|mml\\|secure\\)")) + (set + (make-local-variable 'paragraph-separate) + (format "\\(%s\\)\\|\\(%s\\)" + paragraph-separate + "<#!*/?\\(multipart\\|part\\|external\\|mml\\|secure\\)")) ;; Allow using comment commands to add/remove quoting. (set (make-local-variable 'comment-start) message-yank-prefix) (if (featurep 'xemacs) @@ -5081,30 +5102,42 @@ give as trustworthy answer as possible." (defun message-user-mail-address () "Return the pertinent part of `user-mail-address'." - (when user-mail-address + (when (and user-mail-address + (string-match "@.*\\." user-mail-address)) (if (string-match " " user-mail-address) (nth 1 (std11-extract-address-components user-mail-address)) user-mail-address))) (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"))))) diff --git a/texi/ChangeLog b/texi/ChangeLog index 0c08433..199e6a4 100644 --- a/texi/ChangeLog +++ b/texi/ChangeLog @@ -1,3 +1,7 @@ +2003-02-20 Reiner Steib + + * message.texi (News Headers): Update description of Message-ID. + 2003-02-23 Lars Magne Ingebrigtsen * gnus.texi (Startup Files): Addition. diff --git a/texi/message-ja.texi b/texi/message-ja.texi index a355ff7..6a107b4 100644 --- a/texi/message-ja.texi +++ b/texi/message-ja.texi @@ -1481,15 +1481,18 @@ qmail-inject $B%W%m%0%i%`$KEO$90z?t$G$9!#$3$l$OJ8;zNs$N%j%9%H$G!"$=$l$>$l(B @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 $B$3$NI,MW$J%X%C%@!<$O(B Message $B$K$h$j:n@.$5$l$^$9!#F|IU!";~4V!"MxMQ!"(B -$B%7%9%F%`L>$K4p$E$$$?B>$KL5$$(B ID $B$,:n@.$5$l$^$9!#(B -Message $B$O(B @code{system-name} $B$r%7%9%F%`L>$r7h$a$k$?$a$K;H$$$^$9!#$b$7$3(B -$B$l$,(B fully qualified domain name (FQDN) ($B40A4$K>r7o$rK~$?$7$?%I%a%$%s(B -$BL>(B) $B$G$J$$$J$i(B $B$P!"(BMessage $B$O(B @code{mail-host-address} $B$r(B FQDN $B$H$7$F;H(B -$B$$$^$9!#(B +$B%7%9%F%`L>$K4p$E$$$?B>$KL5$$(B ID $B$,:n@.$5$l$^$9!#%I%a%$%s$N9`$K$D$$$F$O!"(B +$BM-8z$J(B FQDN ($B40A4$K>r7o$rK~$?$7$?%I%a%$%sL>(B) $B$i$7$$$b$N$,8+$D$+$i$J$$>l(B +$B9g!"(Bmessage $B$O(B @code{message-user-fqdn}, @code{system-name}, +@code{mail-host-address} $B$*$h$S(B @code{message-user-mail-address} ($B$9$J$o(B +$B$A(B @code{user-mail-address}) $B$r(B ($B$3$N=g$G(B) $BC5$7$^$9!#(B @item User-Agent @cindex User-Agent diff --git a/texi/message.texi b/texi/message.texi index aad61a9..b40bf27 100644 --- a/texi/message.texi +++ b/texi/message.texi @@ -1482,14 +1482,18 @@ This optional header will be computed by Message. @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 -- 1.7.10.4