Gnus development mailing list
 help / color / mirror / Atom feed
* patch for nnimap.el: make sure mailbox is unselected before deletion
@ 2008-06-12  7:45 David Engster
  0 siblings, 0 replies; 3+ messages in thread
From: David Engster @ 2008-06-12  7:45 UTC (permalink / raw)
  To: ding

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

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.

Regards,
David




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

* Re: patch for nnimap.el: make sure mailbox is unselected before deletion
  2008-06-12 13:53 David Engster
@ 2008-06-15 16:15 ` Reiner Steib
  0 siblings, 0 replies; 3+ messages in thread
From: Reiner Steib @ 2008-06-15 16:15 UTC (permalink / raw)
  To: David Engster; +Cc: ding

On Thu, Jun 12 2008, David Engster wrote:

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

Looks correct, so I committed it.  Thanks.

(Next time, please provide a ChangeLog entry.)

> 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?

I saw this problem as well in the past.

Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/



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

* patch for nnimap.el: make sure mailbox is unselected before deletion
@ 2008-06-12 13:53 David Engster
  2008-06-15 16:15 ` Reiner Steib
  0 siblings, 1 reply; 3+ messages in thread
From: David Engster @ 2008-06-12 13:53 UTC (permalink / raw)
  To: ding

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.



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

end of thread, other threads:[~2008-06-15 16:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-06-12  7:45 patch for nnimap.el: make sure mailbox is unselected before deletion David Engster
2008-06-12 13:53 David Engster
2008-06-15 16:15 ` 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).