text stringlengths 0 357 |
|---|
dc_param_set_int(part->param, DC_PARAM_WANTS_MDN, 1); |
} |
} |
free(from_addr); |
} |
} |
free(dn_to_addr); |
} |
mailimf_mailbox_list_free(mb_list); |
} |
} |
} |
/* Cleanup - and try to create at least an empty part if there are no parts yet */ |
cleanup: |
if (!dc_mimeparser_has_nonmeta(mimeparser) && carray_count(mimeparser->reports)==0) { |
dc_mimepart_t* part = dc_mimepart_new(); |
part->type = DC_MSG_TEXT; |
if (mimeparser->subject && !mimeparser->is_send_by_messenger) { |
part->msg = dc_strdup(mimeparser->subject); |
} |
else { |
part->msg = dc_strdup(""); |
} |
carray_add(mimeparser->parts, (void*)part, NULL); |
} |
} |
/** |
* Lookup the given field name. |
* |
* Typical names are `From`, `To`, `Subject` and so on. |
* |
* @private @memberof dc_mimeparser_t |
* @param mimparser The MIME-parser object. |
* @param field_name The name of the field to look for. |
* @return A pointer to a mailimf_field structure. Must not be freed! |
* Before accessing the mailimf_field::fld_data, please always have a look at mailimf_field::fld_type! |
* If field_name could not be found, NULL is returned. |
*/ |
struct mailimf_field* dc_mimeparser_lookup_field(dc_mimeparser_t* mimeparser, const char* field_name) |
{ |
return (struct mailimf_field*)dc_hash_find_str(&mimeparser->header, field_name); |
} |
/** |
* Lookup the given field name. |
* |
* In addition to dc_mimeparser_lookup_field, this function also checks the mailimf_field::fld_type |
* for being MAILIMF_FIELD_OPTIONAL_FIELD. |
* |
* @private @memberof dc_mimeparser_t |
* @param mimparser The MIME-parser object. |
* @param field_name The name of the field to look for. |
* @return A pointer to a mailimf_optional_field structure. Must not be freed! |
* If field_name could not be found or has another type, NULL is returned. |
*/ |
struct mailimf_optional_field* dc_mimeparser_lookup_optional_field(dc_mimeparser_t* mimeparser, const char* field_name) |
{ |
struct mailimf_field* field = dc_hash_find_str(&mimeparser->header, field_name); |
if (field && field->fld_type==MAILIMF_FIELD_OPTIONAL_FIELD) { |
return field->fld_data.fld_optional_field; |
} |
return NULL; |
} |
/** |
* Gets the _last_ part _not_ flagged with is_meta. |
* |
* If you just want to check if there is a non-meta part preset, you can also |
* use the macro dc_mimeparser_has_nonmeta(). |
* |
* @private @memberof dc_mimeparser_t |
* @param mimeparser The MIME-parser object. |
* @return The last part that is not flagged with is_meta. The returned value |
* must not be freed. If there is no such part, NULL is returned. |
*/ |
dc_mimepart_t* dc_mimeparser_get_last_nonmeta(dc_mimeparser_t* mimeparser) |
{ |
if (mimeparser && mimeparser->parts) { |
int i, icnt = carray_count(mimeparser->parts); |
for (i = icnt-1; i >= 0; i--) { |
dc_mimepart_t* part = (dc_mimepart_t*)carray_get(mimeparser->parts, i); |
if (part && !part->is_meta) { |
return part; |
} |
} |
} |
return NULL; |
} |
/** |
* Checks, if the header of the mail looks as if it is a message from a mailing list. |
* |
* @private @memberof dc_mimeparser_t |
* @param mimeparser The MIME-parser object. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.