emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r102460: nnimap.el (nnimap-unselect-g


From: Katsumi Yamaoka
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r102460: nnimap.el (nnimap-unselect-group): Made into its own function.
Date: Sun, 21 Nov 2010 07:11:35 +0000
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 102460
author: Lars Magne Ingebrigtsen <address@hidden>
committer: Katsumi Yamaoka <address@hidden>
branch nick: trunk
timestamp: Sun 2010-11-21 07:11:35 +0000
message:
  nnimap.el (nnimap-unselect-group): Made into its own function.
   (nnimap-request-rename-group): Unselect group before renaming.  This had 
gotten lost somewhere.
   (nnimap-request-accept-article): Keep track of examined groups, and unselect 
the group before APPENDing to read-only groups.
   (nnimap-request-move-article): Clear flags before moving so that they can be 
re-set later.
modified:
  lisp/gnus/ChangeLog
  lisp/gnus/nnimap.el
=== modified file 'lisp/gnus/ChangeLog'
--- a/lisp/gnus/ChangeLog       2010-11-20 22:25:56 +0000
+++ b/lisp/gnus/ChangeLog       2010-11-21 07:11:35 +0000
@@ -1,3 +1,13 @@
+2010-11-21  Lars Magne Ingebrigtsen  <address@hidden>
+
+       * nnimap.el (nnimap-unselect-group): Made into its own function.
+       (nnimap-request-rename-group): Unselect group before renaming.  This
+       had gotten lost somewhere.
+       (nnimap-request-accept-article): Keep track of examined groups, and
+       unselect the group before APPENDing to read-only groups.
+       (nnimap-request-move-article): Clear flags before moving so that they
+       can be re-set later.
+
 2010-11-20  Katsumi Yamaoka  <address@hidden>
 
        * gnus-gravatar.el (gnus-gravatar-transform-address): Decode name again.

=== modified file 'lisp/gnus/nnimap.el'
--- a/lisp/gnus/nnimap.el       2010-11-10 23:16:01 +0000
+++ b/lisp/gnus/nnimap.el       2010-11-21 07:11:35 +0000
@@ -125,7 +125,7 @@
 
 (defstruct nnimap
   group process commands capabilities select-result newlinep server
-  last-command-time greeting)
+  last-command-time greeting examined)
 
 (defvar nnimap-object nil)
 
@@ -727,13 +727,17 @@
 (deffoo nnimap-request-rename-group (group new-name &optional server)
   (when (nnimap-possibly-change-group nil server)
     (with-current-buffer (nnimap-buffer)
-      ;; Make sure we don't have this group open read/write by asking
-      ;; to examine a mailbox that doesn't exist.  This seems to be
-      ;; the only way that allows us to reliably go back to unselected
-      ;; state on Courier.
+      (nnimap-unselect-group)
       (car (nnimap-command "RENAME %S %S"
                           (utf7-encode group t) (utf7-encode new-name t))))))
 
+(defun nnimap-unselect-group ()
+  ;; Make sure we don't have this group open read/write by asking
+  ;; to examine a mailbox that doesn't exist.  This seems to be
+  ;; the only way that allows us to reliably go back to unselected
+  ;; state on Courier.
+  (nnimap-command "EXAMINE DOES.NOT.EXIST"))
+
 (deffoo nnimap-request-expunge-group (group &optional server)
   (when (nnimap-possibly-change-group group server)
     (with-current-buffer (nnimap-buffer)
@@ -774,6 +778,9 @@
        (if internal-move-group
            (let ((result
                   (with-current-buffer (nnimap-buffer)
+                    ;; Clear all flags before moving.
+                    (nnimap-send-command "UID STORE %d FLAGS.SILENT ()"
+                                         article)
                     (nnimap-command "UID COPY %d %S"
                                     article
                                     (utf7-encode internal-move-group t)))))
@@ -863,6 +870,7 @@
     (erase-buffer)
     (unless (equal group (nnimap-group nnimap-object))
       (setf (nnimap-group nnimap-object) nil)
+      (setf (nnimap-examined nnimap-object) group)
       (nnimap-send-command "EXAMINE %S" (utf7-encode group t)))
     (let ((sequence
           (nnimap-send-command "UID SEARCH HEADER Message-Id %S" message-id))
@@ -936,6 +944,10 @@
       (nnimap-add-cr)
       (setq message (buffer-substring-no-properties (point-min) (point-max)))
       (with-current-buffer (nnimap-buffer)
+       ;; If we have this group open read-only, then unselect it
+       ;; before appending to it.
+       (when (equal (nnimap-examined nnimap-object) group)
+         (nnimap-unselect-group))
        (erase-buffer)
        (setq sequence (nnimap-send-command
                        "APPEND %S {%d}" (utf7-encode group t)
@@ -994,6 +1006,7 @@
        (with-current-buffer (nnimap-buffer)
          (setf (nnimap-group nnimap-object) nil)
          (dolist (group groups)
+           (setf (nnimap-examined nnimap-object) group)
            (push (list (nnimap-send-command "EXAMINE %S" (utf7-encode group t))
                        group)
                  sequences))
@@ -1052,6 +1065,7 @@
                active (cdr (assq 'active params))
                uidvalidity (cdr (assq 'uidvalidity params))
                modseq (cdr (assq 'modseq params)))
+         (setf (nnimap-examined nnimap-object) group)
          (if (and qresyncp
                   uidvalidity
                   modseq)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]