int CompressBuffer(StrBuf *Buf);
void StrBufConvert(StrBuf *ConvertBuf, StrBuf *TmpBuf, void *pic);
void ctdl_iconv_open(const char *tocode, const char *fromcode, void *pic);
-void StrBuf_RFC822_to_Utf8(StrBuf *Target, StrBuf *DecodeMe, const StrBuf* DefaultCharset);
+void StrBuf_RFC822_to_Utf8(StrBuf *Target, StrBuf *DecodeMe, const StrBuf* DefaultCharset, StrBuf *FoundCharset);
int StrBufDecodeBase64(StrBuf *Buf);
int StrBufRFC2047encode(StrBuf **target, const StrBuf *source);
#define LB (1) /* Internal escape chars */
char *SegmentStart,
char *SegmentEnd,
StrBuf *ConvertBuf,
- StrBuf *ConvertBuf2)
+ StrBuf *ConvertBuf2,
+ StrBuf *FoundCharset)
{
StrBuf StaticBuf;
char charset[128];
StaticBuf.BufUsed = SegmentEnd - SegmentStart;
StaticBuf.BufSize = DecodeMe->BufSize - (SegmentStart - DecodeMe->buf);
extract_token(charset, SegmentStart, 1, '?', sizeof charset);
+ if (FoundCharset != NULL) {
+ FlushStrBuf(FoundCharset);
+ StrBufAppendBufPlain(FoundCharset, charset, -1, 0);
+ }
extract_token(encoding, SegmentStart, 2, '?', sizeof encoding);
StrBufExtract_token(ConvertBuf, &StaticBuf, 3, '?');
* Handle subjects with RFC2047 encoding such as:
* =?koi8-r?B?78bP0s3Mxc7JxSDXz9rE1dvO2c3JINvB0sHNySDP?=
*/
-void StrBuf_RFC822_to_Utf8(StrBuf *Target, StrBuf *DecodeMe, const StrBuf* DefaultCharset)
+void StrBuf_RFC822_to_Utf8(StrBuf *Target, StrBuf *DecodeMe, const StrBuf* DefaultCharset, StrBuf *FoundCharset)
{
StrBuf *ConvertBuf, *ConvertBuf2;
char *start, *end, *next, *nextend, *ptr;
start,
end,
ConvertBuf,
- ConvertBuf2);
+ ConvertBuf2,
+ FoundCharset);
next = strstr(end, "=?");
nextend = NULL;