diff --git a/src/import.c b/src/import.c index c7a63fac..20d1d7b6 100644 --- a/src/import.c +++ b/src/import.c @@ -125,8 +125,8 @@ int import_message(char *filename, struct session_data *sdata, struct __data *da } -unsigned long get_folder_id(struct session_data *sdata, struct __data *data, char *foldername, int parent_id){ - unsigned long id=0; +int get_folder_id(struct session_data *sdata, struct __data *data, char *foldername, int parent_id){ + int id=-1; if(prepare_sql_statement(sdata, &(data->stmt_get_folder_id), SQL_PREPARED_STMT_GET_FOLDER_ID) == ERR) return id; @@ -149,8 +149,8 @@ unsigned long get_folder_id(struct session_data *sdata, struct __data *data, cha } -unsigned long add_new_folder(struct session_data *sdata, struct __data *data, char *foldername, int parent_id){ - unsigned long id=0; +int add_new_folder(struct session_data *sdata, struct __data *data, char *foldername, int parent_id){ + int id=0; if(prepare_sql_statement(sdata, &(data->stmt_insert_into_folder_table), SQL_PREPARED_STMT_INSERT_INTO_FOLDER_TABLE) == ERR) return id; diff --git a/src/piler.h b/src/piler.h index c1f47d81..b5aa7ecb 100644 --- a/src/piler.h +++ b/src/piler.h @@ -55,8 +55,8 @@ int retrieve_email_from_archive(struct session_data *sdata, struct __data *data, int file_from_archive_to_network(char *filename, int sd, int tls_enable, struct __data *data, struct __config *cfg); int import_message(char *filename, struct session_data *sdata, struct __data *data, struct __config *cfg); -unsigned long get_folder_id(struct session_data *sdata, struct __data *data, char *foldername, int parent_id); -unsigned long add_new_folder(struct session_data *sdata, struct __data *data, char *foldername, int parent_id); +int get_folder_id(struct session_data *sdata, struct __data *data, char *foldername, int parent_id); +int add_new_folder(struct session_data *sdata, struct __data *data, char *foldername, int parent_id); int store_index_data(struct session_data *sdata, struct _state *state, struct __data *data, uint64 id, struct __config *cfg); diff --git a/src/pilerimport.c b/src/pilerimport.c index 2b8cc8c3..be08af54 100644 --- a/src/pilerimport.c +++ b/src/pilerimport.c @@ -543,11 +543,11 @@ int main(int argc, char **argv){ if(folder){ data.folder = get_folder_id(&sdata, &data, folder, 0); - if(data.folder == 0){ + if(data.folder == -1){ data.folder = add_new_folder(&sdata, &data, folder, 0); } - if(data.folder == 0){ + if(data.folder == -1){ printf("error: cannot get/add folder '%s'\n", folder); close_database(&sdata); return 0;