From 364d5cb8a4341bef50eb3b295e6b67a619fd287a Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Mon, 17 Sep 2007 16:18:50 +0000 Subject: [PATCH] POP3 client is now in development, add -DPOP3_AGGREGATION to enable --- citadel/modules/pop3client/serv_pop3client.c | 43 +++++++++++++++++--- 1 file changed, 38 insertions(+), 5 deletions(-) diff --git a/citadel/modules/pop3client/serv_pop3client.c b/citadel/modules/pop3client/serv_pop3client.c index e260e34da..f6513fc7e 100644 --- a/citadel/modules/pop3client/serv_pop3client.c +++ b/citadel/modules/pop3client/serv_pop3client.c @@ -24,25 +24,58 @@ #include "server.h" #include "citserver.h" #include "support.h" -#include "user_ops.h" -#include "md5.h" +#include "config.h" #include "tools.h" +#include "room_ops.h" #include "ctdl_module.h" -/* +#ifdef POP3_AGGREGATION + +void pop3client_do_room(struct ctdlroom *qrbuf, void *data) +{ + + lprintf(CTDL_DEBUG, "POP3 aggregation for <%s>\n", qrbuf->QRname); + +} + + void pop3client_scan(void) { + static time_t last_run = 0L; + static int doing_pop3client = 0; + + /* + * Run POP3 aggregation no more frequently than once every n seconds + */ + if ( (time(NULL) - last_run) < config.c_net_freq ) { + return; + } + + /* + * This is a simple concurrency check to make sure only one pop3client run + * is done at a time. We could do this with a mutex, but since we + * don't really require extremely fine granularity here, we'll do it + * with a static variable instead. + */ + if (doing_pop3client) return; + doing_pop3client = 1; + lprintf(CTDL_DEBUG, "pop3client started\n"); + ForEachRoom(pop3client_do_room, NULL); lprintf(CTDL_DEBUG, "pop3client ended\n"); + + doing_pop3client = 0; } -*/ +#endif CTDL_MODULE_INIT(pop3client) { - /* CtdlRegisterSessionHook(pop3client_scan, EVT_TIMER); */ +#ifdef POP3_AGGREGATION + CtdlRegisterSessionHook(pop3client_scan, EVT_TIMER); +#endif /* return our Subversion id for the Log */ return "$Id: $"; -- 2.39.2