text stringlengths 0 357 |
|---|
if (dc_mimeparser_has_nonmeta(mime_parser)) |
{ |
/********************************************************************** |
* Add parts |
*********************************************************************/ |
/* collect the rest information, CC: is added to the to-list, BCC: is ignored |
(we should not add BCC to groups as this would split groups. We could add them as "known contacts", |
however, the benefit is very small and this may leak data that is expected to be hidden) */ |
if ((field=dc_mimeparser_lookup_field(mime_parser, "Cc"))!=NULL && field->fld_type==MAILIMF_FIELD_CC) |
{ |
struct mailimf_cc* fld_cc = field->fld_data.fld_cc; |
if (fld_cc) { |
dc_add_or_lookup_contacts_by_address_list(context, fld_cc->cc_addr_list, |
outgoing? DC_ORIGIN_OUTGOING_CC : (incoming_origin>=DC_ORIGIN_MIN_VERIFIED? DC_ORIGIN_INCOMING_CC : DC_ORIGIN_INCOMING_UNKNOWN_CC), to_ids, NULL); |
} |
} |
/* get Message-ID; if the header is lacking one, generate one based on fields that do never change. |
(missing Message-IDs may come if the mail was set from this account with another client that relies in the SMTP server to generate one. |
true eg. for the Webmailer used in all-inkl-KAS) */ |
if ((field=dc_mimeparser_lookup_field(mime_parser, "Message-ID"))!=NULL && field->fld_type==MAILIMF_FIELD_MESSAGE_ID) { |
struct mailimf_message_id* fld_message_id = field->fld_data.fld_message_id; |
if (fld_message_id) { |
rfc724_mid = dc_strdup(fld_message_id->mid_value); |
} |
} |
if (rfc724_mid==NULL) { |
rfc724_mid = dc_create_incoming_rfc724_mid(sent_timestamp, from_id, to_ids); |
if (rfc724_mid==NULL) { |
dc_log_info(context, 0, "Cannot create Message-ID."); |
goto cleanup; |
} |
} |
/* check, if the mail is already in our database - if so, just update the folder/uid (if the mail was moved around) and finish. |
(we may get a mail twice eg. if it is moved between folders. make sure, this check is done eg. before securejoin-processing) */ |
{ |
char* old_server_folder = NULL; |
uint32_t old_server_uid = 0; |
if (dc_rfc724_mid_exists(context, rfc724_mid, &old_server_folder, &old_server_uid)) { |
if (strcmp(old_server_folder, server_folder)!=0 || old_server_uid!=server_uid) { |
dc_sqlite3_rollback(context->sql); |
transaction_pending = 0; |
dc_update_server_uid(context, rfc724_mid, server_folder, server_uid); |
} |
free(old_server_folder); |
dc_log_info(context, 0, "Message already in DB."); |
goto cleanup; |
} |
} |
msgrmsg = mime_parser->is_send_by_messenger; /* 1 or 0 for yes/no */ |
if (msgrmsg==0 && dc_is_reply_to_messenger_message(context, mime_parser)) { |
msgrmsg = 2; /* 2=no, but is reply to messenger message */ |
} |
/* incoming non-chat messages may be discarded; |
maybe this can be optimized later, |
by checking the state before the message body is downloaded */ |
int allow_creation = 1; |
if (mime_parser->is_system_message==DC_CMD_AUTOCRYPT_SETUP_MESSAGE) { |
; |
} |
else if (msgrmsg==0) { |
/* this message is a classic email - |
not a chat-message nor a reply to one */ |
int show_emails = dc_sqlite3_get_config_int(context->sql, |
"show_emails", DC_SHOW_EMAILS_DEFAULT); |
if (show_emails==DC_SHOW_EMAILS_OFF) { |
chat_id = DC_CHAT_ID_TRASH; |
allow_creation = 0; |
} |
else if (show_emails==DC_SHOW_EMAILS_ACCEPTED_CONTACTS) { |
allow_creation = 0; |
} |
} |
/* check if the message introduces a new chat: |
- outgoing messages introduce a chat with the first to: address if they are sent by a messenger |
- incoming messages introduce a chat only for known contacts if they are sent by a messenger |
(of course, the user can add other chats manually later) */ |
if (incoming) |
{ |
state = (flags&DC_IMAP_SEEN)? DC_STATE_IN_SEEN : DC_STATE_IN_FRESH; |
to_id = DC_CONTACT_ID_SELF; |
// handshake messages must be processed _before_ chats are created |
// (eg. contacs may be marked as verified) |
if (dc_mimeparser_lookup_field(mime_parser, "Secure-Join")) { |
msgrmsg = 1; // avoid discarding by show_emails setting |
chat_id = 0; |
allow_creation = 1; |
dc_sqlite3_commit(context->sql); |
int handshake = dc_handle_securejoin_handshake(context, mime_parser, from_id); |
if (handshake & DC_HANDSHAKE_STOP_NORMAL_PROCESSING) { |
hidden = 1; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.