how add pair to Content-Type in messageBuilder

38 views
Skip to first unread message

ron.wil...@gmail.com

unread,
Sep 1, 2014, 6:41:13 AM9/1/14
to vm...@googlegroups.com
Hi all!

i need to added pair with 'method' type into Content-Type header like this:

Content-Type: text/calendar; method=REQUEST;
charset="UTF-8"

How can i set in? Does it available during constructing textPart (constructTextPart)? I create part like this (some addditions was made in vmime for iCalendar format):

msgBuilder.constructTextPart(vmime::mediaType(vmime::mediaTypes::TEXT, vmime::mediaTypes::TEXT_CALENDAR));

vmime::textPart & textPart = *msgBuilder.getTextPart();
textPart.setText(vmime::create<vmime::stringContentHandler>(icalbody));

Of course in result message i got only:
Content-Type: text/calendar; charset=utf-8

Thank you.

ron.wil...@gmail.com

unread,
Sep 1, 2014, 7:17:25 AM9/1/14
to vm...@googlegroups.com
I found solution:

I construct my own custom textPart

msgBuilder.constructTextPart(vmime::mediaType(vmime::mediaTypes::TEXT, vmime::mediaTypes::TEXT_CALENDAR));

it's actualy construct:
class calendarTextPart : public plainTextPart
{ .. }

and in the generateIn() method i do this:

ref<header> headerObj = part->getHeader();
try
{
ref<contentTypeField> ctf = headerObj->ContentType().dynamicCast <contentTypeField>();

ref<parameter> oldMethod = ctf->findParameter(METHOD);

if(oldMethod)
ctf->removeParameter(oldMethod);

ref<parameter> methodParam = vmime::create <parameter>(METHOD, REQUEST);
ctf->appendParameter(methodParam);
}
catch (exceptions::no_such_field&)
{
}

Reply all
Reply to author
Forward
0 new messages