X-Git-Url: https://code.citadel.org/?p=citadel.git;a=blobdiff_plain;f=citadel%2Fmodules%2Fpop3client%2Fserv_pop3client.c;fp=citadel%2Fmodules%2Fpop3client%2Fserv_pop3client.c;h=700c5741983a79d7b7f304ea2973c1d2c71d3875;hp=950436dd8ed65d5eaa4954b5cdbba915efc9af56;hb=9571de81331e169c042c630800bff1bde499c8a9;hpb=c51a64e8f8b42b6efd85f17c91178437d73a9c3d diff --git a/citadel/modules/pop3client/serv_pop3client.c b/citadel/modules/pop3client/serv_pop3client.c index 950436dd8..700c57419 100644 --- a/citadel/modules/pop3client/serv_pop3client.c +++ b/citadel/modules/pop3client/serv_pop3client.c @@ -1,7 +1,7 @@ /* * Consolidate mail from remote POP3 accounts. * - * Copyright (c) 2007-2011 by the citadel.org team + * Copyright (c) 2007-2015 by the citadel.org team * * This program is open source software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -12,10 +12,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include @@ -418,6 +414,7 @@ eNextState POP3_FetchNetworkUsetableEntry(AsyncIO *IO) const char *HKey; void *vData; pop3aggr *RecvMsg = (pop3aggr *) IO->Data; + time_t seenstamp = 0; SetPOP3State(IO, eUseTable); @@ -431,13 +428,15 @@ eNextState POP3_FetchNetworkUsetableEntry(AsyncIO *IO) if (server_shutting_down) return eAbort; - if (CheckIfAlreadySeen("POP3 Item Seen", - RecvMsg->CurrMsg->MsgUID, - EvGetNow(IO), - EvGetNow(IO) - USETABLE_ANTIEXPIRE, - eCheckUpdate, - IO->ID, CCID) - != 0) + RecvMsg->CurrMsg = (FetchItem*)vData; + + seenstamp = CheckIfAlreadySeen("POP3 Item Seen", + RecvMsg->CurrMsg->MsgUID, + EvGetNow(IO), + EvGetNow(IO) - USETABLE_ANTIEXPIRE, + eCheckUpdate, + IO->ID, CCID); + if (seenstamp != 0) { /* Item has already been seen */ RecvMsg->CurrMsg->NeedFetch = 0; @@ -539,6 +538,8 @@ eNextState POP3C_SendGetOneMsg(pop3aggr *RecvMsg) SetPOP3State(IO, eGetMsg); + EVP3CM_syslog(LOG_DEBUG, "fast forwarding to the next unknown message"); + RecvMsg->CurrMsg = NULL; while ((RecvMsg->Pos != NULL) && GetNextHashPos(RecvMsg->MsgNumbers, @@ -551,6 +552,7 @@ eNextState POP3C_SendGetOneMsg(pop3aggr *RecvMsg) if ((RecvMsg->CurrMsg != NULL ) && (RecvMsg->CurrMsg->NeedFetch == 1)) { + EVP3CM_syslog(LOG_DEBUG, "fetching next"); /* Message has not been seen. * Tell the server to fetch the message... */ StrBufPrintf(RecvMsg->IO.SendBuf.Buf, @@ -559,6 +561,7 @@ eNextState POP3C_SendGetOneMsg(pop3aggr *RecvMsg) return eReadMessage; } else { + EVP3CM_syslog(LOG_DEBUG, "no more messages to fetch."); RecvMsg->State = ReadQuitState; return POP3_C_DispatchWriteDone(&RecvMsg->IO); } @@ -572,7 +575,7 @@ eNextState POP3C_ReadMessageBodyFollowing(pop3aggr *RecvMsg) if (!POP3C_OK) return eTerminateConnection; RecvMsg->IO.ReadMsg = NewAsyncMsg(HKEY("."), RecvMsg->CurrMsg->MSGSize, - config.c_maxmsglen, + CtdlGetConfigLong("c_maxmsglen"), NULL, -1, 1); @@ -652,7 +655,7 @@ eNextState POP3C_ReadDeleteState(pop3aggr *RecvMsg) AsyncIO *IO = &RecvMsg->IO; POP3C_DBG_READ(); RecvMsg->State = GetOneMessageIDState; - return eReadMessage; + return POP3_C_DispatchWriteDone(&RecvMsg->IO); } eNextState POP3C_SendQuit(pop3aggr *RecvMsg) @@ -1148,10 +1151,10 @@ void pop3client_scan(void) { become_session(&pop3_client_CC); - if (config.c_pop3_fastest < config.c_pop3_fetch) - fastest_scan = config.c_pop3_fastest; + if (CtdlGetConfigLong("c_pop3_fastest") < CtdlGetConfigLong("c_pop3_fetch")) + fastest_scan = CtdlGetConfigLong("c_pop3_fastest"); else - fastest_scan = config.c_pop3_fetch; + fastest_scan = CtdlGetConfigLong("c_pop3_fetch"); /* * Run POP3 aggregation no more frequently than once every n seconds @@ -1184,7 +1187,7 @@ void pop3client_scan(void) { /* if ((palist->interval && time(NULL) > (last_run + palist->interval)) - || (time(NULL) > last_run + config.c_pop3_fetch)) + || (time(NULL) > last_run + CtdlGetConfigLong("c_pop3_fetch"))) pop3_do_fetching(palist->roomname, palist->pop3host, palist->pop3user, palist->pop3pass, palist->keep); pptr = palist;