minor fixes

This commit is contained in:
SJ
2011-12-05 17:18:03 +01:00
parent fa52000e8d
commit 67b6b44839
6 changed files with 50 additions and 24 deletions

View File

@ -140,6 +140,9 @@ int store_index_data(struct session_data *sdata, struct _state *state, uint64 id
}
fix_email_address_for_sphinx(state->b_from);
fix_email_address_for_sphinx(state->b_to);
memset(bind, 0, sizeof(bind));

View File

@ -51,8 +51,6 @@ struct _state parse_message(struct session_data *sdata, struct __config *cfg){
trimBuffer(state.b_subject);
fixupEncodedHeaderLine(state.b_subject);
state.message_state = MSG_SUBJECT;
translateLine((unsigned char*)&state.b_subject, &state);
for(i=1; i<=state.n_attachments; i++){

View File

@ -22,6 +22,7 @@ void fixupBase64EncodedLine(char *buf, struct _state *state);
void markHTML(char *buf, struct _state *state);
int appendHTMLTag(char *buf, char *htmlbuf, int pos, struct _state *state);
void translateLine(unsigned char *p, struct _state *state);
void fix_email_address_for_sphinx(char *s);
void reassembleToken(char *p);
void degenerateToken(unsigned char *p);
void fixURL(char *url);

View File

@ -203,15 +203,11 @@ void fixupEncodedHeaderLine(char *buf){
memset(puf, 0, sizeof(puf));
//printf("hdr: *%s*\n", buf);
q = buf;
do {
q = split_str(q, " ", v, sizeof(v)-1);
//printf("v: %s\n", v);
p = v;
do {
@ -219,7 +215,6 @@ void fixupEncodedHeaderLine(char *buf){
if(start){
*start = '\0';
if(strlen(p) > 0){
//printf("flushed, no decode: *%s*\n", p);
strncat(puf, p, sizeof(puf)-1);
}
@ -233,31 +228,24 @@ void fixupEncodedHeaderLine(char *buf){
end = strstr(s+3, "?=");
if(end){
*end = '\0';
//printf("ez az: *%s*\n", s+3);
if(sb){ decodeBase64(s+3); }
if(sq){ decodeQP(s+3); r = s + 3; for(; *r; r++){ if(*r == '_') *r = ' '; } }
//printf("dekodolva: *%s*\n", s+3);
//printf("start: %s\n", start+1);
if(strncasecmp(start+1, "utf-8", 5) == 0) decodeUTF8(s+3);
strncat(puf, s+3, sizeof(puf)-1);
p = end + 2;
//printf("maradek: +%s+\n", p);
}
}
else {
//printf("aaaa: *%s*\n", start);
strncat(puf, start, sizeof(puf)-1);
break;
}
}
else {
//printf("keiene dekod: +%s+\n", p);
strncat(puf, p, sizeof(puf)-1);
break;
}
@ -268,8 +256,6 @@ void fixupEncodedHeaderLine(char *buf){
} while(q);
//printf("=> *%s*\n", puf);
snprintf(buf, MAXBUFSIZE-1, "%s", puf);
}
@ -464,6 +450,13 @@ void translateLine(unsigned char *p, struct _state *state){
}
void fix_email_address_for_sphinx(char *s){
for(; *s; s++){
if(*s == '@' || *s == '.' || *s == '+') *s = 'X';
}
}
/*
* reassemble 'V i a g r a' to 'Viagra'
*/