Indent.
[gnus] / lisp / gnus-int.el
index 767ac2e..1190d79 100644 (file)
@@ -1,7 +1,6 @@
 ;;; gnus-int.el --- backend interface functions for Gnus
 
-;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
-;;   2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+;; Copyright (C) 1996-2012 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: news
 
 (defcustom gnus-after-set-mark-hook nil
   "Hook called just after marks are set in a group."
+  :version "24.1"
   :group 'gnus-start
   :type 'hook)
 
 (defcustom gnus-before-update-mark-hook nil
   "Hook called just before marks are updated in a group."
+  :version "24.1"
   :group 'gnus-start
   :type 'hook)
 
@@ -64,6 +65,13 @@ server denied."
                 (const :tag "Deny server" denied)
                 (const :tag "Unplug Agent" offline)))
 
+(defcustom gnus-nntp-server nil
+  "The name of the host running the NNTP server."
+  :group 'gnus-server
+  :type '(choice (const :tag "disable" nil)
+                string))
+(make-obsolete-variable 'gnus-nntp-server 'gnus-select-method "24.1")
+
 (defvar gnus-internal-registry-spool-current-method nil
   "The current method, for the registry.")
 
@@ -239,7 +247,7 @@ If it is down, start it up (again)."
   (eq (nth 1 (assoc method gnus-opened-servers))
       'denied))
 
-(defvar gnus-backend-trace t)
+(defvar gnus-backend-trace nil)
 
 (defun gnus-open-server (gnus-command-method)
   "Open a connection to GNUS-COMMAND-METHOD."
@@ -256,7 +264,8 @@ If it is down, start it up (again)."
     ;; If this method was previously denied, we just return nil.
     (if (eq (nth 1 elem) 'denied)
        (progn
-         (gnus-message 1 "Denied server %s" server)
+         (gnus-message
+          1 "Server %s previously determined to be down; not retrying" server)
          nil)
       ;; Open the server.
       (let* ((open-server-function
@@ -271,7 +280,9 @@ If it is down, start it up (again)."
                               server (error-message-string err))
                 nil)
                (quit
-                (gnus-message 1 "Quit trying to open server %s" server)
+                (if debug-on-quit
+                    (debug "Quit")
+                  (gnus-message 1 "Quit trying to open server %s" server))
                 nil)))
             open-offline)
        ;; If this hasn't been opened before, we add it to the list.
@@ -347,7 +358,7 @@ If it is down, start it up (again)."
           infos data))
 
 (defun gnus-retrieve-group-data-early (gnus-command-method infos)
-  "Start early async retrival of data from GNUS-COMMAND-METHOD."
+  "Start early async retrieval of data from GNUS-COMMAND-METHOD."
   (when (stringp gnus-command-method)
     (setq gnus-command-method (gnus-server-to-method gnus-command-method)))
   (funcall (gnus-get-function gnus-command-method 'retrieve-group-data-early)
@@ -387,7 +398,7 @@ If it is down, start it up (again)."
     result))
 
 (defun gnus-request-compact (gnus-command-method)
-  "Request groups compaction  from GNUS-COMMAND-METHOD."
+  "Request groups compaction from GNUS-COMMAND-METHOD."
   (when (stringp gnus-command-method)
     (setq gnus-command-method (gnus-server-to-method gnus-command-method)))
   (funcall (gnus-get-function gnus-command-method 'request-compact)
@@ -473,6 +484,18 @@ If FETCH-OLD, retrieve all headers (or some subset thereof) in the group."
       (funcall (gnus-get-function gnus-command-method 'request-type)
               (gnus-group-real-name group) article))))
 
+(defun gnus-request-update-group-status (group status)
+  "Change the status of a group.
+Valid statuses include `subscribe' and `unsubscribe'."
+  (let ((gnus-command-method (gnus-find-method-for-group group)))
+    (if (not (gnus-check-backend-function
+             'request-update-group-status (car gnus-command-method)))
+       nil
+      (funcall
+       (gnus-get-function gnus-command-method 'request-update-group-status)
+       (gnus-group-real-name group) status
+       (nth 1 gnus-command-method)))))
+
 (defun gnus-request-set-mark (group action)
   "Set marks on articles in the back end."
   (let ((gnus-command-method (gnus-find-method-for-group group)))
@@ -503,12 +526,12 @@ If BUFFER, insert the article in that group."
             article (gnus-group-real-name group)
             (nth 1 gnus-command-method) buffer)))
 
-(defun gnus-request-thread (id)
-  "Request the headers in the thread containing the article
-specified by Message-ID id."
-  (let ((gnus-command-method (gnus-find-method-for-group gnus-newsgroup-name)))
+(defun gnus-request-thread (header group)
+  "Request the headers in the thread containing the article specified by HEADER."
+  (let ((gnus-command-method (gnus-find-method-for-group group)))
     (funcall (gnus-get-function gnus-command-method 'request-thread)
-            id)))
+            header
+            (gnus-group-real-name group))))
 
 (defun gnus-warp-to-article ()
   "Warps from an article in a virtual group to the article in its
@@ -628,8 +651,7 @@ If GROUP is nil, all groups on GNUS-COMMAND-METHOD are scanned."
   (when (gnus-check-backend-function
         'request-marks (car gnus-command-method))
     (let ((group (gnus-info-group info)))
-      (and (funcall (gnus-get-function gnus-command-method
-                                      'request-update-info)
+      (and (funcall (gnus-get-function gnus-command-method 'request-marks)
                    (gnus-group-real-name group)
                    info (nth 1 gnus-command-method))
           ;; If the minimum article number is greater than 1, then all
@@ -700,7 +722,9 @@ If GROUP is nil, all groups on GNUS-COMMAND-METHOD are scanned."
          (if (stringp group) (gnus-group-real-name group) group)
          (cadr gnus-command-method)
          last)))
-    (when (and gnus-agent (gnus-agent-method-p gnus-command-method))
+    (when (and gnus-agent
+              (gnus-agent-method-p gnus-command-method)
+              (cdr result))
       (gnus-agent-regenerate-group group (list (cdr result))))
     result))