Gnus development mailing list
 help / color / mirror / Atom feed
* [patch] gnus-agent doesn't always synchronise flags if asked to
@ 2007-09-08 14:54 Elias Oltmanns
  2007-11-09 13:33 ` Elias Oltmanns
  0 siblings, 1 reply; 5+ messages in thread
From: Elias Oltmanns @ 2007-09-08 14:54 UTC (permalink / raw)
  To: ding

[-- Attachment #1: Type: text/plain, Size: 516 bytes --]

Hi all,

when gnus is switched into plugged mode and any of the agentised servers
is offline at the time, the user is asked whether to switch that server
into online mode. However, neither then, nor when gnus actually opens a
connection to that server (for instance after pressing g in the group
buffer) flags are synchronised even though gnus-agent-synchronize-flags
is set to t or 'ask.

I suggest to call gnus-agent-possibly-synchronize-flags from
gnus-open-server. Please find the patch below.

Regards,

Elias


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: sync.patch --]
[-- Type: text/x-patch, Size: 3153 bytes --]

Index: lisp/gnus-agent.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/gnus-agent.el,v
retrieving revision 7.70
diff -u -r7.70 gnus-agent.el
--- lisp/gnus-agent.el	14 Aug 2007 11:45:48 -0000	7.70
+++ lisp/gnus-agent.el	8 Sep 2007 14:42:49 -0000
@@ -636,8 +636,7 @@
                  (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 @@
   (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 @@
 
 (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: lisp/gnus-int.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/gnus-int.el,v
retrieving revision 7.23
diff -u -r7.23 gnus-int.el
--- lisp/gnus-int.el	24 Jan 2007 07:15:37 -0000	7.23
+++ lisp/gnus-int.el	8 Sep 2007 14:42:50 -0000
@@ -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 @@
               ;; 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)

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-11-28 20:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-09-08 14:54 [patch] gnus-agent doesn't always synchronise flags if asked to Elias Oltmanns
2007-11-09 13:33 ` Elias Oltmanns
2007-11-24 21:51   ` Reiner Steib
2007-11-27 11:46     ` Elias Oltmanns
2007-11-28 20:47       ` Gnus and Emacs branches (was: [patch] gnus-agent doesn't always synchronise flags if asked to) Reiner Steib

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).