Re: write fetched mime section

Marko Ivancic <[email protected]> Fri, 14 Apr 2006 10:37:37 +0200
Newsgroups gmane.mail.libetpan.user
Message-ID <[email protected]>
Ok I almost solved my problem :)

I found that

data->dt_data is a pointer where the missing mime data part must be. So 
I cannot directly use this pointer like

data = mailmime_data_new(nType, nTextEncoding,
                                    nTextEncoded, result_text, result_len,
                                    result_text);

becouse it overides all the other pointers int the MIME strucure.

My question now is how do I insert on this position my fetched data ?? I 
looked all the examplse in libetpan and etpanX but I can not find the 
answer to this.

Tnx
By,
Marko

Marko Ivancic wrote:
> I figured out that with the function
>
> mailprivacy_msg_get_bodystructure(NULL,etpMailMessage,&resultMime);
>
> I get only empty mime (without mime_data ) but in
>
> mime_data->dt_data.dt_text.dt_length is 0
> but
> mime_data->dt_data.dt_text.dt_data has a boundary value ??
>
> Now I fetch a mime part, and this works well with
>
> mailmessage_fetch_section(etpMailMessage,m_pMime,&resultText,&result_len); 
> //pMine is a pointer to submime in resultMime structure.
>
> Now I try to insert this in resultMime in mailmime_data part, which is 
> empty. I do this:
>
> struct mailmime_data* data = m_pMime->mm_body;
>
> nType = data->dt_type;
> mailmime_data_free(data);
>           data = mailmime_data_new(nType, nTextEncoding,
>                                     nTextEncoded, result_text, 
> result_len,
>                                     result_text); // i do not free 
> result_text here
>
> ///
> When I write this resultMime to a file (mailmime_write(f, &col, 
> resultMime);)
> I see that the end part of the original mime is slowly disappearing, 
> what am I doing wrong ??
>
>
> Tnx for help,
> By,
> Marko
>
>
> Marko Ivancic wrote:
>> Hi
>>
>> How to "insert" back the retrived section of a MIME.
>>
>> I first retrive the mime message part
>> char* resultText;
>> size_t result_len = 0;
>>
>> r = 
>> mailmessage_fetch_section(entireMail,entireMime,&resultText,&result_len); 
>> //and I get the right part
>>
>> Then I try to write this part back into entireMime structure
>> /// I tried with this
>>
>> mailmime* submime; // is apointer to submime of entireMime structure
>>
>> data = submime->mm_body; //mailmime_data
>> mailmime_data_free(data); //free previous empty data
>>
>> data = mailmime_data_new(nType, nTextEncoding,
>>                                     nTextEncoded, resultText, 
>> result_len,
>>                                     resutl_text); // create new 
>> retrived data
>>
>> But it doesn't work.
>>
>> r = mailmime_write(file, &col,eni);
>>
>> What am I doing wrong or better what is the right way to do it right ??
>>
>> Tnx
>> By,
>> Marko
>>
>>
>> -------------------------------------------------------
>> This SF.Net email is sponsored by xPML, a groundbreaking scripting 
>> language
>> that extends applications into web and mobile media. Attend the live 
>> webcast
>> and join the prime developer group breaking into this new coding 
>> territory!
>> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
>> _______________________________________________
>> Libetpan-users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/libetpan-users
>>
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by xPML, a groundbreaking scripting 
> language
> that extends applications into web and mobile media. Attend the live 
> webcast
> and join the prime developer group breaking into this new coding 
> territory!
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
> _______________________________________________
> Libetpan-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/libetpan-users
>



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642