Gnus development mailing list
 help / color / mirror / Atom feed
From: Reiner Steib <reinersteib+gmane@imap.cc>
Subject: Re: Using versions instead of XEmacs codenames in User-Agent
Date: Sun, 09 Jan 2005 21:55:02 +0100	[thread overview]
Message-ID: <v965264921.fsf@marauder.physik.uni-ulm.de> (raw)
In-Reply-To: <microsoft-free.873bxbcrx1.fsf@youngs.au.com>

[-- Attachment #1: Type: text/plain, Size: 2041 bytes --]

On Sun, Jan 09 2005, Steve Youngs wrote:

> The default settings should give a User-Agent header similar to the
> one in this message's headers.

| User-Agent: Gnus/5.110003 (No Gnus v0.3) SXEmacs/22.1.1 "Aston Martin" (linux)

Is a quoted string like "Aston Martin" allowed in RFC 2616?  Upto now,
we had it inside the bracket:

| [...] XEmacs/21.4 (Security Through Obscurity, berkeley-unix)

[...]
> +	* gnus.el (gnus-user-agent-display-codename): New.  When non-nil
> +	and a (S)XEmacs codename exists, display it in the User-Agent
> +	header. 

I'd prefer not to introduce another variable.  We already have
`gnus-user-agent' for this.  It is confusing to have several variables
for the same thing.  How about making `gnus-user-agent' a list?

,----[ C-h v gnus-user-agent RET ]
| gnus-user-agent's value is (gnus emacs type)
| 
| Which information should be exposed in the User-Agent header.
| 
| Can be a list of symbols or a string.  Valid symbols are `gnus'
| (show Gnus version) and `emacs' (show Emacs version).  In
| addition to the Emacs version, you can add `codename' (show
| (S)XEmacs codename) or either `config' (show system
| configuration) or `type' (show system type).  If you set it to
| a string, be sure to use a valid format, see RFC 2616.
`----

With a customize buffer like for the list:

,----
| [X] gnus
| [X] emacs
| [X] system: Value Menu type
| [ ] codename
`----

Changes:

  * gnus.el (gnus-user-agent): Use list of symbols instead of
  symbols.  Display full version number for (S)XEmacs.  Optionally
  display (S)XEmacs codename.
  
  * gnus-util.el (gnus-emacs-version): Update for new
  `gnus-user-agent'.
  
  * gnus-msg.el (gnus-extended-version): Make it possible to omit
  Gnus version.

See the attached patch for details.

>  (eval-when-compile
> -  (defvar xemacs-codename))
> +  (defvar xemacs-codename)
> +  (defvar sxemacs-codename)
> +  (defvar running-xemacs)
> +  (defvar running-sxemacs))

Is there any benefit of using `running-[s]xemacs' instead of (featurep
'[s]xemacs)?

Bye, Reiner.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: gnus-user-agent: list --]
[-- Type: text/x-patch, Size: 7162 bytes --]

Index: gnus-msg.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/gnus-msg.el,v
retrieving revision 7.28
diff -u -r7.28 gnus-msg.el
--- gnus-msg.el	7 Nov 2004 23:56:10 -0000	7.28
+++ gnus-msg.el	9 Jan 2005 20:33:32 -0000
@@ -1,6 +1,6 @@
 ;;; gnus-msg.el --- mail and post interface for Gnus
-;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
-;;        Free Software Foundation, Inc.
+;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+;;        2005 Free Software Foundation, Inc.
 
 ;; Author: Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>
 ;;	Lars Magne Ingebrigtsen <larsi@gnus.org>
@@ -1039,17 +1039,18 @@
   "Stringified Gnus version and Emacs version.
 See the variable `gnus-user-agent'."
   (interactive)
