more careful sync
authorVolker Birk <vb@pep.foundation>
Sun, 21 Oct 2018 12:46:20 +0200
branchsync
changeset 3105d087d038ca66
parent 3085 d838e2d02278
child 3106 c99412ad3e8f
more careful
src/message_api.c
     1.1 --- a/src/message_api.c	Sun Oct 21 12:35:25 2018 +0200
     1.2 +++ b/src/message_api.c	Sun Oct 21 12:46:20 2018 +0200
     1.3 @@ -907,7 +907,7 @@
     1.4  
     1.5      replace_opt_field(attachment, "X-pEp-Version", PEP_VERSION, true);
     1.6          
     1.7 -    if (!_envelope || (wrap_type != PEP_message_transport)) {
     1.8 +    if (!_envelope && (wrap_type != PEP_message_transport)) {
     1.9          _envelope = extract_minimal_envelope(attachment, PEP_dir_outgoing);
    1.10          status = generate_message_id(_envelope);
    1.11          
    1.12 @@ -925,8 +925,11 @@
    1.13          attachment->longmsg = encapsulate_message_wrap_info(inner_type_string, attachment->longmsg);
    1.14          _envelope->longmsg = encapsulate_message_wrap_info("OUTER", _envelope->longmsg);
    1.15      }
    1.16 +    else if (_envelope) {
    1.17 +        _envelope->longmsg = encapsulate_message_wrap_info("TRANSPORT", _envelope->longmsg);
    1.18 +    }
    1.19      else {
    1.20 -        _envelope->longmsg = encapsulate_message_wrap_info("TRANSPORT", _envelope->longmsg);
    1.21 +        return NULL;
    1.22      }
    1.23      
    1.24      if (!attachment->id || attachment->id[0] == '\0') {