Re: [gmime-devel] gmime-devel-list Digest, Vol 76, Issue 4



Hi Yuval,

Answers below...


On 7/18/2017 5:12 PM, Yuval Peduel via gmime-devel-list wrote:
Thank you for the prompt response.

My apologies. I thought I had included that snippet of code. To print the encoding I use:

    GMimeContentEncoding encoding =
        g_mime_part_get_content_encoding(part);
    const char* encoding_as_string =
        g_mime_content_encoding_to_string(encoding);

If the encoding is GMIME_CONTENT_ENCODING_DEFAULT, then the return value will be NULL.

Since none of your MIME parts in your sample message had a Content-Transfer-Encoding header, no encoding was specified (which generally means you should treat it as "8bit").


    cout << indent << "- content encoding: ";
    if (encoding_as_string)
        cout << encoding_as_string;
    else
        cout << "NULL";
    cout << endl;              

As for the content_description, I was expecting "text/plain" and "text/html". If this is the wrong field to get this discrimination, which field would be correct?

No. The g_mime_part_get_content_description() functions returns the value provided for the Content-Description header (which none of your MIME parts contained).

If you want the value of the Content-Type header, you need to use g_mime_object_get_content_type() :)

However, that won't return a string, it will return a GMimeContentType due to the fact that you typically want to access parameter values.


Related to that (but lower priority), how do I get the "multipart/alternative;" field from the multipart? the content type from the top level part returned by g_mime_message_get_mime_part(message)?

Yes.


Hope that helps,

Jeff



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]