Gnus development mailing list
 help / color / mirror / Atom feed
From: David Engster <deng@randomsample.de>
To: ding@gnus.org
Subject: patch for nnimap.el: make sure mailbox is unselected before deletion
Date: Thu, 12 Jun 2008 15:53:35 +0200	[thread overview]
Message-ID: <kziqwekbds.fsf@kafka.physik3.gwdg.de> (raw)

nnmairix sometimes triggers an error in nnimap when it deletes and
immediately re-creates a group on the server and checks it for
mail. nnimap seems to think the mailbox is still selected, leading to a
"No mailbox selected" error in the imap back end [1]. The following
patch makes sure the mailbox is unselected before deletion, which
circumvents this error:

--- nnimap.el   2008-06-10 11:20:33.000000000 +0200
+++ nnimap-patched.el   2008-06-10 11:13:25.000000000 +0200
@@ -1609,6 +1609,8 @@
 
 (deffoo nnimap-request-delete-group (group force &optional server)
   (when (nnimap-possibly-change-server server)
+    (when (string= group (imap-current-mailbox nnimap-server-buffer))
+      (imap-mailbox-unselect nnimap-server-buffer))
     (with-current-buffer nnimap-server-buffer
       (if force
          (or (null (imap-mailbox-status group 'uidvalidity))

By the way, I tried to post this several times in the last few days via
Gmane, but it never showed up, so I use mail now. Am I the only one
having this problem?

Regards,
David

[1] Here is an example from the IMAP log when this error occurs:

- check zz_mairix-cron-3 for mail, so that mailbox is selected

500 SELECT "zz_mairix-cron-3"
* FLAGS (\Answered \Flagged \Deleted \Seen \Draft)
* OK [PERMANENTFLAGS (\Answered \Flagged \Deleted \Seen \Draft \*)]
    Flags permitted.
* 118 EXISTS
* 0 RECENT
* OK [UIDVALIDITY 1213024279] UIDs valid
* OK [UIDNEXT 122] Predicted next UID
500 OK [READ-WRITE] Select completed.
501 FETCH 1,* UID
* 1 FETCH (UID 1)
* 118 FETCH (UID 121)
501 OK Fetch completed.

- delete and re-create group and check for mail

503 STATUS "zz_mairix-cron-3" (UIDVALIDITY)
* STATUS "zz_mairix-cron-3" (UIDVALIDITY 1213024279)
503 OK Status completed.
504 DELETE "zz_mairix-cron-3"
504 OK Delete completed.
505 STATUS "zz_mairix-cron-3" (UIDVALIDITY)
505 NO Mailbox doesn't exist: zz_mairix-cron-3
506 CREATE "zz_mairix-cron-3"
506 OK Create completed.
507 NOOP
507 OK NOOP completed.
508 FETCH 1,* UID
508 BAD No mailbox selected.



             reply	other threads:[~2008-06-12 13:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-12 13:53 David Engster [this message]
2008-06-15 16:15 ` Reiner Steib
  -- strict thread matches above, loose matches on Subject: below --
2008-06-12  7:45 David Engster

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=kziqwekbds.fsf@kafka.physik3.gwdg.de \
    --to=deng@randomsample.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).