- fix usetable - only mark messages as read if we already wrote them to the db.
- fix aggregation - point to the proper message.
else
{
if (cdbut) cdb_free(cdbut);
else
{
if (cdbut) cdb_free(cdbut);
SEENM_syslog(LOG_DEBUG, "not Found");
SEENM_syslog(LOG_DEBUG, "not Found");
+ if (cType == eCheckUpdate)
+ return 0;
}
if (cType == eCheckExist)
}
if (cType == eCheckExist)
};
typedef enum __eCheckType {
};
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,
}eCheckType;
time_t CheckIfAlreadySeen(const char *Facility,
if (CheckIfAlreadySeen("Networker Import",
msgid,
now, 0,
if (CheckIfAlreadySeen("Networker Import",
msgid,
now, 0,
CCC->cs_pid, 0) != 0)
{
FreeStrBuf(&msgid);
CCC->cs_pid, 0) != 0)
{
FreeStrBuf(&msgid);
const char *HKey;
void *vData;
pop3aggr *RecvMsg = (pop3aggr *) IO->Data;
const char *HKey;
void *vData;
pop3aggr *RecvMsg = (pop3aggr *) IO->Data;
SetPOP3State(IO, eUseTable);
SetPOP3State(IO, eUseTable);
if (server_shutting_down)
return eAbort;
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;
{
/* Item has already been seen */
RecvMsg->CurrMsg->NeedFetch = 0;
SetPOP3State(IO, eGetMsg);
SetPOP3State(IO, eGetMsg);
+ EVP3CM_syslog(LOG_DEBUG, "fast forwarding to the next unknown message");
+
RecvMsg->CurrMsg = NULL;
while ((RecvMsg->Pos != NULL) &&
GetNextHashPos(RecvMsg->MsgNumbers,
RecvMsg->CurrMsg = NULL;
while ((RecvMsg->Pos != NULL) &&
GetNextHashPos(RecvMsg->MsgNumbers,
if ((RecvMsg->CurrMsg != NULL ) && (RecvMsg->CurrMsg->NeedFetch == 1))
{
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,
/* Message has not been seen.
* Tell the server to fetch the message... */
StrBufPrintf(RecvMsg->IO.SendBuf.Buf,
return eReadMessage;
}
else {
return eReadMessage;
}
else {
+ EVP3CM_syslog(LOG_DEBUG, "no more messages to fetch.");
RecvMsg->State = ReadQuitState;
return POP3_C_DispatchWriteDone(&RecvMsg->IO);
}
RecvMsg->State = ReadQuitState;
return POP3_C_DispatchWriteDone(&RecvMsg->IO);
}
AsyncIO *IO = &RecvMsg->IO;
POP3C_DBG_READ();
RecvMsg->State = GetOneMessageIDState;
AsyncIO *IO = &RecvMsg->IO;
POP3C_DBG_READ();
RecvMsg->State = GetOneMessageIDState;
+ return POP3_C_DispatchWriteDone(&RecvMsg->IO);
}
eNextState POP3C_SendQuit(pop3aggr *RecvMsg)
}
eNextState POP3C_SendQuit(pop3aggr *RecvMsg)
guid,
EvGetNow(IO),
EvGetNow(IO) - USETABLE_ANTIEXPIRE,
guid,
EvGetNow(IO),
EvGetNow(IO) - USETABLE_ANTIEXPIRE,