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@101
|
6 |
#include "message.h"
|
vb@48
|
7 |
|
vb@48
|
8 |
#ifdef __cplusplus
|
vb@48
|
9 |
extern "C" {
|
vb@48
|
10 |
#endif
|
vb@48
|
11 |
|
vb@117
|
12 |
// is_PGP_message_text() - determine if text encodes a PGP message
|
vb@117
|
13 |
//
|
vb@117
|
14 |
// parameters:
|
vb@117
|
15 |
// text (in) text to examine
|
vb@117
|
16 |
//
|
vb@117
|
17 |
// return value:
|
vb@117
|
18 |
// true if text is a PGP message, false otherwise
|
vb@117
|
19 |
|
vb@117
|
20 |
DYNAMIC_API bool is_PGP_message_text(const char *text);
|
vb@117
|
21 |
|
vb@117
|
22 |
|
vb@89
|
23 |
// mime_encode_message() - encode a MIME message
|
vb@48
|
24 |
//
|
vb@48
|
25 |
// parameters:
|
vb@89
|
26 |
// msg (in) message to encode
|
vb@113
|
27 |
// omit_fields (in) only encode message body and attachments
|
vb@87
|
28 |
// mimetext (out) the resulting encoded text or NULL on any error
|
vb@48
|
29 |
//
|
vb@48
|
30 |
// return value:
|
vb@48
|
31 |
// PEP_STATUS_OK if everything worked
|
vb@48
|
32 |
// PEP_BUFFER_TOO_SMALL if encoded message size is too big to handle
|
vb@48
|
33 |
// PEP_CANNOT_CREATE_TEMP_FILE
|
vb@48
|
34 |
// if there are issues with temp files; in
|
vb@48
|
35 |
// this case errno will contain the underlying
|
vb@48
|
36 |
// error
|
vb@48
|
37 |
// PEP_OUT_OF_MEMORY if not enough memory could be allocated
|
vb@48
|
38 |
//
|
vb@48
|
39 |
// caveat:
|
vb@89
|
40 |
// the resulttext will go to the ownership of the caller
|
vb@89
|
41 |
// the message will remain in the ownership of the caller
|
vb@113
|
42 |
// omit_fields is true for payload of PGP/MIME messages
|
krista@2155
|
43 |
//
|
krista@2155
|
44 |
// also: note that the encryption type will be used to determine what
|
krista@2155
|
45 |
// gets encoded from the message struct, so if using this on an
|
krista@2155
|
46 |
// already-encrypted message, set the enc_format of the msg to PEP_enc_none.
|
vb@48
|
47 |
|
vb@89
|
48 |
DYNAMIC_API PEP_STATUS mime_encode_message(
|
vb@89
|
49 |
const message * msg,
|
vb@113
|
50 |
bool omit_fields,
|
vb@87
|
51 |
char **mimetext
|
vb@87
|
52 |
);
|
vb@87
|
53 |
|
vb@87
|
54 |
|
vb@89
|
55 |
// mime_decode_message() - decode a MIME message
|
vb@87
|
56 |
//
|
vb@87
|
57 |
// parameters:
|
vb@87
|
58 |
// mimetext (in) MIME encoded text to decode
|
vb@269
|
59 |
// size (in) size of text to decode
|
vb@89
|
60 |
// msg (out) decoded message
|
vb@87
|
61 |
//
|
vb@87
|
62 |
// return value:
|
vb@87
|
63 |
// PEP_STATUS_OK if everything worked
|
vb@87
|
64 |
// PEP_BUFFER_TOO_SMALL if encoded message size is too big to handle
|
vb@87
|
65 |
// PEP_CANNOT_CREATE_TEMP_FILE
|
vb@87
|
66 |
// if there are issues with temp files; in
|
vb@87
|
67 |
// this case errno will contain the underlying
|
vb@87
|
68 |
// error
|
vb@87
|
69 |
// PEP_OUT_OF_MEMORY if not enough memory could be allocated
|
vb@87
|
70 |
//
|
vb@87
|
71 |
// caveat:
|
vb@89
|
72 |
// the decoded message will go to the ownership of the caller; mimetext
|
vb@89
|
73 |
// will remain in the ownership of the caller
|
vb@87
|
74 |
|
vb@89
|
75 |
DYNAMIC_API PEP_STATUS mime_decode_message(
|
vb@87
|
76 |
const char *mimetext,
|
vb@269
|
77 |
size_t size,
|
krista@3710
|
78 |
message **msg,
|
krista@3710
|
79 |
bool* raise_msg_attachment
|
vb@48
|
80 |
);
|
vb@48
|
81 |
|
krista@2200
|
82 |
/* sometimes we don't want to transport encode */
|
krista@2200
|
83 |
PEP_STATUS _mime_encode_message_internal(
|
krista@2200
|
84 |
const message * msg,
|
krista@2200
|
85 |
bool omit_fields,
|
krista@2200
|
86 |
char **mimetext,
|
krista@3710
|
87 |
bool transport_encode,
|
krista@3710
|
88 |
bool set_attachment_forward_comment
|
krista@2200
|
89 |
);
|
krista@2200
|
90 |
|
krista@2200
|
91 |
|
vb@48
|
92 |
#ifdef __cplusplus
|
vb@48
|
93 |
}
|
vb@48
|
94 |
#endif
|