;;; gnus-srvr.el --- virtual server support for Gnus
-;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
;; Free Software Foundation, Inc.
;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
The following specs are understood:
-%h backend
+%h back end
%n name
%w address
%s status
(defcustom gnus-server-browse-in-group-buffer nil
"Whether server browsing should take place in the group buffer.
If nil, a faster, but more primitive, buffer is used instead."
+ :version "21.4"
:group 'gnus-server-visual
:type 'boolean)
(defcustom gnus-server-offline-face 'gnus-server-offline-face
"Face name to use on OFFLINE servers."
+ :version "21.4"
:group 'gnus-server-visual
:type 'face)
"(closed)")
((error) "(error)")))))
(gnus-tmp-agent (if (and gnus-agent
- (member method
- gnus-agent-covered-methods))
+ (gnus-agent-method-p method))
" (agent)"
"")))
(beginning-of-line)
(prog1 (1+ (point))
;; Insert the text.
(eval gnus-server-line-format-spec))
- (list 'gnus-server (intern gnus-tmp-name)))))
+ (list 'gnus-server (intern gnus-tmp-name)
+ 'gnus-named-server (intern (gnus-method-to-server method))))))
(defun gnus-enter-server-buffer ()
"Set up the server buffer."
(gnus-server-position-point))
(defun gnus-server-server-name ()
- (let ((server (get-text-property (gnus-point-at-bol) 'gnus-server)))
+ (let ((server (get-text-property (point-at-bol) 'gnus-server)))
+ (and server (symbol-name server))))
+
+(defun gnus-server-named-server ()
+ "Return a server name that matches one of the names returned by
+`gnus-method-to-server'."
+ (let ((server (get-text-property (point-at-bol) 'gnus-named-server)))
(and server (symbol-name server))))
(defalias 'gnus-server-position-point 'gnus-goto-colon)
(if cached
(setq gnus-server-method-cache
(delq cached gnus-server-method-cache)))
- (if entry (setcdr entry info)
+ (if entry
+ (progn
+ ;; Remove the server from `gnus-opened-servers' since
+ ;; it has never been opened with the new `info' yet.
+ (gnus-opened-servers-remove (cdr entry))
+ ;; Don't make a new Lisp object.
+ (setcar (cdr entry) (car info))
+ (setcdr (cdr entry) (cdr info)))
(setq gnus-server-alist
(nconc gnus-server-alist (list (cons server info))))))))
1 "Couldn't request list: %s" (gnus-status-message method))
nil)
(t
- (save-excursion
- (set-buffer nntp-server-buffer)
+ (with-current-buffer nntp-server-buffer
(let ((cur (current-buffer)))
(goto-char (point-min))
(unless (string= gnus-ignored-newsgroups "")
(delete-matching-lines gnus-ignored-newsgroups))
- (while (not (eobp))
- (ignore-errors
- (push (cons
- (if (eq (char-after) ?\")
- (read cur)
- (let ((p (point)) (name ""))
- (skip-chars-forward "^ \t\\\\")
- (setq name (buffer-substring p (point)))
- (while (eq (char-after) ?\\)
- (setq p (1+ (point)))
- (forward-char 2)
+ ;; We treat NNTP as a special case to avoid problems with
+ ;; garbage group names like `"foo' that appear in some badly
+ ;; managed active files. -jh.
+ (if (eq (car method) 'nntp)
+ (while (not (eobp))
+ (ignore-errors
+ (push (cons
+ (buffer-substring
+ (point)
+ (progn
+ (skip-chars-forward "^ \t")
+ (point)))
+ (let ((last (read cur)))
+ (cons (read cur) last)))
+ groups))
+ (forward-line))
+ (while (not (eobp))
+ (ignore-errors
+ (push (cons
+ (if (eq (char-after) ?\")
+ (read cur)
+ (let ((p (point)) (name ""))
(skip-chars-forward "^ \t\\\\")
- (setq name (concat name (buffer-substring
- p (point)))))
- name))
- (let ((last (read cur)))
- (cons (read cur) last)))
- groups))
- (forward-line))))
+ (setq name (buffer-substring p (point)))
+ (while (eq (char-after) ?\\)
+ (setq p (1+ (point)))
+ (forward-char 2)
+ (skip-chars-forward "^ \t\\\\")
+ (setq name (concat name (buffer-substring
+ p (point)))))
+ name))
+ (let ((last (read cur)))
+ (cons (read cur) last)))
+ groups))
+ (forward-line)))))
(setq groups (sort groups
(lambda (l1 l2)
(string< (car l1) (car l2)))))
(prog1 (1+ (point))
(insert
(format "%c%7d: %s\n"
- (let ((level (gnus-group-level
- (concat prefix (setq name (car group))))))
+ (let ((level
+ (if (string= prefix "")
+ (gnus-group-level (setq name (car group)))
+ (gnus-group-level
+ (concat prefix (setq name (car group)))))))
(cond
((<= level gnus-level-subscribed) ? )
((<= level gnus-level-unsubscribed) ?U)
((= level gnus-level-zombie) ?Z)
(t ?K)))
(max 0 (- (1+ (cddr group)) (cadr group)))
- (decode-coding-string
- name
- (inline (gnus-group-name-charset method name))))))
- (list 'gnus-group name))))
+ ;; Don't decode if name is ASCII
+ (if (and (fboundp 'detect-coding-string)
+ (eq (detect-coding-string name t) 'undecided))
+ name
+ (decode-coding-string
+ name
+ (inline (gnus-group-name-charset method name)))))))
+ (list 'gnus-group name)
+ )))
(switch-to-buffer (current-buffer)))
(goto-char (point-min))
(gnus-group-position-point)
(save-excursion
(beginning-of-line)
(let ((name (get-text-property (point) 'gnus-group)))
- (when (re-search-forward ": \\(.*\\)$" (gnus-point-at-eol) t)
- (concat (gnus-method-to-server-name gnus-browse-current-method) ":"
+ (when (re-search-forward ": \\(.*\\)$" (point-at-eol) t)
+ (concat (gnus-method-to-server-name gnus-browse-current-method) ":"
(or name
(match-string-no-properties 1)))))))
(unless (eq (char-after) ? )
(setq sub t))
(setq group (gnus-browse-group-name))
+ (when (gnus-server-equal gnus-browse-current-method "native")
+ (setq group (gnus-group-real-name group)))
(if sub
(progn
;; Make sure the group has been properly removed before we
gnus-browse-current-method)))
gnus-level-default-subscribed (gnus-group-level group)
(and (car (nth 1 gnus-newsrc-alist))
- (gnus-gethash (car (nth 1 gnus-newsrc-alist))
- gnus-newsrc-hashtb))
+ (gnus-group-entry (car (nth 1 gnus-newsrc-alist))))
t)
(delete-char 1)
(insert ? ))
(gnus-get-function (gnus-server-to-method server)
'request-regenerate)
(error
- (error "This backend doesn't support regeneration")))
+ (error "This back end doesn't support regeneration")))
(gnus-message 5 "Requesting regeneration of %s..." server)
(unless (gnus-open-server server)
(error "Couldn't open server"))