* gnus.el (gnus-method-to-server): Add an optional parameter so the
authorReiner Steib <Reiner.Steib@gmx.de>
Wed, 28 Nov 2007 20:32:49 +0000 (20:32 +0000)
committerReiner Steib <Reiner.Steib@gmx.de>
Wed, 28 Nov 2007 20:32:49 +0000 (20:32 +0000)
caller can indicate whether the cache should be disregarded for this
call.  This way the result of the call is reproducible at all times and
can be considered a canonical server name for the supplied method.
(gnus-agent-method-p): Canonicalize server names by pushing their
method through `gnus-method-to-server' using the no-cache argument.

* gnus-srvr.el (gnus-server-insert-server-line): Call
`gnus-method-to-server' with `no-cache' argument.

* gnus-agent.el (gnus-agent-toggle-plugged): Don't call
gnus-agent-possibly-synchronize-flags as this should be called when the
server is actually being opened.
(gnus-agent-possibly-synchronize-flags)
(gnus-agent-possibly-synchronize-flags-server): Move check for the
flags file of an agentized server to the latter function.

* gnus-int.el (gnus-agent-possibly-synchronize-flags-server): Autoload.
(gnus-open-server): Call gnus-agent-possibly-synchronize-flags-server
after a connection has been established successfully.

lisp/ChangeLog
lisp/gnus-agent.el
lisp/gnus-int.el
lisp/gnus-srvr.el
lisp/gnus.el

index e3060eb..eb3b4db 100644 (file)
@@ -1,3 +1,26 @@
+2007-11-28  Elias Oltmanns  <eo@nebensachen.de>
+
+       * gnus.el (gnus-method-to-server): Add an optional parameter so the
+       caller can indicate whether the cache should be disregarded for this
+       call.  This way the result of the call is reproducible at all times and
+       can be considered a canonical server name for the supplied method.
+       (gnus-agent-method-p): Canonicalize server names by pushing their
+       method through `gnus-method-to-server' using the no-cache argument.
+
+       * gnus-srvr.el (gnus-server-insert-server-line): Call
+       `gnus-method-to-server' with `no-cache' argument.
+
+       * gnus-agent.el (gnus-agent-toggle-plugged): Don't call
+       gnus-agent-possibly-synchronize-flags as this should be called when the
+       server is actually being opened.
+       (gnus-agent-possibly-synchronize-flags)
+       (gnus-agent-possibly-synchronize-flags-server): Move check for the
+       flags file of an agentized server to the latter function.
+
+       * gnus-int.el (gnus-agent-possibly-synchronize-flags-server): Autoload.
+       (gnus-open-server): Call gnus-agent-possibly-synchronize-flags-server
+       after a connection has been established successfully.
+
 2007-11-28  Katsumi Yamaoka  <yamaoka@jpl.org>
 
        * gnus-art.el (article-display-face): Force to display face if called
        * gnus-msg.el (gnus-summary-reply): Ignore
        gnus-confirm-mail-reply-to-news for wide and very wide replies.
 
-2007-11-24  Elias Oltmanns  <eo@nebensachen.de>
-
-       * gnus.el (gnus-method-to-server): Add an optional parameter so the
-       caller can indicate whether the cache should be disregarded for this
-       call.  This way the result of the call is reproducible at all times and
-       can be considered a canonical server name for the supplied method.
-       (gnus-agent-method-p): Canonicalize server names by pushing their
-       method through `gnus-method-to-server' using the no-cache argument.
-
-       * gnus-srvr.el (gnus-server-insert-server-line): Call
-       `gnus-method-to-server' with `no-cache' argument.
-
-       * gnus-agent.el (gnus-agent-toggle-plugged): Don't call
-       gnus-agent-possibly-synchronize-flags as this should be called when the
-       server is actually being opened.
-       (gnus-agent-possibly-synchronize-flags)
-       (gnus-agent-possibly-synchronize-flags-server): Move check for the
-       flags file of an agentized server to the latter function.
-
-       * gnus-int.el (gnus-agent-possibly-synchronize-flags-server): Autoload.
-       (gnus-open-server): Call gnus-agent-possibly-synchronize-flags-server
-       after a connection has been established successfully.
-
 2007-11-24  Reiner Steib  <Reiner.Steib@gmx.de>
 
        * tls.el (tls-checktrust, tls-hostmismatch, tls-untrusted): Add custom
