diff --git a/src/config.h b/src/config.h index c095168e..20d18802 100644 --- a/src/config.h +++ b/src/config.h @@ -13,7 +13,7 @@ #define VERSION "1.2.0" -#define BUILD 953 +#define BUILD 954 #define HOSTID "mailarchiver" @@ -39,6 +39,7 @@ #define BUFLEN 32 #define IPLEN 16+1 #define KEYLEN 56 +#define MIN_EMAIL_ADDRESS_LEN 9 #define CRLF "\n" diff --git a/src/parser.c b/src/parser.c index bc092fcc..fa0e7d10 100644 --- a/src/parser.c +++ b/src/parser.c @@ -707,7 +707,7 @@ int parse_line(char *buf, struct parser_state *state, struct session_data *sdata memcpy(&(state->b_from[strlen(state->b_from)]), puf, len); - if(does_it_seem_like_an_email_address(puf) == 1 && state->b_from_domain[0] == '\0' && len > 5){ + if(len >= MIN_EMAIL_ADDRESS_LEN && does_it_seem_like_an_email_address(puf) == 1 && state->b_from_domain[0] == '\0'){ q = strchr(puf, '@'); if(q && strlen(q) > 5){ memcpy(&(state->b_from_domain), q+1, strlen(q+1)-1); @@ -759,7 +759,7 @@ int parse_line(char *buf, struct parser_state *state, struct session_data *sdata memcpy(&(state->b_to[state->tolen]), puf, len); state->tolen += len; - if(does_it_seem_like_an_email_address(puf) == 1){ + if(len >= MIN_EMAIL_ADDRESS_LEN && does_it_seem_like_an_email_address(puf) == 1){ if(is_email_address_on_my_domains(puf, data) == 1) sdata->internal_recipient = 1; else sdata->external_recipient = 1; @@ -783,6 +783,11 @@ int parse_line(char *buf, struct parser_state *state, struct session_data *sdata } else if(state->message_state == MSG_BODY && len >= cfg->min_word_len && state->bodylen < BIGBUFSIZE-len-1){ + // 99% of email addresses are longer than 8 characters + if(len >= MIN_EMAIL_ADDRESS_LEN && does_it_seem_like_an_email_address(puf)){ + fix_email_address_for_sphinx(puf); + } + memcpy(&(state->b_body[state->bodylen]), puf, len); state->bodylen += len; } diff --git a/src/parser_utils.c b/src/parser_utils.c index 0065e337..fbe5f54c 100644 --- a/src/parser_utils.c +++ b/src/parser_utils.c @@ -623,8 +623,6 @@ void translateLine(unsigned char *p, struct parser_state *state){ if(url == 1) url = 0; } - if(*p == '@') *p = 'X'; - if(delimiter_characters[(unsigned int)*p] != ' ') *p = ' '; /* we MUSTN'T convert it to lowercase in the 'else' case, because it breaks utf-8 encoding! */ diff --git a/src/trans.h b/src/trans.h index 562853fc..f5dee4bb 100644 --- a/src/trans.h +++ b/src/trans.h @@ -9,7 +9,7 @@ static char delimiter_characters[] = { 'x',' ','"','#', ' ','%','&','x', '(',')','*','+', ',',' ',' ','/', ' ',' ',' ',' ', ' ',' ',' ',' ', ' ',' ',':',';', '<','=','>','?', - '@',' ',' ',' ', ' ',' ',' ',' ', ' ',' ',' ',' ', ' ',' ',' ',' ', + ' ',' ',' ',' ', ' ',' ',' ',' ', ' ',' ',' ',' ', ' ',' ',' ',' ', ' ',' ',' ',' ', ' ',' ',' ',' ', ' ',' ',' ','[', '\\',']','^','_', '`',' ',' ',' ', ' ',' ',' ',' ', ' ',' ',' ',' ', ' ',' ',' ',' ', ' ',' ',' ',' ', ' ',' ',' ',' ', ' ',' ',' ','{', '|','}','~','x', diff --git a/webui/controller/search/helper.php b/webui/controller/search/helper.php index 352b9861..ea162c27 100644 --- a/webui/controller/search/helper.php +++ b/webui/controller/search/helper.php @@ -148,20 +148,10 @@ class ControllerSearchHelper extends Controller { $from .= " $v"; } else { - if($prev_token_is_email == 1) { - $prev_token_is_email = 0; - $from .= " $v"; - } - else { - $match .= ' ' . $v; - } + $match .= ' ' . $v; } } - if($match && $match != ' ' . $this->data['text_enter_search_terms']) { - $match = "@(subject,body) $match"; - } - if($from) { $match = $from . ' ' . $match; }