text stringlengths 0 357 |
|---|
if (mimetype==NULL) { |
goto cleanup; |
} |
/* create mime part, for Content-Disposition, see RFC 2183. |
`Content-Disposition: attachment` seems not to make a difference to `Content-Disposition: inline` at least on tested Thunderbird and Gma'l in 2017. |
But I've heard about problems with inline and outl'k, so we just use the attachment-type until we run into other problems ... */ |
int needs_ext = dc_needs_ext_header(filename_to_send); |
mime_fields = mailmime_fields_new_filename(MAILMIME_DISPOSITION_TYPE_ATTACHMENT, |
needs_ext? NULL : dc_strdup(filename_to_send), MAILMIME_MECHANISM_BASE64); |
if (needs_ext) { |
for (clistiter* cur1 = clist_begin(mime_fields->fld_list); cur1!=NULL; cur1 = clist_next(cur1)) { |
struct mailmime_field* field = (struct mailmime_field*)clist_content(cur1); |
if (field && field->fld_type==MAILMIME_FIELD_DISPOSITION && field->fld_data.fld_disposition) |
{ |
struct mailmime_disposition* file_disposition = field->fld_data.fld_disposition; |
if (file_disposition) |
{ |
struct mailmime_disposition_parm* parm = mailmime_disposition_parm_new( |
MAILMIME_DISPOSITION_PARM_PARAMETER, NULL, NULL, NULL, NULL, 0, |
mailmime_parameter_new(strdup("filename*"), dc_encode_ext_header(filename_to_send))); |
if (parm) { |
clist_append(file_disposition->dsp_parms, parm); |
} |
} |
break; |
} |
} |
} |
content = mailmime_content_new_with_str(mimetype); |
clist_append(content->ct_parameters, mailmime_param_new_with_data("name", |
(filename_encoded=dc_encode_header_words(filename_to_send)))); |
mime_sub = mailmime_new_empty(content, mime_fields); |
mailmime_set_body_file(mime_sub, dc_get_abs_path(msg->context, pathNfilename)); |
if (ret_file_name_as_sent) { |
*ret_file_name_as_sent = dc_strdup(filename_to_send); |
} |
cleanup: |
free(pathNfilename); |
free(mimetype); |
free(filename_to_send); |
free(filename_encoded); |
free(suffix); |
return mime_sub; |
} |
static char* get_subject(const dc_chat_t* chat, const dc_msg_t* msg, int afwd_email) |
{ |
dc_context_t* context = chat? chat->context : NULL; |
char* ret = NULL; |
char* raw_subject = dc_msg_get_summarytext_by_raw(msg->type, msg->text, msg->param, DC_APPROX_SUBJECT_CHARS, context); |
const char* fwd = afwd_email? "Fwd: " : ""; |
if (dc_param_get_int(msg->param, DC_PARAM_CMD, 0)==DC_CMD_AUTOCRYPT_SETUP_MESSAGE) |
{ |
ret = dc_stock_str(context, DC_STR_AC_SETUP_MSG_SUBJECT); /* do not add the "Chat:" prefix for setup messages */ |
} |
else if (DC_CHAT_TYPE_IS_MULTI(chat->type)) |
{ |
ret = dc_mprintf(DC_CHAT_PREFIX " %s: %s%s", chat->name, fwd, raw_subject); |
} |
else |
{ |
ret = dc_mprintf(DC_CHAT_PREFIX " %s%s", fwd, raw_subject); |
} |
free(raw_subject); |
return ret; |
} |
int dc_mimefactory_render(dc_mimefactory_t* factory) |
{ |
struct mailimf_fields* imf_fields = NULL; |
struct mailmime* message = NULL; |
char* message_text = NULL; |
char* message_text2 = NULL; |
char* subject_str = NULL; |
int afwd_email = 0; |
int col = 0; |
int success = 0; |
int parts = 0; |
int e2ee_guaranteed = 0; |
int min_verified = DC_NOT_VERIFIED; |
int force_plaintext = 0; // 1=add Autocrypt-header (needed eg. for handshaking), 2=no Autocrypte-header (used for MDN) |
int do_gossip = 0; |
char* grpimage = NULL; |
dc_e2ee_helper_t e2ee_helper; |
memset(&e2ee_helper, 0, sizeof(dc_e2ee_helper_t)); |
if (factory==NULL || factory->loaded==DC_MF_NOTHING_LOADED || factory->out/*call empty() before*/) { |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.