aboutsummaryrefslogtreecommitdiffstats
path: root/src/libmime/mime_encoding.h
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-12-28 07:53:42 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-12-28 07:53:42 +0000
commitec439ea252e82a6500bbc589d09599ce8db46fdf (patch)
treea970d922285b990e4a41fc4a656fdbe4a1c18ec6 /src/libmime/mime_encoding.h
parentea9c335c147f399f8be874f7019fc395a71cf902 (diff)
downloadrspamd-ec439ea252e82a6500bbc589d09599ce8db46fdf.tar.gz
rspamd-ec439ea252e82a6500bbc589d09599ce8db46fdf.zip
[Feature] Core: Detect charset in archived files
Diffstat (limited to 'src/libmime/mime_encoding.h')
-rw-r--r--src/libmime/mime_encoding.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/libmime/mime_encoding.h b/src/libmime/mime_encoding.h
index 5f436d99d..1a61339ca 100644
--- a/src/libmime/mime_encoding.h
+++ b/src/libmime/mime_encoding.h
@@ -19,10 +19,12 @@
#include "config.h"
#include "mem_pool.h"
#include "fstring.h"
+#include <unicode/uchar.h>
struct rspamd_task;
struct rspamd_mime_part;
struct rspamd_mime_text_part;
+struct rspamd_charset_converter;
/**
* Convert charset to a valid iconv charset
@@ -87,5 +89,41 @@ gboolean rspamd_mime_charset_utf_check (rspamd_ftok_t *charset,
*/
void rspamd_mime_charset_utf_enforce (gchar *in, gsize len);
+/**
+ * Gets cached converter
+ * @param enc
+ * @param err
+ * @return
+ */
+struct rspamd_charset_converter *rspamd_mime_get_converter_cached (
+ const gchar *enc,
+ UErrorCode *err);
+
+/**
+ * Performs charset->utf16 conversion
+ * @param cnv
+ * @param dest
+ * @param destCapacity
+ * @param src
+ * @param srcLength
+ * @param pErrorCode
+ * @return
+ */
+gint32
+rspamd_converter_to_uchars (struct rspamd_charset_converter *cnv,
+ UChar *dest,
+ gint32 destCapacity,
+ const char *src,
+ gint32 srcLength,
+ UErrorCode *pErrorCode);
+
+/**
+ * Detect charset in text
+ * @param in
+ * @param inlen
+ * @return detected charset name or NULL
+ */
+const char *rspamd_mime_charset_find_by_content (const gchar *in, gsize inlen);
+
#endif /* SRC_LIBMIME_MIME_ENCODING_H_ */