mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-12-25 08:00:12 +01:00
improved parsing of email addresses
This commit is contained in:
parent
87ee036c59
commit
2da754a7de
@ -12,9 +12,9 @@
|
||||
#define PROGNAME "piler"
|
||||
#define PILERGETD_PROGNAME "pilergetd"
|
||||
|
||||
#define VERSION "1.2.0"
|
||||
#define VERSION "1.2.0-master"
|
||||
|
||||
#define BUILD 909
|
||||
#define BUILD 910
|
||||
|
||||
#define HOSTID "mailarchiver"
|
||||
|
||||
@ -89,6 +89,7 @@
|
||||
#define SQL_DOMAIN_TABLE "domain"
|
||||
#define SQL_CUSTOMER_TABLE "customer"
|
||||
#define SQL_IMPORT_TABLE "import"
|
||||
#define SQL_LEGAL_HOLD_TABLE "legal_hold"
|
||||
#define SQL_MESSAGES_VIEW "v_messages"
|
||||
#define SQL_ATTACHMENTS_VIEW "v_attachment"
|
||||
|
||||
|
@ -581,7 +581,8 @@ int appendHTMLTag(char *buf, char *htmlbuf, int pos, struct _state *state){
|
||||
|
||||
void translateLine(unsigned char *p, struct _state *state){
|
||||
int url=0;
|
||||
int has_url = 0;
|
||||
int has_url=0;
|
||||
unsigned char prev=' ';
|
||||
|
||||
if(strcasestr((char *)p, "http://") || strcasestr((char *)p, "https://")) has_url = 1;
|
||||
|
||||
@ -589,7 +590,22 @@ void translateLine(unsigned char *p, struct _state *state){
|
||||
|
||||
if( (state->message_state == MSG_RECEIVED || state->message_state == MSG_FROM || state->message_state == MSG_TO || state->message_state == MSG_CC || state->message_state == MSG_RECIPIENT) && *p == '@'){ continue; }
|
||||
|
||||
if( (state->message_state == MSG_FROM || state->message_state == MSG_TO || state->message_state == MSG_CC || state->message_state == MSG_RECIPIENT) && (*p == '_' || *p == '\'' || *p == '&') ){ continue; }
|
||||
if(state->message_state == MSG_FROM || state->message_state == MSG_TO || state->message_state == MSG_CC || state->message_state == MSG_RECIPIENT){
|
||||
|
||||
/* To fix some unusual addresses, eg.
|
||||
* "'user@domain'" -> user@domain
|
||||
* "''user@domain'" -> 'user@domain
|
||||
* "''user'@domain'" -> 'user'@domain
|
||||
* "'user'@domain'" -> user'@domain
|
||||
*/
|
||||
|
||||
if(*p == '\'' && prev == '"') { *p = ' '; }
|
||||
if(*p == '\'' && *(p+1) == '"'){ *p = ' '; }
|
||||
|
||||
if(*p == '_' || *p == '\'' || *p == '&'){ continue; }
|
||||
|
||||
prev = *p;
|
||||
}
|
||||
|
||||
if(state->message_state == MSG_SUBJECT && (*p == '%' || *p == '_' || *p == '&') ){ continue; }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user