2 * Aggregate remote POP3 accounts
10 # include <sys/time.h>
14 # include <sys/time.h>
25 #include "citserver.h"
32 #include "ctdl_module.h"
35 #ifdef POP3_AGGREGATION
37 void pop3client_do_room(struct ctdlroom *qrbuf, void *data)
40 lprintf(CTDL_DEBUG, "POP3 aggregation for <%s>\n", qrbuf->QRname);
45 void pop3client_scan(void) {
46 static time_t last_run = 0L;
47 static int doing_pop3client = 0;
50 * Run POP3 aggregation no more frequently than once every n seconds
52 if ( (time(NULL) - last_run) < config.c_net_freq ) {
57 * This is a simple concurrency check to make sure only one pop3client run
58 * is done at a time. We could do this with a mutex, but since we
59 * don't really require extremely fine granularity here, we'll do it
60 * with a static variable instead.
62 if (doing_pop3client) return;
65 lprintf(CTDL_DEBUG, "pop3client started\n");
66 ForEachRoom(pop3client_do_room, NULL);
67 lprintf(CTDL_DEBUG, "pop3client ended\n");
74 CTDL_MODULE_INIT(pop3client)
76 #ifdef POP3_AGGREGATION
77 CtdlRegisterSessionHook(pop3client_scan, EVT_TIMER);
80 /* return our Subversion id for the Log */