Gnus development mailing list
 help / color / mirror / Atom feed
From: asjo@koldfront.dk (Adam Sjøgren)
To: ding@gnus.org
Subject: Re: Using IMAP as POP, :mailbox taking a list?
Date: Fri, 04 Sep 2015 12:30:35 +0200	[thread overview]
Message-ID: <874mjaxyr8.fsf@tullinup.koldfront.dk> (raw)
In-Reply-To: <878u8mo6js.fsf@igel.home>

Andreas writes:

> Looks doable, see mail-source-fetch-imap.  You probably just need to add
> a loop over mailbox.

Yeah, I have got it working with this change:

--- a/lisp/mail-source.el
+++ b/lisp/mail-source.el
@@ -1090,10 +1090,13 @@ This only works when `display-time' is enabled."
       (if (and (imap-open server port stream authentication buf)
               (imap-authenticate
                user (or (cdr (assoc from mail-source-password-cache))
-                        password) buf)
-              (imap-mailbox-select mailbox nil buf))
+                        password) buf))
+          (let ((mailbox-list (if (listp mailbox) mailbox (list mailbox))))
+            (dolist (mailbox mailbox-list)
+              (when (imap-mailbox-select mailbox nil buf)
          (let ((coding-system-for-write mail-source-imap-file-coding-system)
                str)
+            (message (format "Fetching from %s..." mailbox))
            (with-temp-file mail-source-crash-box
              ;; Avoid converting 8-bit chars from inserted strings to
              ;; multibyte.
@@ -1128,8 +1131,7 @@ This only works when `display-time' is enabled."
               fetchflag nil buf))
            (if dontexpunge
                (imap-mailbox-unselect buf)
-             (imap-mailbox-close nil buf))
-           (imap-close buf))
+             (imap-mailbox-close nil buf))))))
        (imap-close buf)
        ;; We nix out the password in case the error
        ;; was because of a wrong password being given.


Now I just need to document and wrap it up nicely; I hope :-)

It is incredible how much writing about what you (I) can't figure out
motivates...


  Best regards,

   Adam

-- 
 "Vi er fanget i en kø                                        Adam Sjøgren
  I lys og nærkontakt.                                   asjo@koldfront.dk
  Hun sir at vi skal dø
  Det gad jeg ikke have sagt"




  reply	other threads:[~2015-09-04 10:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-04  8:12 Adam Sjøgren
2015-09-04  8:47 ` Eric S Fraga
2015-09-04  8:56   ` Adam Sjøgren
2015-09-04 10:08     ` Eric S Fraga
2015-09-04  9:25 ` Adam Sjøgren
2015-09-04  9:52 ` Andreas Schwab
2015-09-04 10:30   ` Adam Sjøgren [this message]
2015-09-05  8:27     ` Adam Sjøgren

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=874mjaxyr8.fsf@tullinup.koldfront.dk \
    --to=asjo@koldfront.dk \
    --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).