src/etpan_mime.h
author us@chu.huenfield.org
Tue, 25 Dec 2018 14:46:45 +0100
branchsync
changeset 3209 c15b4ca2b52a
parent 2581 752b9b14e0bc
child 3710 d7c1395f473c
permissions -rw-r--r--
Replace use of Sequoia's backend with a custom key store.

- Sequoia's key store doesn't meet pep's needs (in particular, the
ability to search on a key's user id) and trying to shoehorn pep's
needs onto Sequoia's key store abstractions is just introducing
overhead with no appreciable gain in functionality.

- This patch changes the Sequoia backend to use a local sqlite
database to store the public keys.
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
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
krista@1878
    10
#include "resource_id.h"
krista@1873
    11
vb@48
    12
struct mailmime * part_new_empty(
vb@48
    13
        struct mailmime_content * content,
vb@48
    14
        struct mailmime_fields * mime_fields,
vb@48
    15
        int force_single
vb@48
    16
    );
vb@48
    17
vb@114
    18
struct mailmime * get_pgp_encrypted_part(void);
vb@114
    19
vb@48
    20
struct mailmime * get_text_part(
krista@1878
    21
        pEp_rid_list_t* resource,
vb@48
    22
        const char * mime_type,
vb@48
    23
        const char * text,
vb@48
    24
        size_t length,
vb@48
    25
        int encoding_type
vb@48
    26
    );
vb@48
    27
vb@59
    28
struct mailmime * get_file_part(
krista@1878
    29
        pEp_rid_list_t* resource,
vb@59
    30
        const char * mime_type,
vb@59
    31
        char * data,
krista@2200
    32
        size_t length,
krista@2200
    33
        bool transport_encode
vb@59
    34
    );
vb@59
    35
vb@116
    36
struct mailmime * part_multiple_new(const char *type);
vb@48
    37
vb@89
    38
typedef void *(*_new_func_t)(void *);
vb@89
    39
vb@89
    40
struct mailimf_field * _new_field(
vb@89
    41
        int type,
vb@89
    42
        _new_func_t new_func,
vb@89
    43
        void *value
vb@89
    44
    );
vb@89
    45
vb@89
    46
void _free_field(struct mailimf_field *field);
vb@89
    47
vb@89
    48
int _append_field(
vb@89
    49
        clist *list,
vb@89
    50
        int type,
vb@89
    51
        _new_func_t new_func,
vb@89
    52
        void *value
vb@89
    53
    );
vb@89
    54
vb@89
    55
struct mailimf_date_time * timestamp_to_etpantime(const struct tm *ts);
vb@89
    56
struct tm * etpantime_to_timestamp(const struct mailimf_date_time *et);
vb@89
    57
vb@90
    58
struct mailimf_mailbox * mailbox_from_string(
vb@90
    59
        const char *name,
vb@90
    60
        const char *address
vb@90
    61
    );
vb@90
    62
vb@94
    63
struct mailimf_field * create_optional_field(
vb@94
    64
        const char *field,
vb@94
    65
        const char *value
vb@94
    66
    );
vb@94
    67
vb@94
    68
int _append_optional_field(
vb@94
    69
        clist *list,
vb@94
    70
        const char *field,
vb@94
    71
        const char *value
vb@94
    72
    );
vb@94
    73
vb@147
    74
clist * _get_fields(struct mailmime * mime);
vb@147
    75
struct mailmime_content * _get_content(struct mailmime * mime);
krista@1872
    76
char * _get_filename_or_cid(struct mailmime *mime);
krista@1873
    77
pEp_rid_list_t* _get_resource_id_list(struct mailmime *mime);
krista@1873
    78
char* _build_uri(char* uri_prefix, char* resource);
vb@151
    79
bool _is_multipart(struct mailmime_content *content, const char *subtype);
vb@147
    80
bool _is_PGP_MIME(struct mailmime_content *content);
vb@152
    81
bool _is_text_part(struct mailmime_content *content, const char *subtype);
krista@2562
    82
bool must_field_value_be_encoded(const char* field_value);
krista@2581
    83
bool must_chunk_be_encoded(const void* value, size_t size, bool ignore_fws);
krista@2579
    84
vb@147
    85
vb@159
    86
int _get_content_type(
vb@159
    87
        const struct mailmime_content *content,
vb@159
    88
        char **type,
vb@159
    89
        char **charset
vb@159
    90
    );