From 871d9e26093f83e0730d33c507dddcf07aca19bf Mon Sep 17 00:00:00 2001 From: ari Date: Wed, 14 May 2003 08:45:23 +0000 Subject: [PATCH] * lisp/gnus-msg.el (gnus-user-agent): Added `gnus-mime-edit'. (gnus-inews-add-send-actions): Use `gnus-message-make-user-agent' instead of `gnus-extended-version'. (xemacs-codename): Defvar while compiling. (gnus-message-make-user-agent): Use `gnus-user-agent'. * lisp/message.el (message-make-user-agent): If the "User-Agent" field has alread exist, remove it. * text/gnus-ja.text: Followed the change of above. --- ChangeLog | 11 +++++++++ lisp/gnus-msg.el | 71 +++++++++++++++++++++++++++++++++++++++++++++-------- lisp/message.el | 22 ++++------------- texi/gnus-ja.texi | 16 ++++++------ 4 files changed, 85 insertions(+), 35 deletions(-) diff --git a/ChangeLog b/ChangeLog index b0e5794..58e270d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2003-05-14 ARISAWA Akihiro + + * lisp/gnus-msg.el (gnus-user-agent): Added `gnus-mime-edit'. + (gnus-inews-add-send-actions): Use `gnus-message-make-user-agent' + instead of `gnus-extended-version'. + (xemacs-codename): Defvar while compiling. + (gnus-message-make-user-agent): Use `gnus-user-agent'. + + * lisp/message.el (message-make-user-agent): If the "User-Agent" field + has alread exist, remove it. + 2003-05-14 Katsumi Yamaoka * lisp/gnus-vers.el: T-gnus 6.16.2 revision 00. diff --git a/lisp/gnus-msg.el b/lisp/gnus-msg.el index 6d2e1b0..9729b09 100644 --- a/lisp/gnus-msg.el +++ b/lisp/gnus-msg.el @@ -308,16 +308,19 @@ If nil, the address field will always be empty after invoking :group 'gnus-message :type 'boolean) -(defcustom gnus-user-agent 'emacs-gnus-type +(defcustom gnus-user-agent 'gnus-mime-edit "Which information should be exposed in the User-Agent header. It can be one of the symbols `gnus' \(show only Gnus version\), `emacs-gnus' \(show only Emacs and Gnus versions\), `emacs-gnus-config' \(same as `emacs-gnus' plus system configuration\), `emacs-gnus-type' \(same as -`emacs-gnus' plus system type\) or a custom string. If you set it to a -string, be sure to use a valid format, see RFC 2616." +`emacs-gnus' plus system type\), `gnus-mime-edit' \(show Gnus version and +MIME Edit User-Agent\) or a custom string. If you set it to a string, +be sure to use a valid format, see RFC 2616." :group 'gnus-message :type '(choice + (item :tag "Show Gnus version and MIME Edit User-Agent" + gnus-mime-edit) (item :tag "Show Gnus and Emacs versions and system type" emacs-gnus-type) (item :tag "Show Gnus and Emacs versions and system configuration" @@ -559,7 +562,7 @@ Gcc: header for archiving purposes." (setq message-post-method `(lambda (arg) (gnus-post-method arg ,gnus-newsgroup-name))) - (setq message-user-agent (gnus-extended-version)) + (setq message-user-agent (gnus-message-make-user-agent)) (unless message-use-multi-frames (message-add-action `(if (gnus-buffer-exists-p ,buffer) @@ -1122,6 +1125,10 @@ If SILENT, don't prompt the user." (t gnus-select-method)))) +;; Dummies to avoid byte-compile warning. +(eval-when-compile + (defvar xemacs-codename)) + (defun gnus-message-make-user-agent (&optional include-mime-info max-column newline-product) "Return a user-agent info. If INCLUDE-MIME-INFO is non-nil and the @@ -1145,12 +1152,56 @@ Here is an example of how to use this function: (gnus-message-make-user-agent t 76 'soft) \"\\n\"))))) " - (let ((user-agent (if (and include-mime-info - (boundp 'mime-edit-user-agent-value)) - (concat (gnus-extended-version) - " " - mime-edit-user-agent-value) - (gnus-extended-version)))) + (let ((gnus-v (gnus-extended-version)) + user-agent) + (cond ((and include-mime-info + (boundp 'mime-edit-user-agent-value)) + (setq user-agent (concat gnus-v " " mime-edit-user-agent-value))) + ((eq gnus-user-agent 'gnus-mime-edit) + (setq user-agent + (if (boundp 'mime-edit-user-agent-value) + (concat gnus-v " " mime-edit-user-agent-value) + gnus-v))) + (t + (let* ((system-v + (cond + ((eq gnus-user-agent 'emacs-gnus-config) + system-configuration) + ((eq gnus-user-agent 'emacs-gnus-type) + (symbol-name system-type)) + (t nil))) + (emacs-v + (cond + ((eq gnus-user-agent 'gnus) + nil) + ((string-match "^\\(\\([.0-9]+\\)*\\)\\.[0-9]+$" + emacs-version) + (concat "Emacs/" (match-string 1 emacs-version) + (if system-v + (concat " (" system-v ")") + ""))) + ((string-match + "\\([A-Z]*[Mm][Aa][Cc][Ss]\\)[^(]*\\(\\((beta.*)\\|'\\)\\)?" + emacs-version) + (concat + (match-string 1 emacs-version) + (format "/%d.%d" emacs-major-version emacs-minor-version) + (if (match-beginning 3) + (match-string 3 emacs-version) + "") + (if (boundp 'xemacs-codename) + (concat + " (" xemacs-codename + (if system-v + (concat ", " system-v ")") + ")")) + ""))) + (t emacs-version)))) + (setq user-agent (if (stringp gnus-user-agent) + gnus-user-agent + (concat gnus-v + (when emacs-v + (concat " " emacs-v)))))))) (when max-column (unless (natnump max-column) (setq max-column 76)) diff --git a/lisp/message.el b/lisp/message.el index 4788d14..34475ec 100644 --- a/lisp/message.el +++ b/lisp/message.el @@ -5280,26 +5280,14 @@ subscribed address (and not the additional To and Cc header contents)." (defun message-make-user-agent () "Return user-agent info if the value `message-user-agent' is non-nil. If the -\"User-Agent\" field has already exist, it's value will be added in the return -string." +\"User-Agent\" field has already exist, remove it." (when message-user-agent (save-excursion (goto-char (point-min)) - (let ((case-fold-search t) - user-agent start p end) - (if (re-search-forward - (concat "^User-Agent:[\t ]*\\(" - (regexp-quote gnus-product-name) - "/[0-9.]+\\([ \t\r\n]*([^)]+)\\)*\\)?[\t ]*") - nil t) - (progn - (setq start (match-beginning 0) - p (match-end 0) - end (std11-field-end) - user-agent (buffer-substring-no-properties p end)) - (delete-region start (1+ end)) - (concat message-user-agent " " user-agent)) - message-user-agent))))) + (let ((case-fold-search t)) + (when (re-search-forward "^User-Agent:[\t ]*" nil t) + (delete-region (match-beginning 0) (1+ (std11-field-end))))))) + message-user-agent) (defun message-idna-inside-rhs-p () "Return t iff point is inside a RHS (heuristically). diff --git a/texi/gnus-ja.texi b/texi/gnus-ja.texi index d25d8e7..287b08a 100644 --- a/texi/gnus-ja.texi +++ b/texi/gnus-ja.texi @@ -10670,14 +10670,14 @@ ISP $B$,(B @acronym{POP}-before-@acronym{SMTP} $B$NG'>Z$rMW5a$7$F$$$k>l9g$KM- @vindex gnus-user-agent @cindex User-Agent -($BLuCm(B: T-gnus $B$G$O8=:_$3$NJQ?t$K$h$k@)8f$O5!G=$7$^$;$s!#(B) $B$3$NJQ?t$O!"$I(B -$B$N>pJs$,(B User-Agent $B%X%C%@!<$KDDNs$5$l$k$+$r@)8f$7$^$9!#$=$l$OH(B)$B!#(B +$B$3$NJQ?t$O!"$I$N>pJs$,(B User-Agent $B%X%C%@!<$KDDNs$5$l$k$+$r@)8f$7$^$9!#(B +$B$=$l$OH(B)$B!#(B @end table $B$"$J$?$O<+J,$,Aw$k%a%C%;!<%8$NDV$j$rD4$Y$?$$$H;W$&$+$bCN$l$^$;$s!#$b$7$/(B -- 1.7.10.4