Gnus development mailing list
 help / color / mirror / Atom feed
* Using IMAP as POP, :mailbox taking a list?
@ 2015-09-04  8:12 Adam Sjøgren
  2015-09-04  8:47 ` Eric S Fraga
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Adam Sjøgren @ 2015-09-04  8:12 UTC (permalink / raw)
  To: ding

  Hi,


I'm using IMAP as POP at work (because the server is Microsoft Exchange,
i.e. reasons) in Gnus, and it works nicely.

To make email usable on the phone, however, I have configured Outlook to
sort incoming email into folders.

But I still want to fetch all [unseen] email into GNus, using IMAP as
POP.

So I have added 10 imap-entries to my mail-sources, each with a
different :mailbox value.

This works.

Except for one minor thing: it takes a while to establish the connection
to the mailserver 10 times (using ssl). Making getting my email fix a
little annoying.

So I was thinking: if the :mailbox value could be a list, then I could
have only one imap entry in mail-sources, and only one connection, and
Gnus could just fetch from each mailbox in the list.

Does that sound feasible? Reasonable? Any ideas at how to implement,
where to look?

(All this talk to avoid starting to look at the code myself, hmm...)


  Best regards,

    Adam

-- 
 "Ge mig en vinterdrog                                        Adam Sjøgren
  Ge mig allt du har"                                    asjo@koldfront.dk




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

* Re: Using IMAP as POP, :mailbox taking a list?
  2015-09-04  8:12 Using IMAP as POP, :mailbox taking a list? Adam Sjøgren
@ 2015-09-04  8:47 ` Eric S Fraga
  2015-09-04  8:56   ` Adam Sjøgren
  2015-09-04  9:25 ` Adam Sjøgren
  2015-09-04  9:52 ` Andreas Schwab
  2 siblings, 1 reply; 8+ messages in thread
From: Eric S Fraga @ 2015-09-04  8:47 UTC (permalink / raw)
  To: ding

On Friday,  4 Sep 2015 at 10:12, Adam Sjøgren wrote:

[...]

> Except for one minor thing: it takes a while to establish the connection
> to the mailserver 10 times (using ssl). Making getting my email fix a
> little annoying.

I am curious.  I also have to put up with using an outlook server
(outlook.office365.com).  In my case, I do use it as IMAP in its true
sense; I am not sure what you mean by using it as POP.

I also have the outlook server distribute some emails to different
folders, especially mailing lists.  I used to use gnus's splitting
functionality, which I loved especially because the regexp patterns are
much more powerful and easy to use than Outlook's interface.  I stopped
using splitting in gnus when I started using a phone to access my email
as well (as you) and only wanted some emails remaining in my INBOX for
the phone to access.

Does my use case also suffer from the same need to open the connection
more than once?  I ask because fetching email from outlook is always
very slow.  Would the same suggestion you are making improve full IMAP
use?

Thanks,
eric

-- 
: Eric S Fraga, GnuPG: 0xFFFCF67D
: in Emacs 25.0.50.2 + Ma Gnus v0.14 + evil-git-ff74cfb
: BBDB version 3.1.2 (2014-04-28 23:20:47+00:00)



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

* Re: Using IMAP as POP, :mailbox taking a list?
  2015-09-04  8:47 ` Eric S Fraga
@ 2015-09-04  8:56   ` Adam Sjøgren
  2015-09-04 10:08     ` Eric S Fraga
  0 siblings, 1 reply; 8+ messages in thread
From: Adam Sjøgren @ 2015-09-04  8:56 UTC (permalink / raw)
  To: ding

Eric writes:

> I am curious.  I also have to put up with using an outlook server
> (outlook.office365.com).  In my case, I do use it as IMAP in its true
> sense; I am not sure what you mean by using it as POP.

I mean instead of manipulating the email on the server, Gnus fetches the
emails and stores them locally in an nnml: spool. Just as you would do
with POP.

See the imap section here: http://gnus.org/manual/gnus_84.html#Mail-Sources

[...]

> Does my use case also suffer from the same need to open the connection
> more than once?

No, because it sounds like you use IMAP as IMAP.

You probably have an nnimap entry in your select methods (either the
primary or one of the secondary). I don't. I have imap entries in my
mail-sources.

> I ask because fetching email from outlook is always very slow. Would
> the same suggestion you are making improve full IMAP use?

Not that I can see, no.


  Best regards,

    Adam

