* gnus.el (gnus-other-frame-function): New user option.
[gnus] / lisp / nnvirtual.el
index 16094dd..6099937 100644 (file)
@@ -1,8 +1,10 @@
-;;; nnvirtual.el --- virtual newsgroups access for (ding) Gnus
-;; Copyright (C) 1994,95 Free Software Foundation, Inc.
+;;; nnvirtual.el --- virtual newsgroups access for Gnus
+;; Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+;;        Free Software Foundation, Inc.
 
-;; Author: Lars Magne Ingebrigtsen <larsi@ifi.uio.no>
-;;     Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>
+;; Author: David Moore <dmoore@ucsd.edu>
+;;     Lars Magne Ingebrigtsen <larsi@gnus.org>
+;;     Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>
 ;; Keywords: news
 
 ;; This file is part of GNU Emacs.
 ;; GNU General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING.  If not, write to
-;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+;; along with GNU Emacs; see the file COPYING.  If not, write to the
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
 
 ;;; Commentary:
 
 ;; The other access methods (nntp, nnspool, etc) are general news
-;; access methods. This module relies on Gnus and can not be used
+;; access methods.  This module relies on Gnus and can not be used
 ;; separately.
 
 ;;; Code:
 (require 'nntp)
 (require 'nnheader)
 (require 'gnus)
+(require 'nnoo)
+(require 'gnus-util)
+(require 'gnus-start)
+(require 'gnus-sum)
+(require 'gnus-msg)
+(eval-when-compile (require 'cl))
+
+(nnoo-declare nnvirtual)
+
+(defvoo nnvirtual-always-rescan t
+  "If non-nil, always scan groups for unread articles when entering a group.
+If this variable is nil and you read articles in a component group
+after the virtual group has been activated, the read articles from the
+component group will show up when you enter the virtual group.")
+
+(defvoo nnvirtual-component-regexp nil
+  "Regexp to match component groups.")
+
+(defvoo nnvirtual-component-groups nil
+  "Component group in this nnvirtual group.")
 
 \f
 
-(defconst nnvirtual-version "nnvirtual 0.0"
-  "Version number of this version of nnvirtual.")
+(defconst nnvirtual-version "nnvirtual 1.1")
+
+(defvoo nnvirtual-current-group nil)
+
+(defvoo nnvirtual-mapping-table nil
+  "Table of rules on how to map between component group and article number to virtual article number.")
 
-(defvar nnvirtual-group-alist nil)
-(defvar nnvirtual-current-group nil)
-(defvar nnvirtual-current-groups nil)
-(defvar nnvirtual-current-mapping nil)
+(defvoo nnvirtual-mapping-offsets nil
+  "Table indexed by component group to an offset to be applied to article numbers in that group.")
 
-(defvar nnvirtual-do-not-open nil)
+(defvoo nnvirtual-mapping-len 0
+  "Number of articles in this virtual group.")
 
-(defvar nnvirtual-status-string "")
+(defvoo nnvirtual-mapping-reads nil
+  "Compressed sequence of read articles on the virtual group as computed from the unread status of individual component groups.")
+
+(defvoo nnvirtual-mapping-marks nil
+  "Compressed marks alist for the virtual group as computed from the marks of individual component groups.")
+
+(defvoo nnvirtual-info-installed nil
+  "T if we have already installed the group info for this group, and shouldn't blast over it again.")
+
+(defvoo nnvirtual-status-string "")
+
+(eval-and-compile
+  (autoload 'gnus-cache-articles-in-group "gnus-cache"))
 
 \f
 
 ;;; Interface functions.
 
-(defun nnvirtual-retrieve-headers (sequence &optional newsgroup server)
-  "Retrieve the headers for the articles in SEQUENCE."
-  (nnvirtual-possibly-change-newsgroups newsgroup server t)
-  (save-excursion
-    (set-buffer (get-buffer-create "*virtual headers*"))
-    (buffer-disable-undo (current-buffer))
-    (erase-buffer)
-    (let ((map nnvirtual-current-mapping)
-         (offset 0)
-         articles beg group active top article result prefix)
-      (while sequence
-       (while (< (car (car map)) (car sequence))
-         (setq offset (car (car map)))
-         (setq map (cdr map)))
-       (setq top (car (car map)))
-       (setq group (nth 1 (car map)))
-       (setq prefix (gnus-group-real-prefix group))
-       (setq active (nth 2 (car map)))
-       (setq articles nil)
-       (while (and sequence (<= (car sequence) top))
-         (setq articles (cons (- (+ active (car sequence)) offset) articles))
-         (setq sequence (cdr sequence)))
-       (setq articles (nreverse articles))
-       (if (and articles
-                (setq result (gnus-retrieve-headers articles group)))
-           (save-excursion
+(nnoo-define-basics nnvirtual)
+
+
+(deffoo nnvirtual-retrieve-headers (articles &optional newsgroup
+                                     &nbs