Subject: Re: [re: Mailbox driver functions]

From: Jan Nilsson <[email-masked]>
Date: 17 Aug 00 15:30:44 MET DST

>Mark Crispin <[email-masked]> wrote:
>To best understand what the structure and msgdata methods do, look at the
>IMAP
>driver which implements these methords.

Alright! didn't look there ..studying them now.

>All the "private" structure members are for c-client's internal
>convenience.
>Applications do not reference them (and are forbidden from referencing
>them).
>You do not need to use any of them.  If you do use them, then you need to
>use
>them in a way that matches mail.c's caching expectations.

Ok, so a new driver is also considered an "application" ?
I pictured myself that an application like the imapd
could be considered layered something like this (?):

----------------------------------
  Application  (imapd.c)
----------------------------------
  c-client  (mail.c etc.)
----------------------------------
  driver  (unix.c ...)
----------------------------------
  data storage  (unix filesys ...)
----------------------------------

My main problem is that I don't understand the interface between
c-client and the driver entirely.
I thought that the driver was allowed to deliver data directly into
the c-client private structures (some functions in the IMAP driver
does this) ?

Example:
- the imapd receives a "FETCH 2 BODY[1]" from the client.
- imapd will eventually call
  mail_fetch_body->(*stream->dtb->msgdata)
- My implementaion of msgdata will get the data
  (requested by the section param) from a database
  (in this case "1",the message text).

Here's where my problems start. I have the message
data (can make it in form of data in mem, a file or a socket)
and need to return it to the c-client layer, but I'm not sure how.

>You *MUST* fill all ENVELOPE and BODY structures with the complete set of
>information that comes from IMAP.  In other words, you must fill in sizes
>such
>as body->size.lines and body->size.bytes; these are not optional.

OK.

>The choice of whether to cache message texts in memory or not is up to >you.
>However, if you use the msgdata interface, you will have to load the
>appropriate SIZEDTEXT structure in c-client's cache with the string and >its
>size.  Take a look at imap_cache() to see what needs to be done to >register
a
>text in the cache.

I had a look at imap_cache which I can see delivering data
to c-client with the SIZEDTEXT *text parameter.
Does that struct (text) contain ALL data for a segment, or could
it be only a part of it ?

If it contains the entire segment, wouldn't that eat mem in case of
a large msg text ?

If it only contain a part of the segment data, how will c-client
know how to get the rest of it when that time comes ? 

>The application can tell you to cache something else, if it arms a
>mailgets_t
>callback routine.  Take a look at imap_parse_string() to see how this
>works.

Need to look at this function more closely. Don't understand it yet.

Still confused, but on a higher level! ;)

Many thanks for your help so far Mark!

/Jan

____________________________________________________________________
Get free email and a permanent address at http://www.netaddress.com/?N=1