[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[EXPERIMENTAL] agent support for nnimap



This patch against Gnus make the agent stash marks when it's
unplugged, type `J F' to synchronize them when you connect.

For now, please look in ~/News/agent/nnimap/pdc/agent.lib/flags
(replace pdc with your nnimap server name) before running `J F' to see
that all requests are what you wanted. There might be a Gnus Agent bug
here, see my post to the ding list.

Feedback most welcome!

diff -ur /tmp/jas/pgnus-0.83/lisp/gnus-agent.el lisp/gnus-agent.el
--- /tmp/jas/pgnus-0.83/lisp/gnus-agent.el      Sat Apr 17 18:45:17 1999
+++ lisp/gnus-agent.el  Fri Apr 23 00:03:35 1999
@@ -221,6 +221,7 @@
   "Jj" gnus-agent-toggle-plugged
   "Js" gnus-agent-fetch-session
   "JS" gnus-group-send-drafts
+  "JF" gnus-agent-send-flags
   "Ja" gnus-agent-add-group
   "Jr" gnus-agent-remove-group)
 
@@ -410,6 +411,26 @@
        (when (cadddr (setq c (gnus-group-category group)))
          (setf (cadddr c) (delete group (cadddr c))))))
     (gnus-category-write)))
+
+(defun gnus-agent-send-flags ()
+  "Send flag settings requests from Agent to servers, if any."
+  (interactive)
+  (save-excursion
+    (dolist (gnus-command-method gnus-agent-covered-methods)
+      (when (file-exists-p (gnus-agent-lib-file "flags"))
+       (set-buffer (get-buffer-create " *Gnus Agent flag synchronize*"))
+       (erase-buffer)
+       (insert-file-contents (gnus-agent-lib-file "flags"))
+       (if (null (gnus-check-server gnus-command-method))
+           (message "Couldn't open server %s" (nth 1 gnus-command-method))
+         (while (not (eobp))
+           (if (null (eval (read (current-buffer))))
+               (progn (forward-line)
+                      (kill-line -1))
+             (write-file (gnus-agent-lib-file "flags"))
+             (error "Couldn't set flags from file %s"
+                    (gnus-agent-lib-file "flags"))))
+         (write-file (gnus-agent-lib-file "flags")))))))
 
 ;;;
 ;;; Server mode commands
--- /tmp/jas/pgnus-0.83/lisp/nnagent.el Fri Jan 15 21:52:20 1999
+++ lisp/nnagent.el     Fri Apr 23 00:08:50 1999
@@ -114,7 +114,12 @@
   (gnus-request-accept-article "nndraft:queue" nil t t))
 
 (deffoo nnagent-request-set-mark (group action server)
-  action)
+  (with-temp-buffer
+    (insert (format "(%s-request-set-mark \"%s\" '%s \"%s\")\n"
+                    (nth 0 gnus-command-method) group action
+                    (or server (nth 1 gnus-command-method))))
+    (append-to-file (point-min) (point-max) (gnus-agent-lib-file "flags")))
+  nil)
 
 ;; Use nnml functions for just about everything.
 (nnoo-import nnagent