DINH Viet Hoa | 2 Apr 2005 09:12
Picon
Favicon

Re: sorting messages in imap

Luke Ehresman wrote :

> Is there a function to handle the IMAP "SORT" functionality?  I don't
> see one in mailimap.h.  How does one sort a list of messages in a
> folder with lebetpan?

neither IDLE, SORT, THREAD or SASL extension of IMAP are implemented in 
libetpan. I consider IDLE and SASL more interesting than the two others.

If you use the driver interface, you will find mail_build_thread()
and mail_thread_sort() to thread and sort messages. The work will be 
done locally on the computer. (mailthread.h)

That means that you have to use driver interface to use them or you 
could construct fake mailmessage object to build the initial needed 
mailmessage_list or mailmessage_tree.

--

-- 
DINH V. Hoa,

"sauvons les petits enfants asthmatiques" -- the penguin-biker
Luke Ehresman | 1 Apr 2005 23:09
Gravatar

sorting messages in imap

Is there a function to handle the IMAP "SORT" functionality?  I don't
see one in mailimap.h.  How does one sort a list of messages in a
folder with lebetpan?

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
Luke Ehresman | 6 Apr 2005 17:19
Gravatar

message list retrieval

Hello,

Thanks for all your help so far, I really appreciate it as I'm getting
up to speed with using this library.

I have another question.  What information is initially retrieved for
each message when I do a mailfolder_get_messages_list() call?  All I
want is the list of UID's in a folder, and I want to fetch the header
information manually.  Basically, I am implementing paging so I only
want to retrieve a set of 30 headers at a time rather than everything.

The c-client library had a function that would return an array of uid's
given a folder and a method for sorting them.  I think in a previous
thread we established that libetpan doesn't do sorting yet, but still
retriving only a list of uids (or as little information as possible)
would be useful.

Thanks,
Luke

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
DINH Viet Hoa | 6 Apr 2005 17:35
Picon
Favicon

Re: message list retrieval

Luke Ehresman wrote :

> Thanks for all your help so far, I really appreciate it as I'm getting
> up to speed with using this library.

no problem.

> I have another question.  What information is initially retrieved for
> each message when I do a mailfolder_get_messages_list() call?  All I
> want is the list of UID's in a folder, and I want to fetch the header
> information manually.  Basically, I am implementing paging so I only
> want to retrieve a set of 30 headers at a time rather than everything.

First, to answer your question, mailmessage_list will only return a list 
of message with mainly the uid of the messages. The headers won't be 
retrieved.

What you can do is to split the returned mailmessage_list into several 
(you have to build up the mailmessage_list yourself) and use 
mailmessage_get_envelope_list() things.

> The c-client library had a function that would return an array of uid's
> given a folder and a method for sorting them.  I think in a previous
> thread we established that libetpan doesn't do sorting yet, but still
> retriving only a list of uids (or as little information as possible)
> would be useful.

If you fetch the headers using mailmessage_get_envelope_list(), you 
could do the sorting (but you need to provide a custom function to 
choose the kind of sorting). Fetching headers in IMAP using the 
(Continue reading)

Luke Ehresman | 6 Apr 2005 18:40
Gravatar

Re: message list retrieval

> What you can do is to split the returned mailmessage_list into several 
> (you have to build up the mailmessage_list yourself) and use 
> mailmessage_get_envelope_list() things.

I have looked through the documentation and grepped through all the
sources in the libetpan directory, but can't find a reference to
anything similar to get_envelope_list.  Might it be under a different
name?

> If you fetch the headers using mailmessage_get_envelope_list(), you 
> could do the sorting (but you need to provide a custom function to 
> choose the kind of sorting). Fetching headers in IMAP using the 
> mailmessage_get_envelope() should be fast enough on most servers.
> That does not do a FETCH request for each message. That will fetch the 
> (IMAP) ENVELOPE in one request, which is optimized (or can be optimized) 
> on most IMAP servers.

Excellent.  That's what I was hoping for.

Thanks,
Luke

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
DINH Viet Hoa | 6 Apr 2005 19:13
Picon
Favicon

Re: message list retrieval

Luke Ehresman wrote :

> > What you can do is to split the returned mailmessage_list into several 
> > (you have to build up the mailmessage_list yourself) and use 
> > mailmessage_get_envelope_list() things.
> 
> I have looked through the documentation and grepped through all the
> sources in the libetpan directory, but can't find a reference to
> anything similar to get_envelope_list.  Might it be under a different
> name?

sorry, that was a different name :

int mailfolder_get_envelopes_list(struct mailfolder * folder,
    struct mailmessage_list * result);

and using the deprecated interface :

int mailsession_get_messages_list(mailsession * session,
                                  struct mailmessage_list ** result);

(that should not be used unless you already wrote some important 
amount of code)

--

-- 
DINH V. Hoa,

"oh là, doucement bijou" -- nico
Luke Ehresman | 6 Apr 2005 23:30
Gravatar

cache hits/misses

Hey,

Is there any way for me to track how many of my requests are actually
cached responses and which are going out to the mail server?  I'm
writing a pre-caching algorithm and want to get some stats on its cache
hit/miss ratio.

Thanks,
Luke

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
DINH Viet Hoa | 7 Apr 2005 00:45
Picon
Favicon

Re: cache hits/misses

Luke Ehresman wrote :

> Is there any way for me to track how many of my requests are actually
> cached responses and which are going out to the mail server?  I'm
> writing a pre-caching algorithm and want to get some stats on its cache
> hit/miss ratio.

you can set a variable :

mailstream_debug = 1;

that will dump all the network traffic in the current directory of the 
running process in a file named libetpan-stream-debug.log or something 
that looks like.

basically, headers request and fetch of parts requests are cached.
message-list is not cached, neither the MIME structure of the message. 
That could be a work to be done but there are so many things to do.

--

-- 
DINH V. Hoa,

"oh là, doucement bijou" -- nico
Luke Ehresman | 15 Apr 2005 16:08
Gravatar

fetching a message

Greetings again,

I am having trouble fetching message data.  I have the UID of the
message, but what function should I use to actually retrieve it?  It
seems that I should use the mailmessage_* functions, but they all
require a mailmessage structure to be passed in.  Should I just malloc a
mailmessage structure and set the uid?  The mailmessage_init() function
is rather confusing (I'm not sure where I would get the driver and some
of the other parameters for passing into it).

Thanks for your help again,
Luke

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
DINH Viet Hoa | 15 Apr 2005 16:39
Picon
Favicon

Re: fetching a message

Luke Ehresman wrote :

> I am having trouble fetching message data.  I have the UID of the
> message, but what function should I use to actually retrieve it?  It
> seems that I should use the mailmessage_* functions, but they all
> require a mailmessage structure to be passed in.  Should I just malloc a
> mailmessage structure and set the uid?  The mailmessage_init() function
> is rather confusing (I'm not sure where I would get the driver and some
> of the other parameters for passing into it).

Some time ago, I added mailsession_get_message_by_uid(), then 
mailfolder_get_message_by_uid() to satisfy that kind of need.

maildriver.h and mailfolder.h

you should rather use mailfolder_get_message_by_uid().

--

-- 
DINH V. Hoa,

"ben le problème c'est que les voitures à motorisations XXL
    ça passe rarement inaperçu" -- raoul

Gmane