message-header-decode.c revision bc2d4f1c18222a3bd2a6b2b8b5f6abb560a865b3
/* Copyright (C) 2002-2007 Timo Sirainen */
#include "lib.h"
#include "base64.h"
#include "buffer.h"
#include "charset-utf8.h"
#include "quoted-printable.h"
#include "message-header-decode.h"
static size_t
{
#define QCOUNT 3
unsigned int num = 0;
/* data should contain "charset?encoding?text?=" */
for (i = 0; i < size; i++) {
if (data[i] == '?') {
break;
}
}
/* invalid block */
return 0;
}
case 'q':
case 'Q':
break;
case 'b':
case 'B':
/* contains invalid data. show what we got so far. */
}
break;
default:
/* unknown encoding */
return 0;
}
}
void *context)
{
unsigned int charsetlen = 0;
/* =?charset?Q|B?text?= */
t_push();
pos++;
continue;
}
/* encoded string beginning */
/* send the unencoded data so far */
break;
}
}
} else {
}
pos += 2;
decodebuf, &charsetlen);
/* decodebuf contains <charset> NUL <text> */
break;
}
}
}
}
t_pop();
}
struct decode_utf8_context {
unsigned int changed:1;
unsigned int called:1;
unsigned int ucase:1;
};
static bool
{
struct charset_translation *t;
bool unknown_charset;
/* one call with charset=NULL means nothing changed */
else
/* ASCII / UTF-8 */
} else {
}
return TRUE;
}
if (unknown_charset) {
/* let's just ignore this part */
return TRUE;
}
/* ignore any errors */
charset_to_utf8_end(&t);
return TRUE;
}
{
struct decode_utf8_context ctx;
}