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