src/etpan_mime.h
author Edouard Tisserant <edouard@pep-project.org>
Tue, 06 Jun 2017 18:10:01 +0200
branchENGINE-179
changeset 1826 720922a950e9
parent 1513 e7f7e42385b5
child 1714 a6712af7a964
permissions -rw-r--r--
Closed ENGINE-179 branch
vb@1513
     1
// This file is under GNU General Public License 3.0
vb@1513
     2
// see LICENSE.txt
vb@1513
     3
vb@48
     4
#pragma once
vb@48
     5
vb@48
     6
#include <libetpan/libetpan.h>
vb@94
     7
#include <libetpan/mailmime.h>
vb@94
     8
#include <libetpan/mailmime_encode.h>
vb@48
     9
vb@48
    10
struct mailmime * part_new_empty(
vb@48
    11
        struct mailmime_content * content,
vb@48
    12
        struct mailmime_fields * mime_fields,
vb@48
    13
        int force_single
vb@48
    14
    );
vb@48
    15
vb@114
    16
struct mailmime * get_pgp_encrypted_part(void);
vb@114
    17
vb@48
    18
struct mailmime * get_text_part(
vb@114
    19
        const char * filename,
vb@48
    20
        const char * mime_type,
vb@48
    21
        const char * text,
vb@48
    22
        size_t length,
vb@48
    23
        int encoding_type
vb@48
    24
    );
vb@48
    25
vb@59
    26
struct mailmime * get_file_part(
vb@59
    27
        const char * filename,
vb@59
    28
        const char * mime_type,
vb@59
    29
        char * data,
vb@59
    30
        size_t length
vb@59
    31
    );
vb@59
    32
vb@116
    33
struct mailmime * part_multiple_new(const char *type);
vb@48
    34
vb@89
    35
typedef void *(*_new_func_t)(void *);
vb@89
    36
vb@89
    37
struct mailimf_field * _new_field(
vb@89
    38
        int type,
vb@89
    39
        _new_func_t new_func,
vb@89
    40
        void *value
vb@89
    41
    );
vb@89
    42
vb@89
    43
void _free_field(struct mailimf_field *field);
vb@89
    44
vb@89
    45
int _append_field(
vb@89
    46
        clist *list,
vb@89
    47
        int type,
vb@89
    48
        _new_func_t new_func,
vb@89
    49
        void *value
vb@89
    50
    );
vb@89
    51
vb@89
    52
struct mailimf_date_time * timestamp_to_etpantime(const struct tm *ts);
vb@89
    53
struct tm * etpantime_to_timestamp(const struct mailimf_date_time *et);
vb@89
    54
vb@90
    55
struct mailimf_mailbox * mailbox_from_string(
vb@90
    56
        const char *name,
vb@90
    57
        const char *address
vb@90
    58
    );
vb@90
    59
vb@94
    60
struct mailimf_field * create_optional_field(
vb@94
    61
        const char *field,
vb@94
    62
        const char *value
vb@94
    63
    );
vb@94
    64
vb@94
    65
int _append_optional_field(
vb@94
    66
        clist *list,
vb@94
    67
        const char *field,
vb@94
    68
        const char *value
vb@94
    69
    );
vb@94
    70
vb@147
    71
clist * _get_fields(struct mailmime * mime);
vb@147
    72
struct mailmime_content * _get_content(struct mailmime * mime);
vb@154
    73
char * _get_filename(struct mailmime *mime);
vb@151
    74
bool _is_multipart(struct mailmime_content *content, const char *subtype);
vb@147
    75
bool _is_PGP_MIME(struct mailmime_content *content);
vb@152
    76
bool _is_text_part(struct mailmime_content *content, const char *subtype);
vb@147
    77
vb@159
    78
int _get_content_type(
vb@159
    79
        const struct mailmime_content *content,
vb@159
    80
        char **type,
vb@159
    81
        char **charset
vb@159
    82
    );
vb@159
    83