Subject: Reusing IMAP connections when changing folders

From: Malcolm Beattie <[email-masked]>
Date: Thu, 4 Jun 1998 12:53:52 +0100 (BST)

I'm using the c-client library from imap-4.1.BETA (the README is dated
31 July 1997). When I use mail_open to change folder, it doesn't reuse
the same IMAP connection, although a similar test with an NNTP folder
does reuse the connection. Internals.doc claims:

	 If oldstream is non-NIL, an attempt is made to reuse oldstream as
    the stream for this mailbox; this is useful when you want to open
    another mailbox to the same IMAP or NNTP server without having to open
    a new connection.  Doing this will close the previously open mailbox.

Am I missing something--do I need to do something to the IMAP stream
to ensure the underlying connection is reused? Or is this a bug (in
which case where do I look to fix it)?

--Malcolm

-- 
Malcolm Beattie <[email-masked]>
Unix Systems Programmer
Oxford University Computing Services

------------------------------------------------------------------
 For information about this mailing list, and its archives, see: 
 http://www.washington.edu/imap/c-client-list.html
------------------------------------------------------------------

---

From: Mark Crispin <[email-masked]>
Date: Thu, 4 Jun 1998 10:31:03 -0700 (PDT)

On Thu, 4 Jun 1998 12:53:52 +0100 (BST), Malcolm Beattie wrote:
> 31 July 1997).

This version is almost a year old, and you should update it.
	ftp://ftp.cac.washington.edu/mail/imap.tar.Z

> When I use mail_open to change folder, it doesn't reuse
> does reuse the connection.

What probably did you in is that you did not use the fully-qualified domain
name of the IMAP server.  The host name that you give to the mail_open() call
has to be the same as the fully-qualified domain name of the server that you
have open on the stream now.

---

From: Malcolm Beattie <[email-masked]>
Date: Thu, 11 Jun 1998 13:21:49 +0100 (BST)

> 	ftp://ftp.cac.washington.edu/mail/imap.tar.Z

Now done (the June 8 version, apparently). The lack of version number
changing in the 4.1-BETA name fooled me, I'm afraid.

> have open on the stream now.

That was exactly it, thanks. I've now come across an oddity/problem
with mail_list for NNTP connections. If I call
    mail_list("{news.ox.ac.uk/nntp}ox.test", "{news.ox.ac.uk/nntp}", "%");
then the mm_list callback gets called with many, many repeats of the
top level domains:

    info: Trying IP address [163.1.2.7]
    list: . {news.ox.ac.uk/nntp}alt noselect
    list: . {news.ox.ac.uk/nntp}alt noselect
    list: . {news.ox.ac.uk/nntp}alt noselect
    list: . {news.ox.ac.uk/nntp}alt noselect
    ...
    list: . {news.ox.ac.uk/nntp}aus noselect
    list: . {news.ox.ac.uk/nntp}aus noselect
    list: . {news.ox.ac.uk/nntp}aus noselect
    ...
    list: . {news.ox.ac.uk/nntp}bionet noselect
    list: . {news.ox.ac.uk/nntp}bionet noselect
    list: . {news.ox.ac.uk/nntp}bionet noselect

For example, there are 1096 "alt" lines. It looks as though it's
getting called approximately once for each real alt.* group but with
the name truncated to fit the wildcard. The intention was that the
wildcard "%" would match up to the NNTP hierarchy delimiter (".", as
the list above shows) and I could hence display the newsgroup
hierarchy in the same way as an IMAP mail hierarchy. Am I doing
something wrong?

The above "called mail_list" is actually a slight lie: I'm using my
Mail::Cclient perl module but I don't believe that has any bearing on
the above problem and the above C should be what it's calling. Should
I announce Mail::Cclient releases on this mailing list (basically: it
exists, get it from CPAN) or just assume that anyone interested in
using c-client from perl will already have seen the announcements on
comp.lang.perl.{announce,modules}?

--Malcolm

---

From: Mark Crispin <[email-masked]>
Date: Thu, 11 Jun 1998 10:50:23 -0700 (PDT)

On Thu, 11 Jun 1998 13:21:49 +0100 (BST), Malcolm Beattie wrote:
> If I call

I assume that is not the actual C call, but rather your abstraction from Perl.

> then the mm_list callback gets called with many, many repeats of the

That's right.  It's a misfeature caused by the fact that on most UNIX systems
news names are really not hierarchical, they are flat.  News names are read
from a text file (the ACTIVE file) that presents them as flat.  You have to
ignore the duplicates.

> Should
> I announce Mail::Cclient releases on this mailing list

If you like.