-- 
 "Ge mig en vinterdrog                                        Adam Sjøgren
  Ge mig allt du har"                                    asjo@koldfront.dk




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

* Re: Using IMAP as POP, :mailbox taking a list?
  2015-09-04  8:12 Using IMAP as POP, :mailbox taking a list? Adam Sjøgren
  2015-09-04  8:47 ` Eric S Fraga
@ 2015-09-04  9:25 ` Adam Sjøgren
  2015-09-04  9:52 ` Andreas Schwab
  2 siblings, 0 replies; 8+ messages in thread
From: Adam Sjøgren @ 2015-09-04  9:25 UTC (permalink / raw)
  To: ding

Adam writes:

> So I was thinking: if the :mailbox value could be a list, then I could
> have only one imap entry in mail-sources, and only one connection, and
> Gnus could just fetch from each mailbox in the list.

It looks like in lisp/mail-source.el mail-source-fetch-imap is the
function I want to change to handle mailbox being a list.

But, uhm, my elisp-fu is too weak to understand where the variable
mailbox in that function comes from.

Hrmpf.

Ah, it looks like it is mail-source-bind that does the magic...


  Best regards,

    Adam

-- 
 "I came from a household that showed as much                 Adam Sjøgren
  knowledge or interest in sport as hedgehogs show in    asjo@koldfront.dk
  embroidery."




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

* Re: Using IMAP as POP, :mailbox taking a list?
  2015-09-04  8:12 Using IMAP as POP, :mailbox taking a list? Adam Sjøgren
  2015-09-04  8:47 ` 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
  2 siblings, 1 reply; 8+ messages in thread
From: Andreas Schwab @ 2015-09-04  9:52 UTC (permalink / raw)
  To: Adam Sjøgren; +Cc: ding

asjo@koldfront.dk (Adam Sjøgren) writes:

> So I was thinking: if the :mailbox value could be a list, then I could
> have only one imap entry in mail-sources, and only one connection, and
> Gnus could just fetch from each mailbox in the list.
>
> Does that sound feasible? Reasonable? Any ideas at how to implement,
> where to look?

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

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."



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

* Re: Using IMAP as POP, :mailbox taking a list?
  2015-09-04  8:56   ` Adam Sjøgren
@ 2015-09-04 10:08     ` Eric S Fraga
  0 siblings, 0 replies; 8+ messages in thread
From: Eric S Fraga @ 2015-09-04 10:08 UTC (permalink / raw)
  To: ding

On Friday,  4 Sep 2015 at 10:56, Adam Sjøgren wrote:

[...]

>> I ask because fetching email from outlook is always very slow. Would
>> the same suggestion you are making improve full IMAP use?
>
> Not that I can see, no.

thanks for the explanation.  basically, I need to get away from
Outlook... ;-)

-- 
: Eric S Fraga, GnuPG: 0xFFFCF67D
: in Emacs 25.0.50.2 + Ma Gnus v0.14 + evil-git-ff74cfb
: BBDB version 3.1.2 (2014-04-28 23:20:47+00:00)



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

* Re: Using IMAP as POP, :mailbox taking a list?
  2015-09-04  9:52 ` Andreas Schwab
@ 2015-09-04 10:30   ` Adam Sjøgren
  2015-09-05  8:27     ` Adam Sjøgren
  0 siblings, 1 reply; 8+ messages in thread
From: Adam Sjøgren @ 2015-09-04 10:30 UTC (permalink / raw)
  To: ding

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"




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

* Re: Using IMAP as POP, :mailbox taking a list?
  2015-09-04 10:30   ` Adam Sjøgren
@ 2015-09-05  8:27     ` Adam Sjøgren
  0 siblings, 0 replies; 8+ messages in thread
From: Adam Sjøgren @ 2015-09-05  8:27 UTC (permalink / raw)
  To: ding

Adam writes:

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

Fixed a problem with my first attempt, and tested both with list and
single (default) value; committed and pushed now:

 * http://git.gnus.org/cgit/gnus.git/commit/?id=dac2389c304a108c6cb78c18e422f157aecbdb74


  Best regards,

    Adam

-- 
 "I need someone to throw blue sky at me"                     Adam Sjøgren
                                                         asjo@koldfront.dk




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

end of thread, other threads:[~2015-09-05  8:27 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-04  8:12 Using IMAP as POP, :mailbox taking a list? 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
2015-09-05  8:27     ` Adam Sjøgren

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