aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-mime-utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'camel/camel-mime-utils.c')
-rw-r--r--camel/camel-mime-utils.c39
1 files changed, 37 insertions, 2 deletions
diff --git a/camel/camel-mime-utils.c b/camel/camel-mime-utils.c
index 197ae69058..06bde77f7c 100644
--- a/camel/camel-mime-utils.c
+++ b/camel/camel-mime-utils.c
@@ -2871,6 +2871,40 @@ camel_header_address_decode(const char *in, const char *charset)
return list;
}
+/* this must be kept in sync with the header */
+static const char *encodings[] = {
+ "",
+ "7bit",
+ "8bit",
+ "base64",
+ "quoted-printable",
+ "binary",
+ "x-uuencode",
+};
+
+const char *
+camel_transfer_encoding_to_string (CamelTransferEncoding encoding)
+{
+ if (encoding >= sizeof (encodings) / sizeof (encodings[0]))
+ encoding = 0;
+
+ return encodings[encoding];
+}
+
+CamelTransferEncoding
+camel_transfer_encoding_from_string (const char *string)
+{
+ int i;
+
+ if (string != NULL) {
+ for (i = 0; i < sizeof (encodings) / sizeof (encodings[0]); i++)
+ if (!strcasecmp (string, encodings[i]))
+ return i;
+ }
+
+ return CAMEL_TRANSFER_ENCODING_DEFAULT;
+}
+
void
camel_header_mime_decode(const char *in, int *maj, int *min)
{
@@ -3324,10 +3358,11 @@ camel_content_type_simple (CamelContentType *ct)
}
char *
-camel_header_content_encoding_decode(const char *in)
+camel_content_transfer_encoding_decode (const char *in)
{
if (in)
- return decode_token(&in);
+ return decode_token (&in);
+
return NULL;
}