Subject: Re:re: Including message/rfc822 content as text

From: Karsten Ballueder <[email-masked]>
Date: Thu, 18 Feb 1999 12:33:57 +0000 (GMT)

> On Thu, 18 Feb 1999 11:54:18 +0000 (GMT), Karsten Ballueder wrote:
 > >     if (body->subtype && !strcmp (body->subtype,"RFC822")) {
 > > after that line it would attempt to free body->nested.msg, which
 > > is not guaranteed to be non-NULL
 >   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 > 
 > This statement is wrong.  If you create an MESSAGE/RFC822 body, you are
 > responsible for making sure that it is non-NIL.
 > 
But why do I need to? If I include the text of a mail
message, just like I include the text of a text/plain
content, then that pointer is still null, just the type
would be different. If in addition I set it to the body of 
freshly created empty message as you suggested to me, then
the text contents are ignored and an empty message gets sent.

That's how I include it:
   case TYPEMESSAGE:
   case TYPETEXT:
      bdy->type = type;
      bdy->subtype = (char *) fs_get(subtype.length()+1);
      strcpy(bdy->subtype,(char *)subtype.c_str());
      bdy->contents.text.data = data;
      bdy->contents.text.size = len;
      bdy->encoding = ENC8BIT;
      break;

bdy->nested is still all 0 then. If I add
bdy->nested.msg = mail_newmsg(); 
then the contents.text gets ignored and the include text message
is empty. 

If I am really not allowed to leave nested.msg empty (why?), could
you please let me know how to do this correctly?

Thanks!
--
 Karsten Ballüder http://www.phy.hw.ac.uk/~karsten/ mailto:[email-masked]
 Physics Department, Heriot-Watt University, Edinburgh, EH14 4AS, Scotland
                     Tel. +44-(0)-131-4513068  Fax. +44-(0)-131-4513136
           "In a world without fences, who needs Gates?"

---

From: Mark Crispin <[email-masked]>
Date: Fri, 19 Feb 1999 20:25:54 -0800 (PST)

On Thu, 18 Feb 1999 12:33:57 +0000 (GMT), Karsten Ballueder wrote:
>  > If you create an MESSAGE/RFC822 body, you are
> But why do I need to?

Because those are the rules.  There are several other instances which require
that pointer to be defined.

> If I include the text of a mail
> would be different.

The nested.msg pointer does not exist with a text/plain type.  It's a union;
when it's type MULTIPART, then the same location is used for nested.part.

> If in addition I set it to the body of

I don't believe this claim.  rfc822_output_body() is what writes the body in
outgoing messages, and it does not use body->nested.msg.  You must have some
other problem.  Are you using unmodified c-client sources?