src/etpan_mime.h
author Dirk Zimmermann <dz@pep.security>
Mon, 19 Oct 2020 16:35:18 +0200
branchIOSAD-182
changeset 5121 e2ca79a3bbf5
parent 4590 448f18d446de
child 4792 7056435ab9e7
permissions -rw-r--r--
IOSAD-182 Xcode: Use sqlite amalgamation from own mirror
     1 // This file is under GNU General Public License 3.0
     2 // see LICENSE.txt
     3 
     4 #pragma once
     5 
     6 #define _EXPORT_PEP_ENGINE_DLL
     7 
     8 #include <libetpan/libetpan.h>
     9 #include <libetpan/mailmime.h>
    10 #include <libetpan/mailmime_encode.h>
    11 
    12 #include "resource_id.h"
    13 #include "stringpair.h"
    14 #include "timestamp.h"
    15 
    16 struct mailmime * part_new_empty(
    17         struct mailmime_content * content,
    18         struct mailmime_fields * mime_fields,
    19         stringpair_list_t* param_keyvals,        
    20         int force_single
    21     );
    22 
    23 struct mailmime * get_pgp_encrypted_part(void);
    24 
    25 struct mailmime * get_text_part(
    26         pEp_rid_list_t* resource,
    27         const char * mime_type,
    28         const char * text,
    29         size_t length,
    30         int encoding_type
    31     );
    32 
    33 struct mailmime * get_file_part(
    34         pEp_rid_list_t* resource,
    35         const char * mime_type,
    36         char * data,
    37         size_t length,
    38         bool set_attachment_forward_comment
    39     );
    40 
    41 struct mailmime * part_multiple_new(const char *type);
    42 
    43 typedef void *(*_new_func_t)(void *);
    44 
    45 struct mailimf_field * _new_field(
    46         int type,
    47         _new_func_t new_func,
    48         void *value
    49     );
    50 
    51 void _free_field(struct mailimf_field *field);
    52 
    53 int _append_field(
    54         clist *list,
    55         int type,
    56         _new_func_t new_func,
    57         void *value
    58     );
    59 
    60 struct mailimf_date_time * timestamp_to_etpantime(const timestamp *ts);
    61 timestamp * etpantime_to_timestamp(const struct mailimf_date_time *et);
    62 
    63 struct mailimf_mailbox * mailbox_from_string(
    64         const char *name,
    65         const char *address
    66     );
    67 
    68 struct mailimf_field * create_optional_field(
    69         const char *field,
    70         const char *value
    71     );
    72 
    73 int _append_optional_field(
    74         clist *list,
    75         const char *field,
    76         const char *value
    77     );
    78 
    79 clist * _get_fields(struct mailmime * mime);
    80 struct mailmime_content * _get_content(struct mailmime * mime);
    81 char * _get_filename_or_cid(struct mailmime *mime);
    82 pEp_rid_list_t* _get_resource_id_list(struct mailmime *mime);
    83 char* _build_uri(char* uri_prefix, char* resource);
    84 bool _is_multipart(struct mailmime_content *content, const char *subtype);
    85 bool _is_PGP_MIME(struct mailmime_content *content);
    86 bool _is_text_part(struct mailmime_content *content, const char *subtype);
    87 bool must_field_value_be_encoded(const char* field_value);
    88 bool must_chunk_be_encoded(const void* value, size_t size, bool ignore_fws);
    89 
    90 
    91 int _get_content_type(
    92         const struct mailmime_content *content,
    93         char **type,
    94         char **charset
    95     );