1.1 --- a/src/message_api.c Tue Oct 17 09:55:01 2017 +0200
1.2 +++ b/src/message_api.c Tue Oct 17 16:32:34 2017 +0200
1.3 @@ -20,28 +20,6 @@
1.4 #define _MAX(A, B) ((B) > (A) ? (B) : (A))
1.5 #endif
1.6
1.7 -// static const char* search_opt_fields(message* src, char* key) {
1.8 -// assert(src);
1.9 -// assert(key);
1.10 -// if (src && key) {
1.11 -// stringpair_list_t opt_fields = src->opt_fields;
1.12 -// while (opt_fields) {
1.13 -// char* currkey = opt_fields->value->key;
1.14 -// if (strcmp(currkey, key) == 0) {
1.15 -// return opt_fields->value->value;
1.16 -// }
1.17 -// opt_fields = opt_fields->next;
1.18 -// }
1.19 -// }
1.20 -// return NULL;
1.21 -// }
1.22 -//
1.23 -// static const char* get_message_version_string(message* src) {
1.24 -// const char* version_key = "X-pEp-Version";
1.25 -// return(search_opt_fields(src, version_key));
1.26 -// }
1.27 -
1.28 -
1.29 static char * keylist_to_string(const stringlist_t *keylist)
1.30 {
1.31 if (keylist) {
1.32 @@ -180,9 +158,9 @@
1.33 return uri + 3;
1.34 }
1.35
1.36 -static bool is_file_uri(char* str) {
1.37 - return(strncmp(str, "file://", 7) == 0);
1.38 -}
1.39 +// static bool is_file_uri(char* str) {
1.40 +// return(strncmp(str, "file://", 7) == 0);
1.41 +// }
1.42
1.43 static bool is_cid_uri(const char* str) {
1.44 return(strncmp(str, "cid://", 6) == 0);
1.45 @@ -628,7 +606,7 @@
1.46 }
1.47
1.48 static message* wrap_message_as_attachment(message* envelope,
1.49 - message* attachment) {
1.50 + message* attachment, bool keep_orig_subject) {
1.51
1.52 message* _envelope = envelope;
1.53
1.54 @@ -658,7 +636,8 @@
1.55 "message/rfc822", NULL);
1.56
1.57 _envelope->attachments = message_blob;
1.58 -
1.59 + if (keep_orig_subject && attachment->shortmsg)
1.60 + _envelope->shortmsg = strdup(attachment->shortmsg);
1.61 return _envelope;
1.62 }
1.63
1.64 @@ -1283,13 +1262,15 @@
1.65 else {
1.66 // FIXME - we need to deal with transport types (via flag)
1.67 if ((max_comm_type | PEP_ct_confirmed) == PEP_ct_pEp) {
1.68 - _src = wrap_message_as_attachment(NULL, src);
1.69 + _src = wrap_message_as_attachment(NULL, src, session->unencrypted_subject);
1.70 }
1.71 else {
1.72 // hide subject
1.73 - status = replace_subject(_src);
1.74 - if (status == PEP_OUT_OF_MEMORY)
1.75 - goto enomem;
1.76 + if (!session->unencrypted_subject) {
1.77 + status = replace_subject(_src);
1.78 + if (status == PEP_OUT_OF_MEMORY)
1.79 + goto enomem;
1.80 + }
1.81 }
1.82 if (!(flags & PEP_encrypt_flag_force_no_attached_key))
1.83 attach_own_key(session, _src);
1.84 @@ -2226,7 +2207,7 @@
1.85 char* wrap_info = NULL;
1.86 status = unencapsulate_hidden_fields(src, msg, &wrap_info);
1.87
1.88 - bool is_transport_wrapper = false;
1.89 +// bool is_transport_wrapper = false;
1.90
1.91 // FIXME: replace with enums, check status
1.92 if (wrap_info) {