mirror of
https://github.com/deltachat/deltachat-core.git
synced 2025-10-06 03:50:08 +02:00
generate compound messages
This commit is contained in:
parent
0ce095c214
commit
b3bd43c3b8
2 changed files with 32 additions and 0 deletions
|
@ -28,6 +28,19 @@
|
|||
#include "dc_simplify.h"
|
||||
|
||||
|
||||
|
||||
// deprecated: flag to switch generation of compound messages on and off.
|
||||
static int s_generate_compound_msgs = 1;
|
||||
|
||||
|
||||
// deprecated: call dc_no_compound_msgs()
|
||||
// to switch generation of compound messages off for the whole library.
|
||||
void dc_no_compound_msgs(void)
|
||||
{
|
||||
s_generate_compound_msgs = 0;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* debug output
|
||||
******************************************************************************/
|
||||
|
@ -1526,6 +1539,24 @@ void dc_mimeparser_parse(dc_mimeparser_t* mimeparser, const char* body_not_termi
|
|||
mimeparser->is_send_by_messenger = 0; /* do not treat a setup message as a messenger message (eg. do not move setup messages to the Chats-folder; there may be a 3rd device that wants to handle it) */
|
||||
}
|
||||
|
||||
// create compound messages
|
||||
if (mimeparser->is_send_by_messenger
|
||||
&& s_generate_compound_msgs
|
||||
&& carray_count(mimeparser->parts)==2)
|
||||
{
|
||||
dc_mimepart_t* textpart = (dc_mimepart_t*)carray_get(mimeparser->parts, 0);
|
||||
dc_mimepart_t* filepart = (dc_mimepart_t*)carray_get(mimeparser->parts, 1);
|
||||
|
||||
if (textpart->type==DC_MSG_TEXT && DC_MSG_NEEDS_ATTACHMENT(filepart->type))
|
||||
{
|
||||
free(filepart->msg);
|
||||
filepart->msg = textpart->msg;
|
||||
textpart->msg = NULL;
|
||||
dc_mimepart_unref(textpart);
|
||||
carray_delete_slow(mimeparser->parts, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/* prepend subject to message? */
|
||||
if (mimeparser->subject)
|
||||
{
|
||||
|
|
|
@ -234,6 +234,7 @@ char* dc_get_config (dc_context_t*, const char* key);
|
|||
char* dc_get_info (dc_context_t*);
|
||||
char* dc_get_version_str (void);
|
||||
void dc_openssl_init_not_required (void);
|
||||
void dc_no_compound_msgs (void); // deprecated
|
||||
|
||||
|
||||
// connect
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue