diff --git a/configure b/configure index 3d53286..24b54b1 100755 --- a/configure +++ b/configure @@ -3423,7 +3423,7 @@ id_bin="id" -SUBDIRS="src etc util init.d" +SUBDIRS="src etc util init.d test" @@ -4153,7 +4153,7 @@ LIBS="$antispam_libs $sunos_libs " OBJS="dirs.o base64.o misc.o counters.o cfg.o sig.o decoder.o list.o parser.o parser_utils.o rules.o session.o message.o attachment.o digest.o store.o archive.o tai.o import.o imap.o $objs" -ac_config_files="$ac_config_files Makefile src/Makefile etc/Makefile util/Makefile init.d/Makefile" +ac_config_files="$ac_config_files Makefile src/Makefile etc/Makefile util/Makefile init.d/Makefile test/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -4863,6 +4863,7 @@ "etc/Makefile") CONFIG_FILES="$CONFIG_FILES etc/Makefile" ;; "util/Makefile") CONFIG_FILES="$CONFIG_FILES util/Makefile" ;; "init.d/Makefile") CONFIG_FILES="$CONFIG_FILES init.d/Makefile" ;; + "test/Makefile") CONFIG_FILES="$CONFIG_FILES test/Makefile" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac diff --git a/configure.in b/configure.in index 0862c1a..52b0a0d 100644 --- a/configure.in +++ b/configure.in @@ -51,7 +51,7 @@ id_bin="id" dnl SUBDIRS="src etc util perl init.d templates history contrib/stat" -SUBDIRS="src etc util init.d" +SUBDIRS="src etc util init.d test" dnl static build @@ -276,6 +276,6 @@ LIBS="$antispam_libs $sunos_libs " OBJS="dirs.o base64.o misc.o counters.o cfg.o sig.o decoder.o list.o parser.o parser_utils.o rules.o session.o message.o attachment.o digest.o store.o archive.o tai.o import.o imap.o $objs" -AC_CONFIG_FILES([Makefile src/Makefile etc/Makefile util/Makefile init.d/Makefile]) +AC_CONFIG_FILES([Makefile src/Makefile etc/Makefile util/Makefile init.d/Makefile test/Makefile]) AC_OUTPUT diff --git a/src/config.h b/src/config.h index d848ee3..0d03f42 100644 --- a/src/config.h +++ b/src/config.h @@ -13,7 +13,7 @@ #define VERSION "0.1.19" -#define BUILD 672 +#define BUILD 675 #define HOSTID "mailarchiver" diff --git a/src/parser_utils.c b/src/parser_utils.c index bc4acd7..bfe9b91 100644 --- a/src/parser_utils.c +++ b/src/parser_utils.c @@ -460,6 +460,9 @@ void translateLine(unsigned char *p, struct _state *state){ int url=0; + int has_url = 0; + + if(strcasestr((char *)p, "http://") || strcasestr((char *)p, "https://")) has_url = 1; for(; *p; p++){ @@ -471,11 +474,13 @@ if(*p == '.' || *p == '-'){ continue; } - if(strncasecmp((char *)p, "http://", 7) == 0){ p += 7; url = 1; continue; } - if(strncasecmp((char *)p, "https://", 8) == 0){ p += 8; url = 1; continue; } + if(has_url == 1){ + if(strncasecmp((char *)p, "http://", 7) == 0){ p += 7; url = 1; continue; } + if(strncasecmp((char *)p, "https://", 8) == 0){ p += 8; url = 1; continue; } - if(url == 1 && (*p == '.' || *p == '-' || *p == '_' || *p == '/' || isalnum(*p)) ) continue; - if(url == 1) url = 0; + if(url == 1 && (*p == '.' || *p == '-' || *p == '_' || *p == '/' || isalnum(*p)) ) continue; + if(url == 1) url = 0; + } if(state->texthtml == 1 && state->message_state == MSG_BODY && strncmp((char *)p, "HTML*", 5) == 0){ p += 5; @@ -484,12 +489,8 @@ } } - if(delimiter_characters[(unsigned int)*p] != ' ') - *p = ' '; - else { - // commented out because it breaks utf-8 encoding, 2011.12.07. - //*p = tolower(*p); - } + if(delimiter_characters[(unsigned int)*p] != ' ') *p = ' '; + /* we MUSTN'T convert it to lowercase in the 'else' case, because it breaks utf-8 encoding! */ } @@ -585,8 +586,11 @@ void fixURL(char *url){ + int len=0; char *p, *q, fixed_url[SMALLBUFSIZE]; + if(strlen(url) < 3) return; + memset(fixed_url, 0, sizeof(fixed_url)); p = url; @@ -600,6 +604,12 @@ snprintf(fixed_url, sizeof(fixed_url)-1, "__URL__%s ", p); fix_email_address_for_sphinx(fixed_url+7); + len = strlen(fixed_url); + if(len > 9 && fixed_url[len-2] == 'X'){ + fixed_url[len-2] = ' '; + fixed_url[len-1] = '\0'; + } + strcpy(url, fixed_url); } diff --git a/src/pilerimport.c b/src/pilerimport.c index e83fefb..ac77cef 100644 --- a/src/pilerimport.c +++ b/src/pilerimport.c @@ -168,7 +168,7 @@ int main(int argc, char **argv){ - int i, rc; + int i, rc=0; char *configfile=CONFIG_FILE, *mailbox=NULL, *emlfile=NULL, *directory=NULL; char *imapserver=NULL, *username=NULL, *password=NULL; struct session_data sdata;