mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-12-25 17:50:13 +01:00
gui import fixes
This commit is contained in:
parent
5dba3241d0
commit
899d97edfa
@ -43,7 +43,7 @@ int connect_to_pop3_server(int sd, char *username, char *password, int port, str
|
|||||||
int process_pop3_emails(int sd, struct session_data *sdata, struct __data *data, int use_ssl, int dryrun, struct __config *cfg);
|
int process_pop3_emails(int sd, struct session_data *sdata, struct __data *data, int use_ssl, int dryrun, struct __config *cfg);
|
||||||
void close_connection(int sd, struct __data *data, int use_ssl);
|
void close_connection(int sd, struct __data *data, int use_ssl);
|
||||||
|
|
||||||
void update_import_job_stat(struct __data *data);
|
void update_import_job_stat(struct session_data *sdata, struct __data *data);
|
||||||
|
|
||||||
|
|
||||||
int import_from_mailbox(char *mailbox, struct session_data *sdata, struct __data *data, struct __config *cfg){
|
int import_from_mailbox(char *mailbox, struct session_data *sdata, struct __data *data, struct __config *cfg){
|
||||||
@ -422,10 +422,16 @@ ENDE:
|
|||||||
|
|
||||||
time(&(data->import->started));
|
time(&(data->import->started));
|
||||||
data->import->status = 1;
|
data->import->status = 1;
|
||||||
update_import_job_stat(data);
|
update_import_job_stat(sdata, data);
|
||||||
|
|
||||||
if(strcmp(s_type, "pop3") == 0){
|
if(strcmp(s_type, "pop3") == 0){
|
||||||
import_from_pop3_server(s_server, s_username, s_password, 110, sdata, data, dryrun, cfg);
|
rc = import_from_pop3_server(s_server, s_username, s_password, 110, sdata, data, dryrun, cfg);
|
||||||
|
|
||||||
|
if(rc == ERR){
|
||||||
|
data->import->status = 3;
|
||||||
|
update_import_job_stat(sdata, data);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
#include <piler.h>
|
#include <piler.h>
|
||||||
|
|
||||||
|
|
||||||
void update_import_job_stat(struct __data *data);
|
void update_import_job_stat(struct session_data *sdata, struct __data *data);
|
||||||
|
|
||||||
|
|
||||||
int is_last_complete_pop3_packet(char *s, int len){
|
int is_last_complete_pop3_packet(char *s, int len){
|
||||||
@ -89,7 +89,7 @@ int connect_to_pop3_server(int sd, char *username, char *password, int port, str
|
|||||||
|
|
||||||
if(strncmp(buf, "+OK", 3) == 0) return OK;
|
if(strncmp(buf, "+OK", 3) == 0) return OK;
|
||||||
|
|
||||||
return OK;
|
return ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -199,7 +199,7 @@ int process_pop3_emails(int sd, struct session_data *sdata, struct __data *data,
|
|||||||
|
|
||||||
if(i % 100 == 0){
|
if(i % 100 == 0){
|
||||||
time(&(data->import->updated));
|
time(&(data->import->updated));
|
||||||
update_import_job_stat(data);
|
update_import_job_stat(sdata, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
unlink(filename);
|
unlink(filename);
|
||||||
@ -213,7 +213,7 @@ int process_pop3_emails(int sd, struct session_data *sdata, struct __data *data,
|
|||||||
|
|
||||||
time(&(data->import->finished));
|
time(&(data->import->finished));
|
||||||
data->import->status = 2;
|
data->import->status = 2;
|
||||||
update_import_job_stat(data);
|
update_import_job_stat(sdata, data);
|
||||||
|
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
|
19
util/import.sh
Normal file
19
util/import.sh
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
|
||||||
|
PRIORITY=mail.error
|
||||||
|
TMPFILE=/var/run/piler/import.tmp
|
||||||
|
|
||||||
|
if [ -f $TMPFILE ]; then exit 1; fi
|
||||||
|
|
||||||
|
date > $TMPFILE
|
||||||
|
|
||||||
|
function finish {
|
||||||
|
rm -f $TMPFILE
|
||||||
|
}
|
||||||
|
|
||||||
|
trap finish EXIT
|
||||||
|
|
||||||
|
pilerimport -G >/dev/null
|
||||||
|
|
||||||
|
|
@ -380,7 +380,8 @@ $actions = array(
|
|||||||
$import_status = array(
|
$import_status = array(
|
||||||
0 => 'PENDING',
|
0 => 'PENDING',
|
||||||
1 => 'RUNNING',
|
1 => 'RUNNING',
|
||||||
2 => 'FINISHED'
|
2 => 'FINISHED',
|
||||||
|
3 => 'ERROR'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user