src/etpan_mime.h
author Krista Bennett <krista@pep-project.org>
Tue, 01 Aug 2017 16:40:24 +0200
branchmessage-2.0
changeset 1979 3d0a778d035a
parent 1878 aa44c9c98214
child 1892 4ce6a6903bfa
child 2200 644d22d740f0
permissions -rw-r--r--
Changed name to ENGINE-214 for JIRA tracking - please use that branch instead.
     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     );
    34 
    35 struct mailmime * part_multiple_new(const char *type);
    36 
    37 typedef void *(*_new_func_t)(void *);
    38 
    39 struct mailimf_field * _new_field(
    40         int type,
    41         _new_func_t new_func,
    42         void *value
    43     );
    44 
    45 void _free_field(struct mailimf_field *field);
    46 
    47 int _append_field(
    48         clist *list,
    49         int type,
    50         _new_func_t new_func,
    51         void *value
    52     );
    53 
    54 struct mailimf_date_time * timestamp_to_etpantime(const struct tm *ts);
    55 struct tm * etpantime_to_timestamp(const struct mailimf_date_time *et);
    56 
    57 struct mailimf_mailbox * mailbox_from_string(
    58         const char *name,
    59         const char *address
    60     );
    61 
    62 struct mailimf_field * create_optional_field(
    63         const char *field,
    64         const char *value
    65     );
    66 
    67 int _append_optional_field(
    68         clist *list,
    69         const char *field,
    70         const char *value
    71     );
    72 
    73 clist * _get_fields(struct mailmime * mime);
    74 struct mailmime_content * _get_content(struct mailmime * mime);
    75 char * _get_filename_or_cid(struct mailmime *mime);
    76 pEp_rid_list_t* _get_resource_id_list(struct mailmime *mime);
    77 char* _build_uri(char* uri_prefix, char* resource);
    78 bool _is_multipart(struct mailmime_content *content, const char *subtype);
    79 bool _is_PGP_MIME(struct mailmime_content *content);
    80 bool _is_text_part(struct mailmime_content *content, const char *subtype);
    81 
    82 int _get_content_type(
    83         const struct mailmime_content *content,
    84         char **type,
    85         char **charset
    86     );