/*
* 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
* 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 <stdlib.h>
const char *HKey;
void *vData;
pop3aggr *RecvMsg = (pop3aggr *) IO->Data;
+ time_t seenstamp = 0;
SetPOP3State(IO, eUseTable);
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;
SetPOP3State(IO, eGetMsg);
+ EVP3CM_syslog(LOG_DEBUG, "fast forwarding to the next unknown message");
+
RecvMsg->CurrMsg = NULL;
while ((RecvMsg->Pos != NULL) &&
GetNextHashPos(RecvMsg->MsgNumbers,
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,
return eReadMessage;
}
else {
+ EVP3CM_syslog(LOG_DEBUG, "no more messages to fetch.");
RecvMsg->State = ReadQuitState;
return POP3_C_DispatchWriteDone(&RecvMsg->IO);
}
if (!POP3C_OK) return eTerminateConnection;
RecvMsg->IO.ReadMsg = NewAsyncMsg(HKEY("."),
RecvMsg->CurrMsg->MSGSize,
- config.c_maxmsglen,
+ CtdlGetConfigLong("c_maxmsglen"),
NULL, -1,
1);
AsyncIO *IO = &RecvMsg->IO;
POP3C_DBG_READ();
RecvMsg->State = GetOneMessageIDState;
- return eReadMessage;
+ return POP3_C_DispatchWriteDone(&RecvMsg->IO);
}
eNextState POP3C_SendQuit(pop3aggr *RecvMsg)
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
/*
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;