index 0271186..55ca422 100644 (file)
@@ -636,8 +636,7 @@ manipulated as follows:
                  (gnus-agent-make-mode-line-string " Plugged"
                                                    'mouse-2
                                                    'gnus-agent-toggle-plugged))
-         (gnus-agent-go-online gnus-agent-go-online)
-         (gnus-agent-possibly-synchronize-flags))
+         (gnus-agent-go-online gnus-agent-go-online))
         (t
          (gnus-agent-close-connections)
          (setq gnus-plugged set-to)
@@ -868,8 +867,7 @@ be a select method."
   (interactive)
   (save-excursion
     (dolist (gnus-command-method (gnus-agent-covered-methods))
-      (when (and (file-exists-p (gnus-agent-lib-file "flags"))
-                (eq (gnus-server-status gnus-command-method) 'ok))
+      (when (eq (gnus-server-status gnus-command-method) 'ok)
        (gnus-agent-possibly-synchronize-flags-server gnus-command-method)))))
 
 (defun gnus-agent-synchronize-flags-server (method)
@@ -905,11 +903,13 @@ be a select method."
 
 (defun gnus-agent-possibly-synchronize-flags-server (method)
   "Synchronize flags for server according to `gnus-agent-synchronize-flags'."
-  (when (or (and gnus-agent-synchronize-flags
-                (not (eq gnus-agent-synchronize-flags 'ask)))
-           (and (eq gnus-agent-synchronize-flags 'ask)
-                (gnus-y-or-n-p (format "Synchronize flags on server `%s'? "
-                                       (cadr method)))))
+  (when (and (file-exists-p (gnus-agent-lib-file "flags"))
+            (or (and gnus-agent-synchronize-flags
+                     (not (eq gnus-agent-synchronize-flags 'ask)))
+                (and (eq gnus-agent-synchronize-flags 'ask)
+                     (gnus-y-or-n-p
+                      (format "Synchronize flags on server `%s'? "
+                              (cadr method))))))
     (gnus-agent-synchronize-flags-server method)))
 
 ;;;###autoload
index 52b5e35..ac2b723 100644 (file)
@@ -36,6 +36,7 @@
 (autoload 'gnus-agent-expire "gnus-agent")
 (autoload 'gnus-agent-regenerate-group "gnus-agent")
 (autoload 'gnus-agent-read-servers-validate-native "gnus-agent")
+(autoload 'gnus-agent-possibly-synchronize-flags-server "gnus-agent")
 
 (defcustom gnus-open-server-hook nil
   "Hook called just before opening connection to the news server."
@@ -278,6 +279,11 @@ If it is down, start it up (again)."
               ;; prompting with "go offline?".  This is only a concern
               ;; when the agent's backend fails to open the server.
               (gnus-open-server gnus-command-method))
+         (when (and (eq (cadr elem) 'ok) gnus-agent
+                    (gnus-agent-method-p gnus-command-method))
+           (save-excursion
+             (gnus-agent-possibly-synchronize-flags-server
+              gnus-command-method)))
           result)))))
 
 (defun gnus-close-server (gnus-command-method)
index ca087f9..77e06ee 100644 (file)
@@ -280,7 +280,7 @@ The following commands are available:
        ;; Insert the text.
        (eval gnus-server-line-format-spec))
      (list 'gnus-server (intern gnus-tmp-name)
-           'gnus-named-server (intern (gnus-method-to-server method))))))
+           'gnus-named-server (intern (gnus-method-to-server method t))))))
 
 (defun gnus-enter-server-buffer ()
   "Set up the server buffer."
index 39d365b..d1fe91e 100644 (file)
@@ -3519,15 +3519,16 @@ that that variable is buffer-local to the summary buffers."
                                   (nth 1 method))))
       method)))
 
-(defsubst gnus-method-to-server (method)
+(defsubst gnus-method-to-server (method &optional nocache)
   (catch 'server-name
     (setq method (or method gnus-select-method))
 
     ;; Perhaps it is already in the cache.
-    (mapc (lambda (name-method)
-           (if (equal (cdr name-method) method)
-               (throw 'server-name (car name-method))))
-         gnus-server-method-cache)
+    (unless nocache
+      (mapc (lambda (name-method)
+             (if (equal (cdr name-method) method)
+                 (throw 'server-name (car name-method))))
+           gnus-server-method-cache))
 
     (mapc
      (lambda (server-alist)
@@ -4252,14 +4253,16 @@ Allow completion over sensible values."
 
 ;;; Agent functions
 
-(defun gnus-agent-method-p (method)
+(defun gnus-agent-method-p (method-or-server)
   "Say whether METHOD is covered by the agent."
-  (or (eq (car gnus-agent-method-p-cache) method)
-      (setq gnus-agent-method-p-cache
-           (cons method
-                 (member (if (stringp method)
-                             method
-                           (gnus-method-to-server method)) gnus-agent-covered-methods))))
+  (or (eq (car gnus-agent-method-p-cache) method-or-server)
+      (let* ((method (if (stringp method-or-server)
+                        (gnus-server-to-method method-or-server)
+                      method-or-server))
+            (server (gnus-method-to-server method t)))
+       (setq gnus-agent-method-p-cache
+             (cons method-or-server
+                   (member server gnus-agent-covered-methods)))))
   (cdr gnus-agent-method-p-cache))
 
 (defun gnus-online (method)