You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

320 lines
7.0 KiB

7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
  1. /**
  2. * @file etpan_mime.h
  3. * @brief Driver for the libetpan MIME implementation (@see mime.h for the general API)
  4. * @license GNU General Public License 3.0 - see LICENSE.txt
  5. */
  6. #ifndef ETPAN_MIME_H
  7. #define ETPAN_MIME_H
  8. #define _EXPORT_PEP_ENGINE_DLL
  9. #include <libetpan/libetpan.h>
  10. #include <libetpan/mailmime.h>
  11. #include <libetpan/mailmime_encode.h>
  12. #include "resource_id.h"
  13. #include "stringpair.h"
  14. #include "timestamp.h"
  15. /**
  16. * <!-- part_new_empty() -->
  17. *
  18. * @brief TODO
  19. *
  20. * @param[in] content struct mailmime_content*
  21. * @param[in] mime_fields struct mailmime_fields*
  22. * @param[in] param_keyvals stringpair_list_t*
  23. * @param[in] force_single int
  24. *
  25. */
  26. struct mailmime * part_new_empty(
  27. struct mailmime_content * content,
  28. struct mailmime_fields * mime_fields,
  29. stringpair_list_t* param_keyvals,
  30. int force_single
  31. );
  32. /**
  33. * <!-- get_pgp_encrypted_part() -->
  34. *
  35. * @brief TODO
  36. *
  37. *
  38. */
  39. struct mailmime * get_pgp_encrypted_part(void);
  40. /**
  41. * <!-- get_text_part() -->
  42. *
  43. * @brief TODO
  44. *
  45. * @param[in] resource pEp_rid_list_t*
  46. * @param[in] mime_type const char*
  47. * @param[in] text const char*
  48. * @param[in] length size_t
  49. * @param[in] encoding_type int
  50. *
  51. */
  52. struct mailmime * get_text_part(
  53. pEp_rid_list_t* resource,
  54. const char * mime_type,
  55. const char * text,
  56. size_t length,
  57. int encoding_type
  58. );
  59. /**
  60. * <!-- get_file_part() -->
  61. *
  62. * @brief TODO
  63. *
  64. * @param[in] resource pEp_rid_list_t*
  65. * @param[in] mime_type const char*
  66. * @param[in] data char*
  67. * @param[in] length size_t
  68. * @param[in] set_attachment_forward_comment bool
  69. *
  70. */
  71. struct mailmime * get_file_part(
  72. pEp_rid_list_t* resource,
  73. const char * mime_type,
  74. char * data,
  75. size_t length,
  76. bool set_attachment_forward_comment
  77. );
  78. /**
  79. * <!-- part_multiple_new() -->
  80. *
  81. * @brief TODO
  82. *
  83. * @param[in] type const char*
  84. *
  85. */
  86. struct mailmime * part_multiple_new(const char *type);
  87. typedef void *(*_new_func_t)(void *);
  88. /**
  89. * <!-- _new_field() -->
  90. *
  91. * @brief TODO
  92. *
  93. * @param[in] type int
  94. * @param[in] new_func _new_func_t
  95. * @param[in] value void*
  96. *
  97. */
  98. struct mailimf_field * _new_field(
  99. int type,
  100. _new_func_t new_func,
  101. void *value
  102. );
  103. /**
  104. * <!-- _free_field() -->
  105. *
  106. * @brief TODO
  107. *
  108. * @param[in] field struct mailimf_field*
  109. *
  110. */
  111. void _free_field(struct mailimf_field *field);
  112. /**
  113. * <!-- _append_field() -->
  114. *
  115. * @brief TODO
  116. *
  117. * @param[in] list clist*
  118. * @param[in] type int
  119. * @param[in] new_func _new_func_t
  120. * @param[in] value void*
  121. *
  122. */
  123. int _append_field(
  124. clist *list,
  125. int type,
  126. _new_func_t new_func,
  127. void *value
  128. );
  129. /**
  130. * <!-- timestamp_to_etpantime() -->
  131. *
  132. * @brief TODO
  133. *
  134. * @param[in] ts const timestamp*
  135. *
  136. */
  137. struct mailimf_date_time * timestamp_to_etpantime(const timestamp *ts);
  138. /**
  139. * <!-- etpantime_to_timestamp() -->
  140. *
  141. * @brief TODO
  142. *
  143. * @param[in] et const struct mailimf_date_time*
  144. *
  145. */
  146. timestamp * etpantime_to_timestamp(const struct mailimf_date_time *et);
  147. /**
  148. * <!-- mailbox_from_string() -->
  149. *
  150. * @brief TODO
  151. *
  152. * @param[in] name const char**
  153. * @param[in] address const char**
  154. *
  155. */
  156. struct mailimf_mailbox * mailbox_from_string(
  157. const char *name,
  158. const char *address
  159. );
  160. /**
  161. * <!-- create_optional_field() -->
  162. *
  163. * @brief TODO
  164. *
  165. * @param[in] field const char*
  166. * @param[in] value const char*
  167. *
  168. */
  169. struct mailimf_field * create_optional_field(
  170. const char *field,
  171. const char *value
  172. );
  173. /**
  174. * <!-- _append_optional_field() -->
  175. *
  176. * @brief TODO
  177. *
  178. * @param[in] list clist*
  179. * @param[in] field const char*
  180. * @param[in] value const char*
  181. *
  182. */
  183. int _append_optional_field(
  184. clist *list,
  185. const char *field,
  186. const char *value
  187. );
  188. /**
  189. * <!-- _get_fields() -->
  190. *
  191. * @brief TODO
  192. *
  193. * @param[in] mime struct mailmime*
  194. *
  195. */
  196. clist * _get_fields(struct mailmime * mime);
  197. /**
  198. * <!-- _get_content() -->
  199. *
  200. * @brief TODO
  201. *
  202. * @param[in] mime struct mailmime*
  203. *
  204. */
  205. struct mailmime_content * _get_content(struct mailmime * mime);
  206. /**
  207. * <!-- _get_filename_or_cid() -->
  208. *
  209. * @brief TODO
  210. *
  211. * @param[in] mime struct mailmime*
  212. *
  213. */
  214. char * _get_filename_or_cid(struct mailmime *mime);
  215. /**
  216. * <!-- _get_resource_id_list() -->
  217. *
  218. * @brief TODO
  219. *
  220. * @param[in] mime struct mailmime*
  221. *
  222. */
  223. pEp_rid_list_t* _get_resource_id_list(struct mailmime *mime);
  224. /**
  225. * <!-- _build_uri() -->
  226. *
  227. * @brief TODO
  228. *
  229. * @param[in] uri_prefix char*
  230. * @param[in] resource char*
  231. *
  232. */
  233. char* _build_uri(char* uri_prefix, char* resource);
  234. /**
  235. * <!-- _is_multipart() -->
  236. *
  237. * @brief TODO
  238. *
  239. * @param[in] content struct mailmime_content*
  240. * @param[in] subtype const char*
  241. *
  242. */
  243. bool _is_multipart(struct mailmime_content *content, const char *subtype);
  244. /**
  245. * <!-- _is_PGP_MIME() -->
  246. *
  247. * @brief TODO
  248. *
  249. * @param[in] content struct mailmime_content*
  250. *
  251. */
  252. bool _is_PGP_MIME(struct mailmime_content *content);
  253. /**
  254. * <!-- _is_text_part() -->
  255. *
  256. * @brief TODO
  257. *
  258. * @param[in] content struct mailmime_content*
  259. * @param[in] subtype const char*
  260. *
  261. */
  262. bool _is_text_part(struct mailmime_content *content, const char *subtype);
  263. /**
  264. * <!-- must_field_value_be_encoded() -->
  265. *
  266. * @brief TODO
  267. *
  268. * @param[in] field_value const char*
  269. *
  270. */
  271. bool must_field_value_be_encoded(const char* field_value);
  272. /**
  273. * <!-- must_chunk_be_encoded() -->
  274. *
  275. * @brief TODO
  276. *
  277. * @param[in] value const void*
  278. * @param[in] size size_t
  279. * @param[in] ignore_fws bool
  280. *
  281. */
  282. bool must_chunk_be_encoded(const void* value, size_t size, bool ignore_fws);
  283. /**
  284. * <!-- _get_content_type() -->
  285. *
  286. * @brief TODO
  287. *
  288. * @param[in] content const struct mailmime_content*
  289. * @param[in] type char**
  290. * @param[in] charset char**
  291. *
  292. */
  293. int _get_content_type(
  294. const struct mailmime_content *content,
  295. char **type,
  296. char **charset
  297. );
  298. #endif