* lisp/gnus-msg.el (gnus-user-agent): Added `gnus-mime-edit'.
authorari <ari>
Wed, 14 May 2003 08:45:23 +0000 (08:45 +0000)
committerari <ari>
Wed, 14 May 2003 08:45:23 +0000 (08:45 +0000)
(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
lisp/gnus-msg.el
lisp/message.el
texi/gnus-ja.texi

index b0e5794..58e270d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+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.
index 6d2e1b0..9729b09 100644 (file)
@@ -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))))
 
 \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
@@ -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))
index 4788d14..34475ec 100644 (file)
@@ -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).
index d25d8e7..287b08a 100644 (file)
@@ -10670,14 +10670,14 @@ ISP \e$B$,\e(B @acronym{POP}-before-@acronym{SMTP} \e$B$NG'>Z$rMW5a$7$F$$$k>l9g$KM-
 @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