Gnus development mailing list
 help / color / mirror / Atom feed
From: Elias Oltmanns <eo@nebensachen.de>
To: ding@gnus.org
Subject: [patch] gnus-agent doesn't always synchronise flags if asked to
Date: Sat, 08 Sep 2007 16:54:55 +0200	[thread overview]
Message-ID: <874pi51a2o.fsf@denkblock.local> (raw)

[-- 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)

             reply	other threads:[~2007-09-08 14:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-08 14:54 Elias Oltmanns [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874pi51a2o.fsf@denkblock.local \
    --to=eo@nebensachen.de \
    --cc=ding@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).