+2003-05-14 ARISAWA Akihiro <ari@mbf.sphere.ne.jp>
+
+ * 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 <yamaoka@jpl.org>
* lisp/gnus-vers.el: T-gnus 6.16.2 revision 00.
: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"
(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)
(t gnus-select-method))))
\f
+;; 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
(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))
(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).
@vindex gnus-user-agent
@cindex User-Agent
-(\e$BLuCm\e(B: T-gnus \e$B$G$O8=:_$3$NJQ?t$K$h$k@)8f$O5!G=$7$^$;$s!#\e(B) \e$B$3$NJQ?t$O!"$I\e(B
-\e$B$N>pJs$,\e(B User-Agent \e$B%X%C%@!<$KDDNs$5$l$k$+$r@)8f$7$^$9!#$=$l$O<!$N%7%s%\\e(B
-\e$B%k$^$?$OJ8;zNs$N$&$A$N$I$l$+$G$"$k$3$H$,$G$-$^$9\e(B: @code{gnus} (Gnus \e$B$N%P!<\e(B
-\e$B%8%g%s$N$_\e(B)\e$B!"\e(B@code{emacs-gnus} (Emacs \e$B$H\e(B Gnus \e$B$N%P!<%8%g%s$@$1\e(B)\e$B!"\e(B
-@code{emacs-gnus-config} (@code{emacs-gnus} \e$B$HF1$8!\%7%9%F%`9=@.\e(B)\e$B!"\e(B
-@code{emacs-gnus-type} (@code{emacs-gnus}) \e$B$HF1$8!\%7%9%F%`%?%$%W\e(B)\e$B!"$^$?\e(B
-\e$B$O9%$_$NJ8;zNs!#$3$l$rJ8;zNs$K$9$k$H$-$O!"@5$7$$%U%)!<%^%C%H$K$J$C$F$$$k\e(B
-\e$B$3$H$r3N$+$a$F2<$5$$\e(B (RFC2616 \e$B;2>H\e(B)\e$B!#\e(B
+\e$B$3$NJQ?t$O!"$I$N>pJs$,\e(B User-Agent \e$B%X%C%@!<$KDDNs$5$l$k$+$r@)8f$7$^$9!#\e(B
+\e$B$=$l$O<!$N%7%s%\%k$^$?$OJ8;zNs$N$&$A$N$I$l$+$G$"$k$3$H$,$G$-$^$9\e(B:
+@code{gnus} (Gnus \e$B$N%P!<%8%g%s$N$_\e(B)\e$B!"\e(B@code{emacs-gnus} (Emacs \e$B$H\e(B Gnus
+\e$B$N%P!<%8%g%s$@$1\e(B)\e$B!"\e(B@code{emacs-gnus-config} (@code{emacs-gnus} \e$B$HF1$8\e(B
+\e$B!\%7%9%F%`9=@.\e(B)\e$B!"\e(B@code{emacs-gnus-type} (@code{emacs-gnus}) \e$B$HF1$8!\%7\e(B
+\e$B%9%F%`%?%$%W\e(B)\e$B!"\e(B@code{gnus-mime-edit} (Gnus \e$B$H\e(B MIME Edit \e$B$J$I$N%P!<%8%g\e(B
+\e$B%s\e(B)\e$B!"$^$?$O9%$_$NJ8;zNs!#$3$l$rJ8;zNs$K$9$k$H$-$O!"@5$7$$%U%)!<%^%C%H\e(B
+\e$B$K$J$C$F$$$k$3$H$r3N$+$a$F2<$5$$\e(B (RFC2616 \e$B;2>H\e(B)\e$B!#\e(B
@end table
\e$B$"$J$?$O<+J,$,Aw$k%a%C%;!<%8$NDV$j$rD4$Y$?$$$H;W$&$+$bCN$l$^$;$s!#$b$7$/\e(B