merged in default ENGINE-423
authorKrista Bennett <krista@pep-project.org>
Thu, 19 Apr 2018 09:38:52 +0200
branchENGINE-423
changeset 26143ea0f7f89ac3
parent 2612 2c6bad8b4a69
parent 2613 1a84490f3f3f
child 2615 5cd3625e0d91
merged in default
src/message_api.c
     1.1 --- a/src/message_api.c	Wed Apr 18 20:39:11 2018 +0200
     1.2 +++ b/src/message_api.c	Thu Apr 19 09:38:52 2018 +0200
     1.3 @@ -1109,8 +1109,13 @@
     1.4              return true;
     1.5      }
     1.6      else if (strcmp(blob->mime_type, "text/plain") == 0) {
     1.7 -        if (strcmp(ext, ".asc") == 0)
     1.8 -            return true;
     1.9 +        if (strcmp(ext, ".asc") == 0) {
    1.10 +            // NOTE: if this ends up being too expensive, we can implement
    1.11 +            // strnstr...
    1.12 +            if (strstr(blob->value, "BEGIN PGP PUBLIC KEY") == NULL &&
    1.13 +                strstr(blob->value, "BEGIN PGP PRIVATE KEY") == NULL)
    1.14 +                return true;
    1.15 +        }
    1.16      }
    1.17  
    1.18      return false;
     2.1 --- a/src/mime.c	Wed Apr 18 20:39:11 2018 +0200
     2.2 +++ b/src/mime.c	Thu Apr 19 09:38:52 2018 +0200
     2.3 @@ -97,21 +97,6 @@
     2.4      return status;
     2.5  }
     2.6  
     2.7 -static bool known_ascii_type(const char* mime_type) {
     2.8 -    const char* text_types[] = {"application/pgp-keys",
     2.9 -                                "application/pgp-encrypted"};
    2.10 -    const int TEXT_TYPE_ARRAY_SIZE = sizeof(text_types)/sizeof(text_types[0]);
    2.11 -    
    2.12 -    int i;
    2.13 -    
    2.14 -    for (i = 0; i < TEXT_TYPE_ARRAY_SIZE; i++) {
    2.15 -        if (strcmp(text_types[i], mime_type) == 0)
    2.16 -            return true;
    2.17 -    }
    2.18 -    return false;
    2.19 -}
    2.20 -
    2.21 -
    2.22  static PEP_STATUS mime_attachment(
    2.23          bloblist_t *blob,
    2.24          struct mailmime **result,
    2.25 @@ -136,7 +121,6 @@
    2.26          mime_type = blob->mime_type;
    2.27  
    2.28      pEp_rid_list_t* resource = parse_uri(blob->filename);
    2.29 -//    bool already_ascii = known_ascii_type(mime_type);
    2.30  
    2.31      bool already_ascii = !(must_chunk_be_encoded(blob->value, blob->size, true));
    2.32