Remove gnus-fixup-nnimap-unread-after-getting-new-news.
[gnus] / lisp / gnus-start.el
index 97a920a..8bbadc8 100644 (file)
@@ -402,8 +402,7 @@ This hook is called as the first thing when Gnus is started."
   :group 'gnus-start
   :type 'hook)
 
-(defcustom gnus-setup-news-hook
-  '(gnus-fixup-nnimap-unread-after-getting-new-news)
+(defcustom gnus-setup-news-hook nil
   "A hook after reading the .newsrc file, but before generating the buffer."
   :group 'gnus-start
   :type 'hook)
@@ -420,8 +419,7 @@ This hook is called as the first thing when Gnus is started."
   :type 'hook)
 
 (defcustom gnus-after-getting-new-news-hook
-  '(gnus-display-time-event-handler
-    gnus-fixup-nnimap-unread-after-getting-new-news)
+  '(gnus-display-time-event-handler)
   "*A hook run after Gnus checks for new news when Gnus is already running."
   :group 'gnus-group-new
   :type 'hook)
@@ -705,6 +703,7 @@ the first newsgroup."
        nnoo-state-alist nil
        gnus-current-select-method nil
        nnmail-split-history nil
+       gnus-extended-servers nil
        gnus-ephemeral-servers nil)
   (gnus-shutdown 'gnus)
   ;; Kill the startup file.
@@ -1693,20 +1692,6 @@ If SCAN, request a scan of that group as well."
     (while newsrc
       (setq active (gnus-active (setq group (gnus-info-group
                                             (setq info (pop newsrc))))))
-
-      ;; Check newsgroups.  If the user doesn't want to check them, or
-      ;; they can't be checked (for instance, if the news server can't
-      ;; be reached) we just set the number of unread articles in this
-      ;; newsgroup to t.  This means that Gnus thinks that there are
-      ;; unread articles, but it has no idea how many.
-
-      ;; To be more explicit:
-      ;; >0 for an active group with messages
-      ;; 0 for an active group with no unread messages
-      ;; nil for non-foreign groups that the user has requested not be checked
-      ;; t for unchecked foreign groups or bogus groups, or groups that can't
-      ;;   be checked, for one reason or other.
-
       ;; First go through all the groups, see what select methods they
       ;; belong to, and then collect them into lists per unique select
       ;; method.
@@ -1714,10 +1699,12 @@ If SCAN, request a scan of that group as well."
          (setq method gnus-select-method)
        ;; There may be several similar methods.  Possibly extend the
        ;; method.
-       (setq method (gnus-find-method-for-group (gnus-info-group info) info))
        (if (setq cmethod (assoc method methods-cache))
            (setq method (cdr cmethod))
-         (setq cmethod (inline (gnus-server-get-method nil method)))
+         (setq cmethod (if (stringp method)
+                           (gnus-server-to-method method)
+                         (inline (gnus-find-method-for-group
+                                  (gnus-info-group info) info))))
          (push (cons method cmethod) methods-cache)
          (setq method cmethod)))
       (setq method-group-list (assoc method type-cache))
@@ -1768,8 +1755,7 @@ If SCAN, request a scan of that group as well."
          (when (gnus-check-backend-function
                 'retrieve-group-data-early (car method))
            (when (gnus-check-backend-function 'request-scan (car method))
-             (dolist (info infos)
-               (gnus-request-scan (gnus-info-group info) method)))
+             (gnus-request-scan nil method))
            (setcar (nthcdr 3 elem)
                    (gnus-retrieve-group-data-early method infos))))))
 
@@ -1777,12 +1763,14 @@ If SCAN, request a scan of that group as well."
     (dolist (elem type-cache)
       (destructuring-bind (method method-type infos early-data) elem
        (when (and method infos)
-         ;; See if any of the groups from this method require updating.
-         (gnus-read-active-for-groups method infos early-data)
-         (dolist (info infos)
-           (inline (gnus-get-unread-articles-in-group
-                    info (gnus-active (gnus-info-group info))
-                    t))))))
+         (let ((updatep (gnus-check-backend-function
+                         'request-update-info (car method))))
+           ;; See if any of the groups from this method require updating.
+           (gnus-read-active-for-groups method infos early-data)
+           (dolist (info infos)
+             (inline (gnus-get-unread-articles-in-group
+                      info (gnus-active (gnus-info-group info))
+                      updatep)))))))
     (gnus-message 6 "Checking new news...done")))
 
 (defun gnus-method-rank (type method)
@@ -1817,8 +1805,7 @@ If SCAN, request a scan of that group as well."
       (gnus-agent-save-active method))
      ((gnus-check-backend-function 'retrieve-groups (car method))
       (when (gnus-check-backend-function 'request-scan (car method))
-       (dolist (info infos)
-         (gnus-request-scan (gnus-info-group info) method)))
+       (gnus-request-scan nil method))
       (let (groups)
        (gnus-read-active-file-2
         (dolist (info infos (nreverse groups))
@@ -2066,10 +2053,7 @@ If SCAN, request a scan of that group as well."
                          (gnus-online method))
                     (not gnus-agent))
                 (gnus-check-backend-function 'request-scan (car method)))
-       (if infos
-           (dolist (info infos)
-             (gnus-request-scan (gnus-info-group info) method))
-         (gnus-request-scan nil method)))
+       (gnus-request-scan nil method))
       (cond
        ((and (eq gnus-read-active-file 'some)
             (gnus-check-backend-function 'retrieve-groups (car method))
@@ -3162,20 +3146,6 @@ If this variable is nil, don't do anything."
           (gnus-boundp 'display-time-timer))
       (display-time-event-handler)))
 
-;;;###autoload
-(defun gnus-fixup-nnimap-unread-after-getting-new-news ()
-  (let (server group info)
-    (mapatoms
-     (lambda (sym)
-       (when (and (setq group (symbol-name sym))
-                 (gnus-group-entry group)
-                 (setq info (symbol-value sym)))
-        (gnus-sethash group (cons (nth 2 info) (cdr (gnus-group-entry group)))
-                      gnus-newsrc-hashtb)))
-     (if (boundp 'nnimap-mailbox-info)
-        (symbol-value 'nnimap-mailbox-info)
-       (make-vector 1 0)))))
-
 (defun gnus-check-reasonable-setup ()
   ;; Check whether nnml and nnfolder share a directory.
   (let ((display-warn