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