added reimport option for pilerimport

This commit is contained in:
SJ
2016-04-05 21:10:09 +02:00
parent 67891084e4
commit 65fc0b377e
47 changed files with 314 additions and 208 deletions

View File

@ -30,8 +30,8 @@ struct digest_test tests[] = {
};
void static test_digest_string(){
int i;
static void test_digest_string(){
unsigned int i;
char digest[2*DIGEST_LENGTH+1];
struct digest_test tests[] = {
{"Piler archives every email it receives.", "68bcdb6f15eeabdcedce3e4fc8faf7eb620272ebd55f365d08aca40adf18fe83", ""},
@ -51,7 +51,7 @@ void static test_digest_string(){
static void test_digest_file(){
int i;
unsigned int i;
char digest[2*DIGEST_LENGTH+1];
for(i=0; i<sizeof(tests)/sizeof(struct digest_test); i++){
@ -64,7 +64,8 @@ static void test_digest_file(){
static void test_make_digests(struct __config *cfg){
int i, j;
unsigned int i;
int j;
struct session_data sdata;
struct parser_state state;
struct __data data;

View File

@ -29,7 +29,7 @@ struct emails {
static void fill_domain_table(struct __config *cfg){
int i;
unsigned int i;
char buf[SMALLBUFSIZE];
struct session_data sdata;
@ -50,7 +50,7 @@ static void fill_domain_table(struct __config *cfg){
static void restore_domain_table(struct __config *cfg){
int i;
unsigned int i;
char buf[SMALLBUFSIZE];
struct session_data sdata;
@ -71,7 +71,7 @@ static void restore_domain_table(struct __config *cfg){
static void test_mydomains(struct __config *cfg){
int i;
unsigned int i;
struct session_data sdata;
struct __data data;
struct emails emails[] = {

View File

@ -25,7 +25,8 @@ struct parser_test {
static void test_parser(struct __config *cfg){
int i, j;
unsigned int i;
int j;
struct stat st;
struct session_data sdata;
struct parser_state state;

View File

@ -27,7 +27,10 @@ struct str_pair {
static void test_parse_date_header(){
int i;
unsigned int i;
int dst_fix = 0;
time_t t = time(NULL);
struct tm lt = {0};
struct __config cfg;
struct date_test date_test[] = {
{"Date: Mon, 02 Nov 2015 09:39:31 -0000", 1446457171},
@ -49,8 +52,11 @@ static void test_parse_date_header(){
setlocale(LC_MESSAGES, cfg.locale);
setlocale(LC_CTYPE, cfg.locale);
localtime_r(&t, &lt);
if(lt.tm_isdst == 1) dst_fix = 3600;
for(i=0; i<sizeof(date_test)/sizeof(struct date_test); i++){
assert(parse_date_header(date_test[i].date_str, &cfg) == date_test[i].timestamp && "test_parse_date_header()");
assert(parse_date_header(date_test[i].date_str)-dst_fix == date_test[i].timestamp && "test_parse_date_header()");
}
printf("test_parse_date_header() OK\n");
@ -58,7 +64,7 @@ static void test_parse_date_header(){
static void test_extractNameFromHeaderLine(){
int i;
unsigned int i;
char resultbuf[SMALLBUFSIZE];
struct name_from_header_test name_from_header_test[] = {
{"Content-Type: text/plain; charset=UTF-8", "charset", "UTF-8"},
@ -104,7 +110,7 @@ static void test_extractNameFromHeaderLine(){
static void test_fixupEncodedHeaderLine(){
int i;
unsigned int i;
char buf[SMALLBUFSIZE];
struct str_pair pair[] = {
@ -160,7 +166,7 @@ static void test_fixupEncodedHeaderLine(){
static void test_translateLine(){
int i;
unsigned int i;
char buf[SMALLBUFSIZE];
struct parser_state state;
struct str_pair pair[] = {
@ -197,7 +203,7 @@ static void test_translateLine(){
static void test_fixURL(){
int i;
unsigned int i;
char buf[SMALLBUFSIZE];
struct str_pair pair[] = {
{"http://www.aaa.fu", "__URL__wwwXaaaXfu "},
@ -227,7 +233,7 @@ static void test_fixURL(){
static void test_degenerateToken(){
int i;
unsigned int i;
char buf[SMALLBUFSIZE];
struct str_pair pair[] = {
{"Hello", "Hello"},

View File

@ -35,7 +35,7 @@ struct rule_query rules[] = {
static void fill_rule_table(struct __config *cfg){
int i;
unsigned int i;
struct session_data sdata;
if(open_database(&sdata, cfg) == ERR){
@ -55,7 +55,7 @@ static void fill_rule_table(struct __config *cfg){
static void restore_rule_table(struct __config *cfg){
int i;
unsigned int i;
char buf[SMALLBUFSIZE];
struct session_data sdata;
@ -77,7 +77,8 @@ static void restore_rule_table(struct __config *cfg){
static void test_archiving_rule(struct __config *cfg){
int i, j;
unsigned int i;
int j;
char *rule;
struct session_data sdata;
struct parser_state state;
@ -102,7 +103,7 @@ static void test_archiving_rule(struct __config *cfg){
initrules(data.archiving_rules);
load_rules(&sdata, &data, data.archiving_rules, SQL_ARCHIVING_RULE_TABLE, cfg);
load_rules(&sdata, &data, data.archiving_rules, SQL_ARCHIVING_RULE_TABLE);
for(i=0; i<sizeof(rule_test)/sizeof(struct rule_test); i++){