1
0
Fork 0
mirror of https://github.com/deltachat/deltachat-core.git synced 2025-10-06 03:50:08 +02:00
This commit is contained in:
B. Petersen 2017-12-06 23:28:31 +01:00
parent 74a6bc9c08
commit 15e43c8df6
4 changed files with 55 additions and 34 deletions

View file

@ -11,7 +11,7 @@
<Option object_output="obj/Debug/" />
<Option type="1" />
<Option compiler="gcc" />
<Option parameters="/home/bpetersen/messy/mailboxes/messenger-autocrypttb.db" />
<Option parameters="/home/bpetersen/messy/mailboxes/messenger-bpetersen.db" />
<Compiler>
<Add option="-g" />
</Compiler>

View file

@ -28,6 +28,11 @@
#include "mrmimeparser.h"
/*******************************************************************************
* Tools
******************************************************************************/
static struct mailmime* new_data_part(void* data, size_t data_bytes, char* default_content_type, int default_encoding)
{
//char basename_buf[PATH_MAX];
@ -138,8 +143,51 @@ static struct mailmime* new_data_part(void* data, size_t data_bytes, char* defau
}
/**
* Check if a MIME structure contains a multipart/report part.
*
* As reports are often unencrypted, we do not reset the Autocrypt header in
* this case.
*
* However, Delta Chat itself has no problem with encrypted multipart/report
* parts and MUAs should be encouraged to encrpyt multipart/reports as well so
* that we could use the normal Autocrypt processing.
*
* @private
*
* @param mime The mime struture to check
*
* @return 1=multipart/report found in MIME, 0=no multipart/report found
*/
static int contains_report(struct mailmime* mime)
{
if( mime->mm_type == MAILMIME_MULTIPLE )
{
if( mime->mm_content_type->ct_type->tp_type==MAILMIME_TYPE_COMPOSITE_TYPE
&& mime->mm_content_type->ct_type->tp_data.tp_composite_type->ct_type == MAILMIME_COMPOSITE_TYPE_MULTIPART
&& strcmp(mime->mm_content_type->ct_subtype, "report")==0 ) {
return 1;
}
clistiter* cur;
for( cur=clist_begin(mime->mm_data.mm_multipart.mm_mp_list); cur!=NULL; cur=clist_next(cur)) {
if( contains_report((struct mailmime*)clist_content(cur)) ) {
return 1;
}
}
}
else if( mime->mm_type == MAILMIME_MESSAGE )
{
if( contains_report(mime->mm_data.mm_message.mm_msg_mime) ) {
return 1;
}
}
return 0;
}
/*******************************************************************************
* Tools
* Generate Keypairs
******************************************************************************/
@ -594,37 +642,6 @@ static int decrypt_recursive(mrmailbox_t* mailbox,
}
static int contains_report(struct mailmime* mime)
{
/* returns true if the mime structure contains a multipart/report
(as reports are often unencrypted, we do not reset the Autocrypt header in this case)
(however, MUA should be encouraged to encrpyt multipart/reports as well so that we can use the normal Autocrypt processing) */
if( mime->mm_type == MAILMIME_MULTIPLE )
{
if( mime->mm_content_type->ct_type->tp_type==MAILMIME_TYPE_COMPOSITE_TYPE
&& mime->mm_content_type->ct_type->tp_data.tp_composite_type->ct_type == MAILMIME_COMPOSITE_TYPE_MULTIPART
&& strcmp(mime->mm_content_type->ct_subtype, "report")==0 ) {
return 1;
}
clistiter* cur;
for( cur=clist_begin(mime->mm_data.mm_multipart.mm_mp_list); cur!=NULL; cur=clist_next(cur)) {
if( contains_report((struct mailmime*)clist_content(cur)) ) {
return 1;
}
}
}
else if( mime->mm_type == MAILMIME_MESSAGE )
{
if( contains_report(mime->mm_data.mm_message.mm_msg_mime) ) {
return 1;
}
}
return 0;
}
int mrmailbox_e2ee_decrypt(mrmailbox_t* mailbox, struct mailmime* in_out_message, int* ret_validation_errors)
{
/* return values: 0=nothing to decrypt/cannot decrypt, 1=sth. decrypted

View file

@ -584,6 +584,10 @@ cleanup:
*/
int mrmailbox_continue_key_transfer(mrmailbox_t* mailbox, uint32_t msg_id, const char* setup_code)
{
if( mailbox == NULL || msg_id <= MR_MSG_ID_LAST_SPECIAL || setup_code == NULL ) {
return 0;
}
return 0;
}

View file

@ -721,7 +721,7 @@ int mrmsg_is_setupmessage(mrmsg_t* msg)
*/
char* mrmsg_get_setupcodebegin(mrmsg_t* msg)
{
return safe_strdup(NULL);
return safe_strdup("12"); // TODO
}