-  (let* ((float-output-format nil)
-	 (gnus-v
-	  (concat "Gnus/"
-		  (prin1-to-string (gnus-continuum-version gnus-version) t)
-		  " (" gnus-version ")"))
-	 (emacs-v (gnus-emacs-version)))
-    (if (stringp gnus-user-agent)
-	gnus-user-agent
-      (concat gnus-v
-	      (when emacs-v
-		(concat " " emacs-v))))))
+  (if (stringp gnus-user-agent)
+      gnus-user-agent
+    ;; `gnus-user-agent' is a list:
+    (let* ((float-output-format nil)
+	   (gnus-v
+	    (when (memq 'gnus gnus-user-agent)
+	      (concat "Gnus/"
+		      (prin1-to-string (gnus-continuum-version gnus-version) t)
+		      " (" gnus-version ")")))
+	   (emacs-v (gnus-emacs-version)))
+      (concat gnus-v (when (and gnus-v emacs-v) " ")
+	      emacs-v))))
 
 \f
 ;;;
Index: gnus-util.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/gnus-util.el,v
retrieving revision 7.23
diff -u -r7.23 gnus-util.el
--- gnus-util.el	17 Dec 2004 10:27:43 -0000	7.23
+++ gnus-util.el	9 Jan 2005 20:33:33 -0000
@@ -1,5 +1,5 @@
 ;;; gnus-util.el --- utility functions for Gnus
-;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
 ;;        Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
@@ -1479,41 +1479,48 @@
       (nconc (nreverse res) list1 list2))))
 
 (eval-when-compile
-  (defvar xemacs-codename))
+  (defvar xemacs-codename)
+  (defvar sxemacs-codename)
+  (defvar emacs-program-version))
 
 (defun gnus-emacs-version ()
   "Stringified Emacs version."
-  (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))))
+  (let* ((lst (if (listp gnus-user-agent)
+		  gnus-user-agent
+		'(gnus emacs type)))
+	 (system-v (cond ((memq 'config lst)
+			  system-configuration)
+			 ((memq 'type lst)
+			  (symbol-name system-type))
+			 (t nil)))
+	 codename emacsname)
+    (cond ((featurep 'sxemacs)
+	   (setq emacsname "SXEmacs"
+		 codename sxemacs-codename))
+	  ((featurep 'xemacs)
+	   (setq emacsname "XEmacs"
+		 codename xemacs-codename))
+	  (t
+	   (setq emacsname "Emacs")))
     (cond
-     ((eq gnus-user-agent 'gnus)
+     ((not (memq 'emacs lst))
       nil)
      ((string-match "^\\(\\([.0-9]+\\)*\\)\\.[0-9]+$" emacs-version)
+      ;; Emacs:
       (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 ")")
+     ((or (featurep 'sxemacs) (featurep 'xemacs))
+      ;; XEmacs or SXEmacs:
+      (concat emacsname "/" emacs-program-version
+	      " ("
+	      (when (and (memq 'codename lst)
+			 codename)
+		(concat codename
+			(when system-v ", ")))
+	      (when system-v system-v)
 	      ")"))
-	 "")))
      (t emacs-version))))
 
 (defun gnus-rename-file (old-path new-path &optional trim)
Index: gnus.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/gnus.el,v
retrieving revision 7.31
diff -u -r7.31 gnus.el
--- gnus.el	2 Nov 2004 02:54:23 -0000	7.31
+++ gnus.el	9 Jan 2005 20:33:33 -0000
@@ -1,7 +1,7 @@
 ;;; gnus.el --- a newsreader for GNU Emacs
 
 ;; Copyright (C) 1987, 1988, 1989, 1990, 1993, 1994, 1995, 1996, 1997,
-;; 1998, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+;; 1998, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
 
 ;; Author: Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>
 ;;	Lars Magne Ingebrigtsen <larsi@gnus.org>
@@ -2391,24 +2391,44 @@
 			 (symbol :tag "Parameter")
 			 (sexp :tag "Value")))))
 
-(defcustom gnus-user-agent 'emacs-gnus-type
+(defcustom gnus-user-agent '(emacs gnus type)
   "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."
+Can be a list of symbols or a string.  Valid symbols are `gnus'
+\(show Gnus version\) and `emacs' \(show Emacs version\).  In
+addition to the Emacs version, you can add `codename' \(show
+\(S\)XEmacs codename\) or either `config' \(show system
+configuration\) or `type' \(show system type\).  If you set it to
+a string, be sure to use a valid format, see RFC 2616."
+
   :version "21.4"
   :group 'gnus-message
-  :type '(choice
-	  (item :tag "Show Gnus and Emacs versions and system type"
-		emacs-gnus-type)
-	  (item :tag "Show Gnus and Emacs versions and system configuration"
-		emacs-gnus-config)
-	  (item :tag "Show Gnus and Emacs versions" emacs-gnus)
-	  (item :tag "Show only Gnus version" gnus)
-	  (string :tag "Other")))
+  :type '(choice (list (set :inline t
+			    (const gnus  :tag "Gnus version")
+			    (const emacs :tag "Emacs version")
+			    (choice :tag "system"
+				    (const type   :tag "system type")
+				    (const config :tag "system configuration"))
+			    (const codename :tag "Emacs codename")))
+		 (string)))
+;; Convert old (< 2005-01-09) symbol type values:
+(when (symbolp gnus-user-agent)
+  (when (get 'gnus-user-agent 'saved-value)
+    ;; User has changed `gnus-user-agent' thru customize.
+    (gnus-message 1 "Please customize `gnus-user-agent' again.")
+    (sit-for 1))
+  (setq gnus-user-agent
+	(cond ((eq gnus-user-agent 'emacs-gnus-config)
+	       '(emacs gnus config))
+	      ((eq gnus-user-agent 'emacs-gnus-type)
+	       '(emacs gnus type))
+	      ((eq gnus-user-agent 'emacs-gnus)
+	       '(emacs gnus))
+	      ((eq gnus-user-agent 'gnus)
+	       '(gnus))
+	      (t gnus-user-agent))))
+
+
 
 \f
 ;;; Internal variables

[-- Attachment #3: Type: text/plain, Size: 100 bytes --]

-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/

  reply	other threads:[~2005-01-09 20:55 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-06  1:49 [PATCH] SXEmacs User-Agent string Steve Youngs
2005-01-06 13:41 ` Using versions instead of XEmacs codenames in User-Agent (was: [PATCH] SXEmacs User-Agent string) Reiner Steib
2005-01-06 23:00   ` Using versions instead of XEmacs codenames in User-Agent Katsumi Yamaoka
2005-01-06 23:29   ` Steve Youngs
2005-01-08 18:09     ` Reiner Steib
2005-01-09  1:28       ` Steve Youngs
2005-01-09 20:55         ` Reiner Steib [this message]
2005-01-09 23:09           ` Steve Youngs
2005-01-10  8:42             ` Bjørn Mork
2005-01-10  9:20               ` Steve Youngs
2005-01-10 10:39                 ` Bjørn Mork
2005-01-10 15:07             ` Reiner Steib
2005-01-10 23:29               ` Steve Youngs

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=v965264921.fsf@marauder.physik.uni-ulm.de \
    --to=reinersteib+gmane@imap.cc \
    --cc=Reiner.Steib@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).