Re: fetching a message

Melvin Hadasht <[email protected]>
Newsgroups gmane.mail.libetpan.user
Message-ID <etPan.425fd54d.327b23c6.2cc6@freefluid>
Hi,

Luke Ehresman a écrit :
> 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).


Try:
 mailmessage*
 message_fetch_by_uid (mailsession *session, uid)
 {
  mailmessage *msg;
  int r = mailsession_get_message_by_uid(mailsession*, uid, &msg);
  if (r == MAIL_NO_ERROR)
    {
	char *data;
        size_t len;
	r = mailmessage_fetch(msg, &data, &len);
        ...process data
        mailmessage_fetch_result_free(msg, data);
    }
  }

at least that's what I used in XetPan and that worked on libetpan 0.32...

Cheers.


-------------------------------------------------------
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_ide95&alloc_id396&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.