diff --git a/src/dc_mimeparser.c b/src/dc_mimeparser.c index 3ce44a7b..36532a47 100644 --- a/src/dc_mimeparser.c +++ b/src/dc_mimeparser.c @@ -1499,6 +1499,20 @@ 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) */ } + /* some special system message? */ + if (dc_mimeparser_lookup_field(mimeparser, "Chat-Group-Image") + && carray_count(mimeparser->parts)>=1) { + dc_mimepart_t* textpart = (dc_mimepart_t*)carray_get(mimeparser->parts, 0); + if (textpart->type==DC_MSG_TEXT) { + if (carray_count(mimeparser->parts)>=2) { + dc_mimepart_t* imgpart = (dc_mimepart_t*)carray_get(mimeparser->parts, 1); + if (imgpart->type==DC_MSG_IMAGE) { + imgpart->is_meta = 1; + } + } + } + } + // create compound messages if (mimeparser->is_send_by_messenger && s_generate_compound_msgs @@ -1507,7 +1521,9 @@ void dc_mimeparser_parse(dc_mimeparser_t* mimeparser, const char* body_not_termi 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)) + if (textpart->type==DC_MSG_TEXT + && DC_MSG_NEEDS_ATTACHMENT(filepart->type) + && !filepart->is_meta) { free(filepart->msg); filepart->msg = textpart->msg; @@ -1588,21 +1604,6 @@ void dc_mimeparser_parse(dc_mimeparser_t* mimeparser, const char* body_not_termi } } - /* some special system message? */ - if (dc_mimeparser_lookup_field(mimeparser, "Chat-Group-Image") - && carray_count(mimeparser->parts)>=1) { - dc_mimepart_t* textpart = (dc_mimepart_t*)carray_get(mimeparser->parts, 0); - if (textpart->type==DC_MSG_TEXT) { - dc_param_set_int(textpart->param, DC_PARAM_CMD, DC_CMD_GROUPIMAGE_CHANGED); - if (carray_count(mimeparser->parts)>=2) { - dc_mimepart_t* imgpart = (dc_mimepart_t*)carray_get(mimeparser->parts, 1); - if (imgpart->type==DC_MSG_IMAGE) { - imgpart->is_meta = 1; - } - } - } - } - /* check, if the message asks for a MDN */ if (!mimeparser->decrypting_failed) { diff --git a/src/dc_receive_imf.c b/src/dc_receive_imf.c index 68c956f0..085f2235 100644 --- a/src/dc_receive_imf.c +++ b/src/dc_receive_imf.c @@ -661,6 +661,9 @@ static void create_or_lookup_group(dc_context_t* context, dc_mimeparser_t* mime_ else if ((optional_field=dc_mimeparser_lookup_optional_field(mime_parser, "Chat-Group-Member-Added"))!=NULL) { X_MrAddToGrp = optional_field->fld_value; mime_parser->is_system_message = DC_CMD_MEMBER_ADDED_TO_GROUP; + if ((optional_field=dc_mimeparser_lookup_optional_field(mime_parser, "Chat-Group-Image"))!=NULL) { + X_MrGrpImageChanged = optional_field->fld_value; + } } else if ((optional_field=dc_mimeparser_lookup_optional_field(mime_parser, "Chat-Group-Name-Changed"))!=NULL) { X_MrGrpNameChanged = 1;