Subject: DRIVER->msgdata implementation problem

From: "Jacques Exelrud" <[email-masked]>
Date: Wed, 20 Nov 2002 17:26:39 -0200

I'm trying to implement msgdata (DRIVER) but without much success. The implementation for the header retrieval is OK but for both the body and the attachments it is not working.

	The code below is taken from mail.c (fetch_body)

  if (!(b = mail_body (stream,msgno,section))) return "";
				/* have cached text? */
  if ((t = &(p = &b->contents)->text)->data) {
				/* mark message seen */
    markseen (stream,mail_elt (stream,msgno),flags);
    return mail_fetch_text_return (&md,t,len);
  }  if (!stream->dtb) return "";	/* not in cache, must have live driver */
  if (stream->dtb->msgdata) return
    ((*stream->dtb->msgdata)(stream,msgno,section,0,0,NIL,flags) && t->data) ?		// Regarding this line *******
      mail_fetch_text_return (&md,t,len) : "";
  if (len) *len = t->size;

	t->size is already filled (from the envelope) but the line marked should be able to give a meaningful value to t->data as it is NULL before the call and must not be after it.

	The problem is that I'm unable to get to t because mail_body returns different data (new structure) when called. That is probably the problem but this is the only way I got it working when implementing the structure entry on DRIVER table; If I try to save the data and not rebuild it when needed I get an assert inside free_body.

	Thanks in advance,
	Jacques

-- 
------------------------------------------------------------------
 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: Wed, 20 Nov 2002 18:20:37 -0500 (Eastern Standard Time)

Since the IMAP driver is the only one which implements the msgdata method,
it would be a good idea to see how the IMAP driver works.  That should
answer most of your questions.  You're probably the first person to try to
implement a msgdata method in a non-IMAP driver, so you'll have to do a
fair amount of study to understand how it works.

-- Mark --

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