};
typedef enum __eCheckType {
- eCheckExist,
- eCheckUpdate,
- eUpdate,
- eWrite
+ eCheckExist, /* look up the item, return the timestamp if its there, 0 if not. */
+ eCheckUpdate, /* if it exists, refresh in db timestamp. return the timstamp if its there, 0 if not. */
+ eUpdate, /* insert/update the new value, return the old if its there, 0 if not. */
+ eWrite /* write this to DB, unconditional. */
}eCheckType;
time_t CheckIfAlreadySeen(const char *Facility,
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);
}
AsyncIO *IO = &RecvMsg->IO;
POP3C_DBG_READ();
RecvMsg->State = GetOneMessageIDState;
- return eReadMessage;
+ return POP3_C_DispatchWriteDone(&RecvMsg->IO);
}
eNextState POP3C_SendQuit(pop3aggr *RecvMsg)