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