message-header-search.c revision 4a6f9ed8e5412508dcba1eabb58a3680ad5e9b68
/* Copyright (C) 2002 Timo Sirainen */
#include "lib.h"
#include "base64.h"
#include "buffer.h"
#include "charset-utf8.h"
#include "quoted-printable.h"
#include "message-parser.h"
#include "message-header-decode.h"
#include "message-header-search.h"
#include <ctype.h>
struct _HeaderSearchContext {
unsigned char *key;
char *key_charset;
unsigned int found:1;
unsigned int last_newline:1;
unsigned int submatch:1;
unsigned int key_ascii:1;
unsigned int unknown_charset:1;
};
int *unknown_charset)
{
const char *p;
/* get the key uppercased */
/* invalid key */
return NULL;
}
if ((*p & 0x80) != 0) {
break;
}
}
return ctx;
}
{
}
{
const char *utf8_data;
if (ctx->unknown_charset) {
/* we don't know the source charset, so assume we want to
match using same charsets */
/* compare with same charset as search key. the key is already
in utf-8 so we can't use charset = NULL comparing. */
}
/* unknown character set, or invalid data */
} else {
}
}
{
ssize_t i;
unsigned char chr;
int last_newline;
match_count /= sizeof(size_t);
if ((chr & 0x80) == 0)
/* we have non-ascii in header and key contains
non-ascii characters. treat the rest of the
header as encoded with the key's charset */
break;
}
}
/* not a long header, reset matches */
match_count = 0;
}
chr = ' ';
}
continue;
for (i = match_count-1; i >= 0; i--) {
/* full match */
return;
}
} else {
/* non-match */
i * sizeof(size_t),
sizeof(size_t));
match_count--;
}
}
/* only one character in search key */
break;
}
value = 1;
match_count++;
}
}
}
{
t_push();
/* need to convert to UTF-8 */
} else {
}
t_pop();
}
{
}
{
}