Subject: questions about how to do multiple IMAP sessions to the server in c-client

From: [email-masked]
Date: Thu, 28 Oct 2004 10:25:39 EDT

In RFC 3501,  it defines "Connection" and "Session" as
 
---
 
"Connection" refers to the entire sequence of client/server interaction  from 
the initial establishment of the network connection until its termination. 
 
--
 
Could I compare it with login complete?
 
-- 
"Session" refers to the sequence of client/server interaction from the time  
that a mailbox is selected (SELECT or EXAMINE command) until the time that  
selection ends (SELECT or EXAMINE of another mailbox, CLOSE command, or  
connection termination).  
-- 
It also says: 
--- 
Only one mailbox can be selected at a time in a connection; simultaneous  
access to multiple mailboxes requires multiple connections.  
--- 
If the IMAP client which uses c-client wants to show the list of  mails from 
all of the mailboxes after login complete,  then user could  select the mail 
interested, does it mean that there must be multiple  "connections" (multiple 
login's) in order to maintain multiple  mailboxes to be SELECT'ed, so that the 
data in c-client's cache could be used  later.  
Or it is the client's responsibility to cache the data besides the c-client's 
 cache, and after user selects a mail entry then re-do SELECT for the 
interested  mailbox, so that there is at most only one mailbox is open at all time? 
What is the suggested way to have access to multiple mailboxes using  
c-client. 
Thanks!

---

From: Mark Crispin <[email-masked]>
Date: Thu, 28 Oct 2004 09:44:33 -0700 (PDT)

> Could I compare it with login complete?

That's like saying "can I compare a drive in my car to starting the 
motor".

The definitions of "connection" and "session" in RFC 3501 are fairly 
specific.  I believe that any additional definitions would only make 
matters more complicated instead of less complicated

> data in c-client's cache could be used  later.

Only one mailbox is SELECTed at a time, and c-client only caches data from 
the currently SELECTed mailbox.

You can have multiple MAILSTREAMs open, each with a separate mailbox 
selected.  It is your choice whether you want to do that or to go through 
each mailbox one-by-one.

HOWEVER!!!!!

It is an exceedingly poor idea for a client to attempt to list messages 
from all mailboxes.  The list of mailboxes may be extremely long with long 
servers.  You will run out of memory and disk space on your client long 
before you complete gathering the entire list.

It is also a misuse of IMAP.  The entire reason why IMAP has all these 
features to collect individual data items is so the client can access data 
on demand by the end user, and not have to download everything at 
startup.

The best way to implement an IMAP client is to pretend that you have a 
basic DOS machine with 640K RAM, a 20MB hard drive, and a 2400bps modem; 
and to assume that the user has 10,000 mailboxes each with 100,000 
messages and each message is 500K.  You wouldn't even think of trying a 
mass download in such an environment.  Instead, you would get only that 
data that is needed at that point in time.

-- Mark --

http://staff.washington.edu/mrc
Science does not emerge from voting, party politics, or public debate.
Si vis pacem, para bellum.