ENGINE-553: Message 2.1 - addition of forward=no is there, and is detected. Now: to act on it. (Yes, Roker, I will file you a task against libpEpMIME once I have this impl sorted :) ENGINE-553
authorKrista 'DarthMama' Bennett <krista@pep.foundation>
Thu, 16 May 2019 16:56:09 +0200
branchENGINE-553
changeset 3710d7c1395f473c
parent 3709 c560e8fd8246
child 3711 2899189816c1
ENGINE-553: Message 2.1 - addition of forward=no is there, and is detected. Now: to act on it. (Yes, Roker, I will file you a task against libpEpMIME once I have this impl sorted :)
src/aux_mime_msg.c
src/etpan_mime.c
src/etpan_mime.h
src/message_api.c
src/mime.c
src/mime.h
test/src/engine_tests/AppleMailTests.cc
test/src/engine_tests/BlacklistAcceptNewKeyTests.cc
test/src/engine_tests/EncryptForIdentityTests.cc
test/src/engine_tests/EncryptMissingPrivateKeyTests.cc
test/src/engine_tests/KeyAttachmentTests.cc
test/src/engine_tests/LeastColorGroupTests.cc
test/src/engine_tests/LeastCommonDenomColorTests.cc
test/src/engine_tests/MessageApiTests.cc
test/src/engine_tests/MessageTwoPointOhTests.cc
test/src/engine_tests/MimeTests.cc
test/src/engine_tests/PepSubjectReceivedTests.cc
test/src/engine_tests/SimpleBodyNotAltTests.cc
test/src/util/test_util.cc
     1.1 --- a/src/aux_mime_msg.c	Wed May 15 16:02:11 2019 +0200
     1.2 +++ b/src/aux_mime_msg.c	Thu May 16 16:56:09 2019 +0200
     1.3 @@ -73,7 +73,7 @@
     1.4      message* dec_msg = NULL;
     1.5      *mime_plaintext = NULL;
     1.6  
     1.7 -    status = mime_decode_message(mimetext, size, &tmp_msg);
     1.8 +    status = mime_decode_message(mimetext, size, &tmp_msg, NULL);
     1.9      if (status != PEP_STATUS_OK)
    1.10          goto pEp_error;
    1.11  
    1.12 @@ -120,7 +120,7 @@
    1.13      }
    1.14  
    1.15      if (*flags & PEP_decrypt_flag_src_modified) {
    1.16 -        _mime_encode_message_internal(tmp_msg, false, modified_src, true);
    1.17 +        _mime_encode_message_internal(tmp_msg, false, modified_src, true, false);
    1.18          if (!modified_src) {
    1.19              *flags &= (~PEP_decrypt_flag_src_modified);
    1.20              decrypt_status = PEP_CANNOT_REENCRYPT; // Because we couldn't return it, I guess.
    1.21 @@ -128,7 +128,7 @@
    1.22      }
    1.23  
    1.24      // FIXME: test with att
    1.25 -    status = _mime_encode_message_internal(dec_msg, false, mime_plaintext, true);
    1.26 +    status = _mime_encode_message_internal(dec_msg, false, mime_plaintext, true, false);
    1.27  
    1.28      if (status == PEP_STATUS_OK)
    1.29      {
    1.30 @@ -159,7 +159,7 @@
    1.31      message* tmp_msg = NULL;
    1.32      message* enc_msg = NULL;
    1.33  
    1.34 -    status = mime_decode_message(mimetext, size, &tmp_msg);
    1.35 +    status = mime_decode_message(mimetext, size, &tmp_msg, NULL);
    1.36      if (status != PEP_STATUS_OK)
    1.37          goto pEp_error;
    1.38  
    1.39 @@ -214,7 +214,7 @@
    1.40          goto pEp_error;
    1.41      }
    1.42  
    1.43 -    status = _mime_encode_message_internal(enc_msg, false, mime_ciphertext, false);
    1.44 +    status = _mime_encode_message_internal(enc_msg, false, mime_ciphertext, false, false);
    1.45  
    1.46  pEp_error:
    1.47      free_message(tmp_msg);
    1.48 @@ -239,7 +239,7 @@
    1.49      message* tmp_msg = NULL;
    1.50      message* enc_msg = NULL;
    1.51  
    1.52 -    status = mime_decode_message(mimetext, size, &tmp_msg);
    1.53 +    status = mime_decode_message(mimetext, size, &tmp_msg, NULL);
    1.54      if (status != PEP_STATUS_OK)
    1.55          goto pEp_error;
    1.56  
    1.57 @@ -271,4 +271,3 @@
    1.58  #else
    1.59  const int the_answer_my_friend = 42;
    1.60  #endif
    1.61 -
     2.1 --- a/src/etpan_mime.c	Wed May 15 16:02:11 2019 +0200
     2.2 +++ b/src/etpan_mime.c	Thu May 16 16:56:09 2019 +0200
     2.3 @@ -38,6 +38,7 @@
     2.4  struct mailmime * part_new_empty(
     2.5          struct mailmime_content * content,
     2.6          struct mailmime_fields * mime_fields,
     2.7 +        stringpair_list_t* param_keyvals,
     2.8          int force_single
     2.9      )
    2.10  {
    2.11 @@ -127,6 +128,40 @@
    2.12          if (content->ct_parameters == NULL)
    2.13              content->ct_parameters = parameters;
    2.14      }
    2.15 +    
    2.16 +    if (param_keyvals) {
    2.17 +        stringpair_list_t* cur;
    2.18 +        for (cur = param_keyvals; cur; cur = cur->next) {
    2.19 +            attr_name = strdup(cur->value->key);
    2.20 +            attr_value = strdup(cur->value->value);
    2.21 +            
    2.22 +            param = mailmime_parameter_new(attr_name, attr_value);
    2.23 +            assert(param);
    2.24 +            if (param == NULL)
    2.25 +                goto enomem;
    2.26 +                
    2.27 +            attr_name = NULL;
    2.28 +            attr_value = NULL;
    2.29 +
    2.30 +            if (content->ct_parameters == NULL) {
    2.31 +                parameters = clist_new();
    2.32 +                assert(parameters);
    2.33 +                if (parameters == NULL)
    2.34 +                    goto enomem;
    2.35 +            }
    2.36 +            else {
    2.37 +                parameters = content->ct_parameters;
    2.38 +            }
    2.39 +
    2.40 +            r = clist_append(parameters, param);
    2.41 +            if (r)
    2.42 +                goto enomem;
    2.43 +            param = NULL;
    2.44 +
    2.45 +            if (content->ct_parameters == NULL)
    2.46 +                content->ct_parameters = parameters;            
    2.47 +        }
    2.48 +    }
    2.49  
    2.50      build_info = mailmime_new(mime_type, NULL, 0, mime_fields, content, NULL,
    2.51              NULL, NULL, list, NULL, NULL);
    2.52 @@ -163,7 +198,7 @@
    2.53      if (mime_fields == NULL)
    2.54          goto enomem;
    2.55  
    2.56 -    mime = part_new_empty(content, mime_fields, 1);
    2.57 +    mime = part_new_empty(content, mime_fields, NULL, 1);
    2.58      if (mime == NULL)
    2.59          goto enomem;
    2.60      mime_fields = NULL;
    2.61 @@ -252,7 +287,7 @@
    2.62              goto enomem;
    2.63      }
    2.64  
    2.65 -    mime = part_new_empty(content, mime_fields, 1);
    2.66 +    mime = part_new_empty(content, mime_fields, NULL, 1);
    2.67      if (mime == NULL)
    2.68          goto enomem;
    2.69      content = NULL;
    2.70 @@ -289,7 +324,8 @@
    2.71          const char * mime_type,
    2.72          char * data,
    2.73          size_t length,
    2.74 -        bool transport_encode
    2.75 +        bool transport_encode,
    2.76 +        bool set_attachment_forward_comment
    2.77      )
    2.78  {
    2.79      char * disposition_name = NULL;
    2.80 @@ -351,7 +387,13 @@
    2.81      encoding = NULL;
    2.82      disposition = NULL;
    2.83  
    2.84 -    mime = part_new_empty(content, mime_fields, 1);
    2.85 +    stringpair_list_t* extra_params = NULL;
    2.86 +    
    2.87 +    if (set_attachment_forward_comment)
    2.88 +        extra_params = new_stringpair_list(new_stringpair("forward", "no"));
    2.89 +    
    2.90 +    mime = part_new_empty(content, mime_fields, extra_params, 1);
    2.91 +    free_stringpair_list(extra_params);
    2.92      if (mime == NULL)
    2.93          goto enomem;
    2.94      content = NULL;
    2.95 @@ -396,7 +438,7 @@
    2.96      if (content == NULL)
    2.97          goto enomem;
    2.98      
    2.99 -    mp = part_new_empty(content, mime_fields, 0);
   2.100 +    mp = part_new_empty(content, mime_fields, NULL, 0);
   2.101      if (mp == NULL)
   2.102          goto enomem;
   2.103      
   2.104 @@ -815,6 +857,22 @@
   2.105      return false;
   2.106  }
   2.107  
   2.108 +bool _is_message_part(struct mailmime_content *content, const char* subtype) {
   2.109 +    assert(content);
   2.110 +    if (content->ct_type && content->ct_type->tp_type == MAILMIME_TYPE_COMPOSITE_TYPE &&
   2.111 +            content->ct_type->tp_data.tp_composite_type &&
   2.112 +            content->ct_type->tp_data.tp_composite_type->ct_type ==
   2.113 +            MAILMIME_COMPOSITE_TYPE_MESSAGE) {
   2.114 +        if (subtype)
   2.115 +            return content->ct_subtype &&
   2.116 +                    strcasecmp(content->ct_subtype, subtype) == 0;
   2.117 +        else
   2.118 +            return true;                
   2.119 +    }
   2.120 +    
   2.121 +    return false;
   2.122 +}
   2.123 +
   2.124  int _get_content_type(
   2.125          const struct mailmime_content *content,
   2.126          char **type,
   2.127 @@ -948,7 +1006,8 @@
   2.128  #endif
   2.129  
   2.130  static PEP_STATUS interpret_MIME(struct mailmime *mime,
   2.131 -                                 message *msg);
   2.132 +                                 message *msg,
   2.133 +                                 bool* raise_msg_attachment);
   2.134  
   2.135  // This function was rewritten to use in-memory buffers instead of
   2.136  // temporary files when the pgp/mime support was implemented for
   2.137 @@ -1006,7 +1065,8 @@
   2.138  static PEP_STATUS mime_attachment(
   2.139          bloblist_t *blob,
   2.140          struct mailmime **result,
   2.141 -        bool transport_encode
   2.142 +        bool transport_encode,
   2.143 +        bool set_attachment_forward_comment
   2.144      )
   2.145  {
   2.146      PEP_STATUS status = PEP_STATUS_OK;
   2.147 @@ -1031,7 +1091,8 @@
   2.148      bool already_ascii = !(must_chunk_be_encoded(blob->value, blob->size, true));
   2.149  
   2.150      mime = get_file_part(resource, mime_type, blob->value, blob->size, 
   2.151 -                          (already_ascii ? false : transport_encode));
   2.152 +                          (already_ascii ? false : transport_encode),
   2.153 +                          set_attachment_forward_comment);
   2.154      free_rid_list(resource);
   2.155      
   2.156      assert(mime);
   2.157 @@ -1155,7 +1216,7 @@
   2.158      for (_a = attachments; _a != NULL; _a = _a->next) {
   2.159          if (_a->disposition != PEP_CONTENT_DISP_INLINE)
   2.160              continue;
   2.161 -        status = mime_attachment(_a, &submime, transport_encode);
   2.162 +        status = mime_attachment(_a, &submime, transport_encode, false);
   2.163          if (status != PEP_STATUS_OK)
   2.164              return PEP_UNKNOWN_ERROR; // FIXME
   2.165  
   2.166 @@ -1632,7 +1693,8 @@
   2.167          const message *msg,
   2.168          bool omit_fields,
   2.169          struct mailmime **result,
   2.170 -        bool transport_encode
   2.171 +        bool transport_encode,
   2.172 +        bool set_attachment_forward_comment
   2.173      )
   2.174  {
   2.175      struct mailmime * mime = NULL;
   2.176 @@ -1711,14 +1773,19 @@
   2.177          }
   2.178  
   2.179          bloblist_t *_a;
   2.180 +        bool first_one = true;
   2.181 +        
   2.182          for (_a = msg->attachments; _a != NULL; _a = _a->next) {
   2.183  
   2.184              if (_a->disposition == PEP_CONTENT_DISP_INLINE)
   2.185                  continue;
   2.186  
   2.187 -            status = mime_attachment(_a, &submime, transport_encode);
   2.188 +            status = mime_attachment(_a, &submime, transport_encode,
   2.189 +                                     (first_one && set_attachment_forward_comment));                         
   2.190              if (status != PEP_STATUS_OK)
   2.191                  goto pEp_error;
   2.192 +            
   2.193 +            first_one = false;    
   2.194  
   2.195              r = mailmime_smart_add_part(mime, submime);
   2.196              assert(r == MAILIMF_NO_ERROR);
   2.197 @@ -1830,7 +1897,8 @@
   2.198          const message * msg,
   2.199          bool omit_fields,
   2.200          char **mimetext,
   2.201 -        bool transport_encode
   2.202 +        bool transport_encode,
   2.203 +        bool set_attachment_forward_comment
   2.204      )
   2.205  {
   2.206      PEP_STATUS status = PEP_STATUS_OK;
   2.207 @@ -1850,11 +1918,12 @@
   2.208  
   2.209      switch (msg->enc_format) {
   2.210          case PEP_enc_none:
   2.211 -            status = mime_encode_message_plain(msg, omit_fields, &mime, transport_encode);
   2.212 +            status = mime_encode_message_plain(msg, omit_fields, &mime, transport_encode, set_attachment_forward_comment);
   2.213              break;
   2.214  
   2.215 +        // I'm presuming we should hardcore ignoring set_attachment_forward_comment here...
   2.216          case PEP_enc_inline:
   2.217 -            status = mime_encode_message_plain(msg, omit_fields, &mime, transport_encode);
   2.218 +            status = mime_encode_message_plain(msg, omit_fields, &mime, transport_encode, false);
   2.219              break;
   2.220  
   2.221          case PEP_enc_S_MIME:
   2.222 @@ -2402,7 +2471,7 @@
   2.223          // ???
   2.224          // This is what we would have done before, so... no
   2.225          // worse than the status quo. But FIXME!
   2.226 -        status = interpret_MIME(part, msg);
   2.227 +        status = interpret_MIME(part, msg, NULL);
   2.228          if (status)
   2.229              return status;
   2.230      }
   2.231 @@ -2417,7 +2486,7 @@
   2.232          if (content == NULL)
   2.233              return PEP_ILLEGAL_VALUE;
   2.234  
   2.235 -        status = interpret_MIME(part, msg);
   2.236 +        status = interpret_MIME(part, msg, NULL);
   2.237          if (status)
   2.238              return status;
   2.239      }
   2.240 @@ -2426,7 +2495,8 @@
   2.241  
   2.242  static PEP_STATUS interpret_MIME(
   2.243          struct mailmime *mime,
   2.244 -        message *msg
   2.245 +        message *msg,
   2.246 +        bool* raise_msg_attachment
   2.247      )
   2.248  {
   2.249      PEP_STATUS status = PEP_STATUS_OK;
   2.250 @@ -2476,7 +2546,7 @@
   2.251                          return status;
   2.252                  }
   2.253                  else /* add as attachment */ {
   2.254 -                    status = interpret_MIME(part, msg);
   2.255 +                    status = interpret_MIME(part, msg, NULL);
   2.256                      if (status)
   2.257                          return status;
   2.258                  }
   2.259 @@ -2499,7 +2569,7 @@
   2.260                  if (part == NULL)
   2.261                      return PEP_ILLEGAL_VALUE;
   2.262  
   2.263 -                status = interpret_MIME(part, msg);
   2.264 +                status = interpret_MIME(part, msg, NULL);
   2.265                  if (status != PEP_STATUS_OK)
   2.266                      return status;
   2.267              }
   2.268 @@ -2510,11 +2580,13 @@
   2.269                  return PEP_ILLEGAL_VALUE;
   2.270  
   2.271              clistiter *cur;
   2.272 -            for (cur = clist_begin(partlist); cur; cur = clist_next(cur)) {
   2.273 +            // only add raise_msg_attachment on 2nd part!
   2.274 +            int _att_count = 0;
   2.275 +            for (cur = clist_begin(partlist); cur; cur = clist_next(cur), _att_count++) {
   2.276                  struct mailmime *part= clist_content(cur);
   2.277                  if (part == NULL)
   2.278                      return PEP_ILLEGAL_VALUE;
   2.279 -                status = interpret_MIME(part, msg);
   2.280 +                status = interpret_MIME(part, msg, _att_count == 1 ? raise_msg_attachment : NULL);
   2.281                  if (status != PEP_STATUS_OK)
   2.282                      return status;
   2.283              }
   2.284 @@ -2547,6 +2619,25 @@
   2.285                      return status;
   2.286              }
   2.287              else {
   2.288 +                // Fixme - we need a control on recursion level here - KG: maybe NOT. We only go to depth 1.
   2.289 +                if (raise_msg_attachment != NULL) {
   2.290 +                    bool is_msg = (_is_message_part(content, "rfc822") || _is_text_part(content, "rfc822"));
   2.291 +                    if (is_msg) {
   2.292 +                        if (content->ct_parameters) {
   2.293 +                            clistiter *cur;
   2.294 +                            for (cur = clist_begin(content->ct_parameters); cur; cur =
   2.295 +                                 clist_next(cur)) {
   2.296 +                                struct mailmime_parameter * param = clist_content(cur);
   2.297 +                                if (param && param->pa_name && strcasecmp(param->pa_name, "forward") == 0) {
   2.298 +                                    if (param->pa_value && strcasecmp(param->pa_value, "no") == 0) {
   2.299 +                                        *raise_msg_attachment = true;
   2.300 +                                        break;
   2.301 +                                    }
   2.302 +                                }
   2.303 +                            }
   2.304 +                        }
   2.305 +                    }
   2.306 +                }
   2.307                  char *data = NULL;
   2.308                  size_t size = 0;
   2.309                  char * mime_type;
   2.310 @@ -2633,7 +2724,8 @@
   2.311  DYNAMIC_API PEP_STATUS mime_decode_message(
   2.312          const char *mimetext,
   2.313          size_t size,
   2.314 -        message **msg
   2.315 +        message **msg,
   2.316 +        bool* raise_msg_attachment
   2.317      )
   2.318  {
   2.319      PEP_STATUS status = PEP_STATUS_OK;
   2.320 @@ -2677,7 +2769,7 @@
   2.321  
   2.322      if (content) {
   2.323          status = interpret_MIME(mime->mm_data.mm_message.mm_msg_mime,
   2.324 -                _msg);
   2.325 +                _msg, raise_msg_attachment);
   2.326          if (status != PEP_STATUS_OK)
   2.327              goto pEp_error;
   2.328      }
   2.329 @@ -2702,4 +2794,3 @@
   2.330  
   2.331      return status;
   2.332  }
   2.333 -
     3.1 --- a/src/etpan_mime.h	Wed May 15 16:02:11 2019 +0200
     3.2 +++ b/src/etpan_mime.h	Thu May 16 16:56:09 2019 +0200
     3.3 @@ -8,10 +8,12 @@
     3.4  #include <libetpan/mailmime_encode.h>
     3.5  
     3.6  #include "resource_id.h"
     3.7 +#include "stringpair.h"
     3.8  
     3.9  struct mailmime * part_new_empty(
    3.10          struct mailmime_content * content,
    3.11          struct mailmime_fields * mime_fields,
    3.12 +        stringpair_list_t* param_keyvals,        
    3.13          int force_single
    3.14      );
    3.15  
    3.16 @@ -30,7 +32,8 @@
    3.17          const char * mime_type,
    3.18          char * data,
    3.19          size_t length,
    3.20 -        bool transport_encode
    3.21 +        bool transport_encode,
    3.22 +        bool set_attachment_forward_comment
    3.23      );
    3.24  
    3.25  struct mailmime * part_multiple_new(const char *type);
     4.1 --- a/src/message_api.c	Wed May 15 16:02:11 2019 +0200
     4.2 +++ b/src/message_api.c	Thu May 16 16:56:09 2019 +0200
     4.3 @@ -916,10 +916,14 @@
     4.4              default:
     4.5                  inner_type_string = "INNER";
     4.6          }
     4.7 -        attachment->longmsg = encapsulate_message_wrap_info(inner_type_string, attachment->longmsg);
     4.8 +        attachment->longmsg = encapsulate_message_wrap_info(inner_type_string, attachment->longmsg);        
     4.9          _envelope->longmsg = encapsulate_message_wrap_info("OUTER", _envelope->longmsg);
    4.10 +
    4.11 +        // 2.1, to replace the above
    4.12 +        add_opt_field(attachment, PEP_MSG_WRAP_KEY, inner_type_string); 
    4.13      }
    4.14      else if (_envelope) {
    4.15 +        // 2.1 - how do we peel this particular union when we get there?
    4.16          _envelope->longmsg = encapsulate_message_wrap_info("TRANSPORT", _envelope->longmsg);
    4.17      }
    4.18      else {
    4.19 @@ -955,7 +959,7 @@
    4.20                );
    4.21              
    4.22      /* Turn message into a MIME-blob */
    4.23 -    status = _mime_encode_message_internal(attachment, false, &message_text, true);
    4.24 +    status = _mime_encode_message_internal(attachment, false, &message_text, true, false);
    4.25          
    4.26      if (status != PEP_STATUS_OK)
    4.27          goto enomem;
    4.28 @@ -1032,8 +1036,11 @@
    4.29      _src->longmsg_formatted = src->longmsg_formatted;
    4.30      _src->attachments = src->attachments;
    4.31      _src->enc_format = PEP_enc_none;
    4.32 -    bool mime_encode = !is_wrapper(_src);
    4.33 -    status = _mime_encode_message_internal(_src, true, &mimetext, mime_encode);
    4.34 +    
    4.35 +    // These vars are here to be clear, and because I don't know how this may change in the near future.
    4.36 +    bool wrapped = is_wrapper(_src);
    4.37 +    bool mime_encode = !wrapped;
    4.38 +    status = _mime_encode_message_internal(_src, true, &mimetext, mime_encode, wrapped);
    4.39      assert(status == PEP_STATUS_OK);
    4.40      if (status != PEP_STATUS_OK)
    4.41          goto pEp_error;
    4.42 @@ -3447,6 +3454,7 @@
    4.43      decrypt_status = status;
    4.44      
    4.45      bool imported_private_key_address = false;
    4.46 +    bool has_inner = false;
    4.47  
    4.48      if (ptext) { 
    4.49          /* we got a plaintext from decryption */
    4.50 @@ -3455,7 +3463,7 @@
    4.51              case PEP_enc_PGP_MIME:
    4.52              case PEP_enc_PGP_MIME_Outlook1:
    4.53              
    4.54 -                status = mime_decode_message(ptext, psize, &msg);
    4.55 +                status = mime_decode_message(ptext, psize, &msg, &has_inner);
    4.56                  if (status != PEP_STATUS_OK)
    4.57                      goto pEp_error;
    4.58                  
    4.59 @@ -3554,7 +3562,8 @@
    4.60                                      
    4.61                                  status = mime_decode_message(actual_message->value, 
    4.62                                                               actual_message->size, 
    4.63 -                                                             &inner_message);
    4.64 +                                                             &inner_message,
    4.65 +                                                             NULL);
    4.66                                  if (status != PEP_STATUS_OK)
    4.67                                      goto pEp_error;
    4.68                                  
     5.1 --- a/src/mime.c	Wed May 15 16:02:11 2019 +0200
     5.2 +++ b/src/mime.c	Thu May 16 16:56:09 2019 +0200
     5.3 @@ -39,6 +39,5 @@
     5.4          char **mimetext
     5.5      )
     5.6  {
     5.7 -    return _mime_encode_message_internal(msg, omit_fields, mimetext, true);
     5.8 +    return _mime_encode_message_internal(msg, omit_fields, mimetext, true, false);
     5.9  }
    5.10 -
     6.1 --- a/src/mime.h	Wed May 15 16:02:11 2019 +0200
     6.2 +++ b/src/mime.h	Thu May 16 16:56:09 2019 +0200
     6.3 @@ -75,7 +75,8 @@
     6.4  DYNAMIC_API PEP_STATUS mime_decode_message(
     6.5          const char *mimetext,
     6.6          size_t size,
     6.7 -        message **msg
     6.8 +        message **msg,
     6.9 +        bool* raise_msg_attachment
    6.10      );
    6.11  
    6.12  /* sometimes we don't want to transport encode */
    6.13 @@ -83,7 +84,8 @@
    6.14          const message * msg,
    6.15          bool omit_fields,
    6.16          char **mimetext,
    6.17 -        bool transport_encode
    6.18 +        bool transport_encode,
    6.19 +        bool set_attachment_forward_comment        
    6.20      );
    6.21  
    6.22  
     7.1 --- a/test/src/engine_tests/AppleMailTests.cc	Wed May 15 16:02:11 2019 +0200
     7.2 +++ b/test/src/engine_tests/AppleMailTests.cc	Thu May 16 16:56:09 2019 +0200
     7.3 @@ -67,7 +67,7 @@
     7.4      PEP_decrypt_flags_t flags = 0;
     7.5      
     7.6      message* final_ptr = nullptr;
     7.7 -    status = mime_decode_message(mailtext.c_str(), mailtext.length(), &msg_ptr);
     7.8 +    status = mime_decode_message(mailtext.c_str(), mailtext.length(), &msg_ptr, NULL);
     7.9      TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
    7.10      TEST_ASSERT_MSG((msg_ptr), "msg_ptr");
    7.11      
    7.12 @@ -129,7 +129,7 @@
    7.13      const char* mailfile2 = "test_mails/apple_mail_TC_html_signed_encrypted.eml";
    7.14      const string mailtext2 = slurp(mailfile2);
    7.15      
    7.16 -    status = mime_decode_message(mailtext2.c_str(), mailtext2.length(), &msg_ptr);
    7.17 +    status = mime_decode_message(mailtext2.c_str(), mailtext2.length(), &msg_ptr, NULL);
    7.18      TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
    7.19      TEST_ASSERT_MSG((msg_ptr), "msg_ptr");
    7.20      final_ptr = msg_ptr;
     8.1 --- a/test/src/engine_tests/BlacklistAcceptNewKeyTests.cc	Wed May 15 16:02:11 2019 +0200
     8.2 +++ b/test/src/engine_tests/BlacklistAcceptNewKeyTests.cc	Thu May 16 16:56:09 2019 +0200
     8.3 @@ -80,7 +80,7 @@
     8.4      PEP_rating rating;
     8.5      PEP_decrypt_flags_t flags = 0;
     8.6      
     8.7 -    status = mime_decode_message(mailtext.c_str(), mailtext.length(), &msg_ptr);
     8.8 +    status = mime_decode_message(mailtext.c_str(), mailtext.length(), &msg_ptr, NULL);
     8.9      TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
    8.10      status = decrypt_message(session, msg_ptr, &dest_msg, &keylist, &rating, &flags);
    8.11  
     9.1 --- a/test/src/engine_tests/EncryptForIdentityTests.cc	Wed May 15 16:02:11 2019 +0200
     9.2 +++ b/test/src/engine_tests/EncryptForIdentityTests.cc	Thu May 16 16:56:09 2019 +0200
     9.3 @@ -96,7 +96,7 @@
     9.4      cout << encoded_text << "\n";
     9.5  
     9.6      message* decoded_msg = nullptr;
     9.7 -    status = mime_decode_message(encoded_text, strlen(encoded_text), &decoded_msg);
     9.8 +    status = mime_decode_message(encoded_text, strlen(encoded_text), &decoded_msg, NULL);
     9.9      TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
    9.10      const string string3 = encoded_text;
    9.11  
    10.1 --- a/test/src/engine_tests/EncryptMissingPrivateKeyTests.cc	Wed May 15 16:02:11 2019 +0200
    10.2 +++ b/test/src/engine_tests/EncryptMissingPrivateKeyTests.cc	Thu May 16 16:56:09 2019 +0200
    10.3 @@ -55,7 +55,7 @@
    10.4      
    10.5      const string mailtext = slurp("test_mails/blacklist_no_key.eml");
    10.6  
    10.7 -    PEP_STATUS status = mime_decode_message(mailtext.c_str(), mailtext.length(), &tmp_msg);
    10.8 +    PEP_STATUS status = mime_decode_message(mailtext.c_str(), mailtext.length(), &tmp_msg, NULL);
    10.9      TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
   10.10      
   10.11      status = update_identity(session, tmp_msg->from);
    11.1 --- a/test/src/engine_tests/KeyAttachmentTests.cc	Wed May 15 16:02:11 2019 +0200
    11.2 +++ b/test/src/engine_tests/KeyAttachmentTests.cc	Thu May 16 16:56:09 2019 +0200
    11.3 @@ -73,7 +73,7 @@
    11.4      message* enc_msg = NULL;
    11.5      message* dec_msg = NULL;
    11.6  
    11.7 -    PEP_STATUS status = mime_decode_message(msg.c_str(), msg.size(), &enc_msg);
    11.8 +    PEP_STATUS status = mime_decode_message(msg.c_str(), msg.size(), &enc_msg, NULL);
    11.9      TEST_ASSERT_MSG(status == PEP_STATUS_OK, tl_status_string(status));
   11.10      TEST_ASSERT(enc_msg);
   11.11      stringlist_t* keylist = NULL;
   11.12 @@ -93,7 +93,7 @@
   11.13      message* enc_msg = NULL;
   11.14      message* dec_msg = NULL;
   11.15  
   11.16 -    PEP_STATUS status = mime_decode_message(msg.c_str(), msg.size(), &enc_msg);
   11.17 +    PEP_STATUS status = mime_decode_message(msg.c_str(), msg.size(), &enc_msg, NULL);
   11.18      TEST_ASSERT_MSG(status == PEP_STATUS_OK, tl_status_string(status));
   11.19      TEST_ASSERT(enc_msg);
   11.20      stringlist_t* keylist = NULL;
   11.21 @@ -119,7 +119,7 @@
   11.22      message* enc_msg = NULL;
   11.23      message* dec_msg = NULL;
   11.24  
   11.25 -    PEP_STATUS status = mime_decode_message(msg.c_str(), msg.size(), &enc_msg);
   11.26 +    PEP_STATUS status = mime_decode_message(msg.c_str(), msg.size(), &enc_msg, NULL);
   11.27      TEST_ASSERT_MSG(status == PEP_STATUS_OK, tl_status_string(status));
   11.28      TEST_ASSERT(enc_msg);
   11.29      stringlist_t* keylist = NULL;
   11.30 @@ -145,7 +145,7 @@
   11.31      message* enc_msg = NULL;
   11.32      message* dec_msg = NULL;
   11.33  
   11.34 -    PEP_STATUS status = mime_decode_message(msg.c_str(), msg.size(), &enc_msg);
   11.35 +    PEP_STATUS status = mime_decode_message(msg.c_str(), msg.size(), &enc_msg, NULL);
   11.36      TEST_ASSERT_MSG(status == PEP_STATUS_OK, tl_status_string(status));
   11.37      TEST_ASSERT(enc_msg);
   11.38      stringlist_t* keylist = NULL;
   11.39 @@ -171,7 +171,7 @@
   11.40      message* enc_msg = NULL;
   11.41      message* dec_msg = NULL;
   11.42  
   11.43 -    PEP_STATUS status = mime_decode_message(msg.c_str(), msg.size(), &enc_msg);
   11.44 +    PEP_STATUS status = mime_decode_message(msg.c_str(), msg.size(), &enc_msg, NULL);
   11.45      TEST_ASSERT_MSG(status == PEP_STATUS_OK, tl_status_string(status));
   11.46      TEST_ASSERT(enc_msg);
   11.47      stringlist_t* keylist = NULL;
   11.48 @@ -201,7 +201,7 @@
   11.49      message* enc_msg = NULL;
   11.50      message* dec_msg = NULL;
   11.51  
   11.52 -    PEP_STATUS status = mime_decode_message(msg.c_str(), msg.size(), &enc_msg);
   11.53 +    PEP_STATUS status = mime_decode_message(msg.c_str(), msg.size(), &enc_msg, NULL);
   11.54      TEST_ASSERT_MSG(status == PEP_STATUS_OK, tl_status_string(status));
   11.55      TEST_ASSERT(enc_msg);
   11.56      stringlist_t* keylist = NULL;
   11.57 @@ -221,7 +221,7 @@
   11.58      message* enc_msg = NULL;
   11.59      message* dec_msg = NULL;
   11.60  
   11.61 -    PEP_STATUS status = mime_decode_message(msg.c_str(), msg.size(), &enc_msg);
   11.62 +    PEP_STATUS status = mime_decode_message(msg.c_str(), msg.size(), &enc_msg, NULL);
   11.63      TEST_ASSERT_MSG(status == PEP_STATUS_OK, tl_status_string(status));
   11.64      TEST_ASSERT(enc_msg);
   11.65      stringlist_t* keylist = NULL;
   11.66 @@ -247,7 +247,7 @@
   11.67      message* enc_msg = NULL;
   11.68      message* dec_msg = NULL;
   11.69  
   11.70 -    PEP_STATUS status = mime_decode_message(msg.c_str(), msg.size(), &enc_msg);
   11.71 +    PEP_STATUS status = mime_decode_message(msg.c_str(), msg.size(), &enc_msg, NULL);
   11.72      TEST_ASSERT_MSG(status == PEP_STATUS_OK, tl_status_string(status));
   11.73      TEST_ASSERT(enc_msg);
   11.74      stringlist_t* keylist = NULL;
   11.75 @@ -273,7 +273,7 @@
   11.76      message* enc_msg = NULL;
   11.77      message* dec_msg = NULL;
   11.78  
   11.79 -    PEP_STATUS status = mime_decode_message(msg.c_str(), msg.size(), &enc_msg);
   11.80 +    PEP_STATUS status = mime_decode_message(msg.c_str(), msg.size(), &enc_msg, NULL);
   11.81      TEST_ASSERT_MSG(status == PEP_STATUS_OK, tl_status_string(status));
   11.82      TEST_ASSERT(enc_msg);
   11.83      stringlist_t* keylist = NULL;
   11.84 @@ -328,7 +328,7 @@
   11.85      message* enc_msg = NULL;
   11.86      message* dec_msg = NULL;
   11.87  
   11.88 -    PEP_STATUS status = mime_decode_message(msg.c_str(), msg.size(), &enc_msg);
   11.89 +    PEP_STATUS status = mime_decode_message(msg.c_str(), msg.size(), &enc_msg, NULL);
   11.90      TEST_ASSERT_MSG(status == PEP_STATUS_OK, tl_status_string(status));
   11.91      TEST_ASSERT(enc_msg);
   11.92      stringlist_t* keylist = NULL;
   11.93 @@ -348,7 +348,7 @@
   11.94      message* enc_msg = NULL;
   11.95      message* dec_msg = NULL;
   11.96  
   11.97 -    PEP_STATUS status = mime_decode_message(msg.c_str(), msg.size(), &enc_msg);
   11.98 +    PEP_STATUS status = mime_decode_message(msg.c_str(), msg.size(), &enc_msg, NULL);
   11.99      TEST_ASSERT_MSG(status == PEP_STATUS_OK, tl_status_string(status));
  11.100      TEST_ASSERT(enc_msg);
  11.101      stringlist_t* keylist = NULL;
  11.102 @@ -373,7 +373,7 @@
  11.103      message* enc_msg = NULL;
  11.104      message* dec_msg = NULL;
  11.105  
  11.106 -    PEP_STATUS status = mime_decode_message(msg.c_str(), msg.size(), &enc_msg);
  11.107 +    PEP_STATUS status = mime_decode_message(msg.c_str(), msg.size(), &enc_msg, NULL);
  11.108      TEST_ASSERT_MSG(status == PEP_STATUS_OK, tl_status_string(status));
  11.109      TEST_ASSERT(enc_msg);
  11.110      stringlist_t* keylist = NULL;
  11.111 @@ -399,7 +399,7 @@
  11.112      message* enc_msg = NULL;
  11.113      message* dec_msg = NULL;
  11.114  
  11.115 -    PEP_STATUS status = mime_decode_message(msg.c_str(), msg.size(), &enc_msg);
  11.116 +    PEP_STATUS status = mime_decode_message(msg.c_str(), msg.size(), &enc_msg, NULL);
  11.117      TEST_ASSERT_MSG(status == PEP_STATUS_OK, tl_status_string(status));
  11.118      TEST_ASSERT(enc_msg);
  11.119      stringlist_t* keylist = NULL;
  11.120 @@ -424,7 +424,7 @@
  11.121      message* enc_msg = NULL;
  11.122      message* dec_msg = NULL;
  11.123  
  11.124 -    PEP_STATUS status = mime_decode_message(msg.c_str(), msg.size(), &enc_msg);
  11.125 +    PEP_STATUS status = mime_decode_message(msg.c_str(), msg.size(), &enc_msg, NULL);
  11.126      TEST_ASSERT_MSG(status == PEP_STATUS_OK, tl_status_string(status));
  11.127      TEST_ASSERT(enc_msg);
  11.128      stringlist_t* keylist = NULL;
  11.129 @@ -449,7 +449,7 @@
  11.130      message* enc_msg = NULL;
  11.131      message* dec_msg = NULL;
  11.132  
  11.133 -    PEP_STATUS status = mime_decode_message(msg.c_str(), msg.size(), &enc_msg);
  11.134 +    PEP_STATUS status = mime_decode_message(msg.c_str(), msg.size(), &enc_msg, NULL);
  11.135      TEST_ASSERT_MSG(status == PEP_STATUS_OK, tl_status_string(status));
  11.136      TEST_ASSERT(enc_msg);
  11.137      stringlist_t* keylist = NULL;
  11.138 @@ -469,7 +469,7 @@
  11.139      message* enc_msg = NULL;
  11.140      message* dec_msg = NULL;
  11.141  
  11.142 -    PEP_STATUS status = mime_decode_message(msg.c_str(), msg.size(), &enc_msg);
  11.143 +    PEP_STATUS status = mime_decode_message(msg.c_str(), msg.size(), &enc_msg, NULL);
  11.144      TEST_ASSERT_MSG(status == PEP_STATUS_OK, tl_status_string(status));
  11.145      TEST_ASSERT(enc_msg);
  11.146      stringlist_t* keylist = NULL;
  11.147 @@ -494,7 +494,7 @@
  11.148      message* enc_msg = NULL;
  11.149      message* dec_msg = NULL;
  11.150  
  11.151 -    PEP_STATUS status = mime_decode_message(msg.c_str(), msg.size(), &enc_msg);
  11.152 +    PEP_STATUS status = mime_decode_message(msg.c_str(), msg.size(), &enc_msg, NULL);
  11.153      TEST_ASSERT_MSG(status == PEP_STATUS_OK, tl_status_string(status));
  11.154      TEST_ASSERT(enc_msg);
  11.155      stringlist_t* keylist = NULL;
  11.156 @@ -519,7 +519,7 @@
  11.157      message* enc_msg = NULL;
  11.158      message* dec_msg = NULL;
  11.159  
  11.160 -    PEP_STATUS status = mime_decode_message(msg.c_str(), msg.size(), &enc_msg);
  11.161 +    PEP_STATUS status = mime_decode_message(msg.c_str(), msg.size(), &enc_msg, NULL);
  11.162      TEST_ASSERT_MSG(status == PEP_STATUS_OK, tl_status_string(status));
  11.163      TEST_ASSERT(enc_msg);
  11.164      stringlist_t* keylist = NULL;
    12.1 --- a/test/src/engine_tests/LeastColorGroupTests.cc	Wed May 15 16:02:11 2019 +0200
    12.2 +++ b/test/src/engine_tests/LeastColorGroupTests.cc	Thu May 16 16:56:09 2019 +0200
    12.3 @@ -69,7 +69,7 @@
    12.4      PEP_rating rating;
    12.5      PEP_decrypt_flags_t flags;
    12.6      
    12.7 -    status = mime_decode_message(mailtext.c_str(), mailtext.length(), &msg_ptr);
    12.8 +    status = mime_decode_message(mailtext.c_str(), mailtext.length(), &msg_ptr, NULL);
    12.9      TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
   12.10      TEST_ASSERT_MSG((msg_ptr), "msg_ptr");
   12.11      final_ptr = msg_ptr;
    13.1 --- a/test/src/engine_tests/LeastCommonDenomColorTests.cc	Wed May 15 16:02:11 2019 +0200
    13.2 +++ b/test/src/engine_tests/LeastCommonDenomColorTests.cc	Thu May 16 16:56:09 2019 +0200
    13.3 @@ -68,7 +68,7 @@
    13.4      PEP_rating rating;
    13.5      PEP_decrypt_flags_t flags;
    13.6      
    13.7 -    status = mime_decode_message(mailtext.c_str(), mailtext.length(), &msg_ptr);
    13.8 +    status = mime_decode_message(mailtext.c_str(), mailtext.length(), &msg_ptr, NULL);
    13.9      TEST_ASSERT_MSG((status == PEP_STATUS_OK), tl_status_string(status));
   13.10      TEST_ASSERT_MSG((msg_ptr), "msg_ptr");
   13.11  
   13.12 @@ -117,7 +117,7 @@
   13.13      keylist = nullptr;
   13.14      rating = PEP_rating_unreliable;
   13.15  
   13.16 -    status = mime_decode_message(mailtext.c_str(), mailtext.length(), &msg_ptr);
   13.17 +    status = mime_decode_message(mailtext.c_str(), mailtext.length(), &msg_ptr, NULL);
   13.18      TEST_ASSERT_MSG((status == PEP_STATUS_OK), tl_status_string(status));
   13.19      TEST_ASSERT_MSG((msg_ptr), "msg_ptr");
   13.20      flags = 0;
    14.1 --- a/test/src/engine_tests/MessageApiTests.cc	Wed May 15 16:02:11 2019 +0200
    14.2 +++ b/test/src/engine_tests/MessageApiTests.cc	Thu May 16 16:56:09 2019 +0200
    14.3 @@ -81,7 +81,7 @@
    14.4      cout << text2 << "\n";
    14.5  
    14.6      message *msg3 = nullptr;
    14.7 -    PEP_STATUS status3 = mime_decode_message(text2, strlen(text2), &msg3);
    14.8 +    PEP_STATUS status3 = mime_decode_message(text2, strlen(text2), &msg3, NULL);
    14.9      TEST_ASSERT_MSG((status3 == PEP_STATUS_OK), "status3 == PEP_STATUS_OK");
   14.10      const string string3 = text2;
   14.11      //free(text2);
   14.12 @@ -133,7 +133,7 @@
   14.13      inFile3.close();
   14.14  
   14.15      message *msg5 = nullptr;
   14.16 -    PEP_STATUS status5 = mime_decode_message(text3.c_str(), text3.length(), &msg5);
   14.17 +    PEP_STATUS status5 = mime_decode_message(text3.c_str(), text3.length(), &msg5, NULL);
   14.18      TEST_ASSERT_MSG((status5 == PEP_STATUS_OK), "status5 == PEP_STATUS_OK");
   14.19  
   14.20      message *msg6 = nullptr;
    15.1 --- a/test/src/engine_tests/MessageTwoPointOhTests.cc	Wed May 15 16:02:11 2019 +0200
    15.2 +++ b/test/src/engine_tests/MessageTwoPointOhTests.cc	Thu May 16 16:56:09 2019 +0200
    15.3 @@ -121,7 +121,7 @@
    15.4  //    cout << decrypted_text << endl;
    15.5      
    15.6      message* decoded_msg = nullptr;
    15.7 -    status = mime_decode_message(encoded_text, strlen(encoded_text), &decoded_msg);
    15.8 +    status = mime_decode_message(encoded_text, strlen(encoded_text), &decoded_msg, NULL);
    15.9      TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
   15.10      const string string3 = encoded_text;
   15.11        
   15.12 @@ -155,7 +155,7 @@
   15.13      }
   15.14       
   15.15      decrypted_msg->enc_format = PEP_enc_none; 
   15.16 -    status = _mime_encode_message_internal(decrypted_msg, false, &encoded_text, false);
   15.17 +    status = _mime_encode_message_internal(decrypted_msg, false, &encoded_text, false, false);
   15.18      TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
   15.19      TEST_ASSERT_MSG((encoded_text), "encoded_text");
   15.20      cout << "Decrypted message: " << endl;
    16.1 --- a/test/src/engine_tests/MimeTests.cc	Wed May 15 16:02:11 2019 +0200
    16.2 +++ b/test/src/engine_tests/MimeTests.cc	Thu May 16 16:56:09 2019 +0200
    16.3 @@ -44,7 +44,7 @@
    16.4  
    16.5      cout << "decoding message…\n";
    16.6      message *msg3;
    16.7 -    PEP_STATUS status3 = mime_decode_message(mimetext3.c_str(), mimetext3.length(), &msg3);
    16.8 +    PEP_STATUS status3 = mime_decode_message(mimetext3.c_str(), mimetext3.length(), &msg3, NULL);
    16.9      assert(status3 == PEP_STATUS_OK);
   16.10      assert(msg3);
   16.11      cout << "decoded.\n\n";
    17.1 --- a/test/src/engine_tests/PepSubjectReceivedTests.cc	Wed May 15 16:02:11 2019 +0200
    17.2 +++ b/test/src/engine_tests/PepSubjectReceivedTests.cc	Thu May 16 16:56:09 2019 +0200
    17.3 @@ -61,7 +61,7 @@
    17.4      PEP_rating rating;
    17.5      PEP_decrypt_flags_t flags;
    17.6      
    17.7 -    status = mime_decode_message(mailtext.c_str(), mailtext.length(), &msg_ptr);
    17.8 +    status = mime_decode_message(mailtext.c_str(), mailtext.length(), &msg_ptr, NULL);
    17.9      TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
   17.10      TEST_ASSERT_MSG((msg_ptr), "msg_ptr");
   17.11      final_ptr = msg_ptr;
   17.12 @@ -95,7 +95,7 @@
   17.13      keylist = nullptr;
   17.14      rating = PEP_rating_unreliable;
   17.15      
   17.16 -    status = mime_decode_message(mailtext.c_str(), mailtext.length(), &msg_ptr);
   17.17 +    status = mime_decode_message(mailtext.c_str(), mailtext.length(), &msg_ptr, NULL);
   17.18      TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
   17.19      TEST_ASSERT_MSG((msg_ptr), "msg_ptr");
   17.20      final_ptr = msg_ptr;
   17.21 @@ -129,7 +129,7 @@
   17.22      
   17.23      mailtext = slurp("test_mails/pEp_subject_normal_signed_2a.eml");
   17.24      
   17.25 -    status = mime_decode_message(mailtext.c_str(), mailtext.length(), &msg_ptr);
   17.26 +    status = mime_decode_message(mailtext.c_str(), mailtext.length(), &msg_ptr, NULL);
   17.27      TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
   17.28      TEST_ASSERT_MSG((msg_ptr), "msg_ptr");
   17.29      final_ptr = msg_ptr;
   17.30 @@ -162,7 +162,7 @@
   17.31      
   17.32      mailtext = slurp("test_mails/p3p_subject_normal_signed_2b.eml");
   17.33      
   17.34 -    status = mime_decode_message(mailtext.c_str(), mailtext.length(), &msg_ptr);
   17.35 +    status = mime_decode_message(mailtext.c_str(), mailtext.length(), &msg_ptr, NULL);
   17.36      TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
   17.37      TEST_ASSERT_MSG((msg_ptr), "msg_ptr");
   17.38      final_ptr = msg_ptr;
   17.39 @@ -196,7 +196,7 @@
   17.40      
   17.41      mailtext = slurp("test_mails/pEp_encrypted_subject_IS_pEp_3a.eml");
   17.42      
   17.43 -    status = mime_decode_message(mailtext.c_str(), mailtext.length(), &msg_ptr);
   17.44 +    status = mime_decode_message(mailtext.c_str(), mailtext.length(), &msg_ptr, NULL);
   17.45      TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
   17.46      TEST_ASSERT_MSG((msg_ptr), "msg_ptr");
   17.47      final_ptr = msg_ptr;
   17.48 @@ -230,7 +230,7 @@
   17.49      
   17.50      mailtext = slurp("test_mails/p3p_encrypted_subject_IS_pEp_3b.eml");
   17.51      
   17.52 -    status = mime_decode_message(mailtext.c_str(), mailtext.length(), &msg_ptr);
   17.53 +    status = mime_decode_message(mailtext.c_str(), mailtext.length(), &msg_ptr, NULL);
   17.54      TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
   17.55      TEST_ASSERT_MSG((msg_ptr), "msg_ptr");
   17.56      final_ptr = msg_ptr;
   17.57 @@ -265,7 +265,7 @@
   17.58      
   17.59      mailtext = slurp("test_mails/pEp_subject_pEp_replaced_w_pEp_4a.eml");
   17.60      
   17.61 -    status = mime_decode_message(mailtext.c_str(), mailtext.length(), &msg_ptr);
   17.62 +    status = mime_decode_message(mailtext.c_str(), mailtext.length(), &msg_ptr, NULL);
   17.63      TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
   17.64      TEST_ASSERT_MSG((msg_ptr), "msg_ptr");
   17.65      final_ptr = msg_ptr;
   17.66 @@ -299,7 +299,7 @@
   17.67      
   17.68      mailtext = slurp("test_mails/pEp_subject_pEp_replaced_w_p3p_4b.eml");
   17.69      
   17.70 -    status = mime_decode_message(mailtext.c_str(), mailtext.length(), &msg_ptr);
   17.71 +    status = mime_decode_message(mailtext.c_str(), mailtext.length(), &msg_ptr, NULL);
   17.72      TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
   17.73      TEST_ASSERT_MSG((msg_ptr), "msg_ptr");
   17.74      final_ptr = msg_ptr;
   17.75 @@ -333,7 +333,7 @@
   17.76      
   17.77      mailtext = slurp("test_mails/pEp_subject_p3p_replaced_w_pEp_4c.eml");
   17.78      
   17.79 -    status = mime_decode_message(mailtext.c_str(), mailtext.length(), &msg_ptr);
   17.80 +    status = mime_decode_message(mailtext.c_str(), mailtext.length(), &msg_ptr, NULL);
   17.81      TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
   17.82      TEST_ASSERT_MSG((msg_ptr), "msg_ptr");
   17.83      final_ptr = msg_ptr;
   17.84 @@ -367,7 +367,7 @@
   17.85      
   17.86      mailtext = slurp("test_mails/pEp_subject_p3p_replaced_w_p3p_4d.eml");
   17.87      
   17.88 -    status = mime_decode_message(mailtext.c_str(), mailtext.length(), &msg_ptr);
   17.89 +    status = mime_decode_message(mailtext.c_str(), mailtext.length(), &msg_ptr, NULL);
   17.90      TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
   17.91      TEST_ASSERT_MSG((msg_ptr), "msg_ptr");
   17.92      final_ptr = msg_ptr;
   17.93 @@ -402,7 +402,7 @@
   17.94      
   17.95      mailtext = slurp("test_mails/pEp_unencrypted_pEp_subject_5a.eml");
   17.96      
   17.97 -    status = mime_decode_message(mailtext.c_str(), mailtext.length(), &msg_ptr);
   17.98 +    status = mime_decode_message(mailtext.c_str(), mailtext.length(), &msg_ptr, NULL);
   17.99      TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
  17.100      TEST_ASSERT_MSG((msg_ptr), "msg_ptr");
  17.101      final_ptr = msg_ptr;
  17.102 @@ -437,7 +437,7 @@
  17.103      
  17.104      mailtext = slurp("test_mails/pEp_unencrypted_p3p_subject_5b.eml");
  17.105      
  17.106 -    status = mime_decode_message(mailtext.c_str(), mailtext.length(), &msg_ptr);
  17.107 +    status = mime_decode_message(mailtext.c_str(), mailtext.length(), &msg_ptr, NULL);
  17.108      TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
  17.109      TEST_ASSERT_MSG((msg_ptr), "msg_ptr");
  17.110      final_ptr = msg_ptr;
  17.111 @@ -471,7 +471,7 @@
  17.112      
  17.113      mailtext = slurp("test_mails/pEp_subject_normal_unencrypted_6.eml");
  17.114      
  17.115 -    status = mime_decode_message(mailtext.c_str(), mailtext.length(), &msg_ptr);
  17.116 +    status = mime_decode_message(mailtext.c_str(), mailtext.length(), &msg_ptr, NULL);
  17.117      TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
  17.118      TEST_ASSERT_MSG((msg_ptr), "msg_ptr");
  17.119      final_ptr = msg_ptr;
    18.1 --- a/test/src/engine_tests/SimpleBodyNotAltTests.cc	Wed May 15 16:02:11 2019 +0200
    18.2 +++ b/test/src/engine_tests/SimpleBodyNotAltTests.cc	Thu May 16 16:56:09 2019 +0200
    18.3 @@ -29,7 +29,7 @@
    18.4      string msg = slurp("test_mails/text message with html attach.eml");
    18.5      message* parsed = NULL;
    18.6  
    18.7 -    PEP_STATUS status = mime_decode_message(msg.c_str(), msg.size(), &parsed);
    18.8 +    PEP_STATUS status = mime_decode_message(msg.c_str(), msg.size(), &parsed, NULL);
    18.9      TEST_ASSERT_MSG(status == PEP_STATUS_OK, tl_status_string(status));
   18.10      TEST_ASSERT(parsed);
   18.11      TEST_ASSERT(parsed->longmsg);
   18.12 @@ -47,7 +47,7 @@
   18.13      string msg = slurp("test_mails/HTML-only body w text attachment.eml");
   18.14      message* parsed = NULL;
   18.15  
   18.16 -    PEP_STATUS status = mime_decode_message(msg.c_str(), msg.size(), &parsed);
   18.17 +    PEP_STATUS status = mime_decode_message(msg.c_str(), msg.size(), &parsed, NULL);
   18.18      TEST_ASSERT_MSG(status == PEP_STATUS_OK, tl_status_string(status));
   18.19      TEST_ASSERT(parsed);
   18.20      TEST_ASSERT(parsed->longmsg == NULL);
    19.1 --- a/test/src/util/test_util.cc	Wed May 15 16:02:11 2019 +0200
    19.2 +++ b/test/src/util/test_util.cc	Thu May 16 16:56:09 2019 +0200
    19.3 @@ -495,7 +495,7 @@
    19.4      message* dec_msg = NULL;
    19.5      *mime_plaintext = NULL;
    19.6  
    19.7 -    status = mime_decode_message(mimetext, size, &tmp_msg);
    19.8 +    status = mime_decode_message(mimetext, size, &tmp_msg, NULL);
    19.9      if (status != PEP_STATUS_OK)
   19.10          goto pEp_error;
   19.11  
   19.12 @@ -542,7 +542,7 @@
   19.13      }
   19.14  
   19.15      if (*flags & PEP_decrypt_flag_src_modified) {
   19.16 -        _mime_encode_message_internal(tmp_msg, false, modified_src, true);
   19.17 +        _mime_encode_message_internal(tmp_msg, false, modified_src, true, false);
   19.18          if (!modified_src) {
   19.19              *flags &= (~PEP_decrypt_flag_src_modified);
   19.20              decrypt_status = PEP_CANNOT_REENCRYPT; // Because we couldn't return it, I guess.
   19.21 @@ -550,7 +550,7 @@
   19.22      }
   19.23  
   19.24      // FIXME: test with att
   19.25 -    status = _mime_encode_message_internal(dec_msg, false, mime_plaintext, true);
   19.26 +    status = _mime_encode_message_internal(dec_msg, false, mime_plaintext, true, false);
   19.27  
   19.28      if (status == PEP_STATUS_OK)
   19.29      {
   19.30 @@ -580,7 +580,7 @@
   19.31      message* tmp_msg = NULL;
   19.32      message* enc_msg = NULL;
   19.33  
   19.34 -    status = mime_decode_message(mimetext, size, &tmp_msg);
   19.35 +    status = mime_decode_message(mimetext, size, &tmp_msg, NULL);
   19.36      if (status != PEP_STATUS_OK)
   19.37          goto pEp_error;
   19.38  
   19.39 @@ -635,7 +635,7 @@
   19.40          goto pEp_error;
   19.41      }
   19.42  
   19.43 -    status = _mime_encode_message_internal(enc_msg, false, mime_ciphertext, false);
   19.44 +    status = _mime_encode_message_internal(enc_msg, false, mime_ciphertext, false, false);
   19.45  
   19.46  pEp_error:
   19.47      free_message(tmp_msg);
   19.48 @@ -660,7 +660,7 @@
   19.49      message* tmp_msg = NULL;
   19.50      message* enc_msg = NULL;
   19.51  
   19.52 -    status = mime_decode_message(mimetext, size, &tmp_msg);
   19.53 +    status = mime_decode_message(mimetext, size, &tmp_msg, NULL);
   19.54      if (status != PEP_STATUS_OK)
   19.55          goto pEp_error;
   19.56