src/mime.c
author Volker Birk <vb@pep-project.org>
Fri, 17 May 2019 17:59:06 +0200
branchsync
changeset 3720 9ed76a79d784
parent 3442 2afeb1f359fe
child 3710 d7c1395f473c
permissions -rw-r--r--
...
     1 // This file is under GNU General Public License 3.0
     2 // see LICENSE.txt
     3 
     4 #define _EXPORT_PEP_ENGINE_DLL
     5 #include "mime.h"
     6 
     7 #include <string.h>
     8 #include <stdlib.h>
     9 #include <assert.h>
    10 #include <errno.h>
    11 
    12 static bool is_whitespace(char c)
    13 {
    14     switch (c) {
    15         case ' ':
    16         case '\t':
    17         case '\r':
    18         case '\n':
    19             return true;
    20 
    21         default:
    22             return false;
    23     }
    24 }
    25 
    26 DYNAMIC_API bool is_PGP_message_text(const char *text)
    27 {
    28     if (text == NULL)
    29         return false;
    30 
    31     for (; *text && is_whitespace(*text); text++);
    32 
    33     return strncmp(text, "-----BEGIN PGP MESSAGE-----", 27) == 0;
    34 }
    35 
    36 DYNAMIC_API PEP_STATUS mime_encode_message(
    37         const message * msg,
    38         bool omit_fields,
    39         char **mimetext
    40     )
    41 {
    42     return _mime_encode_message_internal(msg, omit_fields, mimetext, true);
    43 }
    44