text stringlengths 0 357 |
|---|
char *p1 = NULL, *p2 = NULL; |
if (dc_param_get_int(factory->msg->param, DC_PARAM_GUARANTEE_E2EE, 0)) { |
p1 = dc_stock_str(factory->context, DC_STR_ENCRYPTEDMSG); /* we SHOULD NOT spread encrypted subjects, date etc. in potentially unencrypted MDNs */ |
} |
else { |
p1 = dc_msg_get_summarytext(factory->msg, DC_APPROX_SUBJECT_CHARS); |
} |
p2 = dc_stock_str_repl_string(factory->context, DC_STR_READRCPT_MAILBODY, p1); |
message_text = dc_mprintf("%s" LINEEND, p2); |
free(p2); |
free(p1); |
struct mailmime* human_mime_part = build_body_text(message_text); |
mailmime_add_part(multipart, human_mime_part); |
/* second body part: machine-readable, always REQUIRED by RFC 6522 */ |
message_text2 = dc_mprintf( |
"Reporting-UA: Delta Chat %s" LINEEND |
"Original-Recipient: rfc822;%s" LINEEND |
"Final-Recipient: rfc822;%s" LINEEND |
"Original-Message-ID: <%s>" LINEEND |
"Disposition: manual-action/MDN-sent-automatically; displayed" LINEEND, /* manual-action: the user has configured the MUA to send MDNs (automatic-action implies the receipts cannot be disabled) */ |
DC_VERSION_STR, |
factory->from_addr, |
factory->from_addr, |
factory->msg->rfc724_mid); |
struct mailmime_content* content_type = mailmime_content_new_with_str("message/disposition-notification"); |
struct mailmime_fields* mime_fields = mailmime_fields_new_encoding(MAILMIME_MECHANISM_8BIT); |
struct mailmime* mach_mime_part = mailmime_new_empty(content_type, mime_fields); |
mailmime_set_body_text(mach_mime_part, message_text2, strlen(message_text2)); |
mailmime_add_part(multipart, mach_mime_part); |
/* currently, we do not send MDNs encrypted: |
- in a multi-device-setup that is not set up properly, MDNs would disturb the communication as they |
are send automatically which may lead to spreading outdated Autocrypt headers. |
- they do not carry any information but the Message-ID |
- this save some KB |
- in older versions, we did not encrypt messages to ourself when they to to SMTP - however, if these messages |
are forwarded for any reasons (eg. gmail always forwards to IMAP), we have no chance to decrypt them; |
this issue is fixed with 0.9.4 */ |
force_plaintext = DC_FP_NO_AUTOCRYPT_HEADER; |
} |
else |
{ |
set_error(factory, "No message loaded."); |
goto cleanup; |
} |
/* Encrypt the message |
*************************************************************************/ |
if (factory->loaded==DC_MF_MDN_LOADED) { |
char* e = dc_stock_str(factory->context, DC_STR_READRCPT); subject_str = dc_mprintf(DC_CHAT_PREFIX " %s", e); free(e); |
} |
else { |
subject_str = get_subject(factory->chat, factory->msg, afwd_email); |
} |
struct mailimf_subject* subject = mailimf_subject_new(dc_encode_header_words(subject_str)); |
mailimf_fields_add(imf_fields, mailimf_field_new(MAILIMF_FIELD_SUBJECT, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, subject, NULL, NULL, NULL)); |
if (force_plaintext!=DC_FP_NO_AUTOCRYPT_HEADER) { |
dc_e2ee_encrypt(factory->context, factory->recipients_addr, |
force_plaintext, e2ee_guaranteed, min_verified, |
do_gossip, message, &e2ee_helper); |
} |
if (e2ee_helper.encryption_successfull) { |
factory->out_encrypted = 1; |
if (do_gossip) { |
factory->out_gossiped = 1; |
} |
} |
/* create the full mail and return */ |
factory->out = mmap_string_new(""); |
mailmime_write_mem(factory->out, &col, message); |
//{char* t4=dc_null_terminate(ret->str,ret->len); printf("MESSAGE:\n%s\n",t4);free(t4);} |
success = 1; |
cleanup: |
if (message) { |
mailmime_free(message); |
} |
dc_e2ee_thanks(&e2ee_helper); // frees data referenced by "mailmime" but not freed by mailmime_free() |
free(message_text); // mailmime_set_body_text() does not take ownership of "text" |
free(message_text2); // - " -- |
free(subject_str); |
free(grpimage); |
return success; |
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.