* considered seen in `oldsaved'. These are messages that were left in
* the mailbox and *not deleted* on previous queries (we don't need to
* remember the UIDs of deleted messages because ... well, they're gone!)
- * This list is initially set up by initialized_saved_list() from the
+ * This list is initially set up by initialize_saved_list() from the
* .fetchids file.
*
* Early in the query, during the execution of the protocol-specific
* be picked up by the next run. If there are no un-expunged
* messages, the file is deleted.
*
- * Note: all comparisons are caseblind!
+ * Note: some comparisons (those used for DNS address lists) are caseblind!
*/
/* UIDs associated with un-queried hosts */
/* make sure lists are initially empty */
for (ctl = hostlist; ctl; ctl = ctl->next)
- ctl->oldsaved = ctl->newsaved = (struct idlist *)NULL;
+ ctl->skipped = ctl->oldsaved = ctl->newsaved = (struct idlist *)NULL;
/* let's get stored message UIDs from previous queries */
if ((tmpfp = fopen(idfile, "r")) != (FILE *)NULL) {
strcasecmp(host, ctl->server.truename) == 0
&& strcasecmp(user, ctl->remotename) == 0)
{
- save_str(&ctl->oldsaved, id, UID_UNSEEN);
+ save_str(&ctl->oldsaved, id, UID_SEEN);
break;
}
}
}
fclose(tmpfp);
}
+
+ if (outlevel >= O_DEBUG)
+ {
+ struct idlist *idp;
+
+ for (ctl = hostlist; ctl; ctl = ctl->next)
+ {
+ report(stdout, "Old UID list from %s:", ctl->server.truename);
+ for (idp = ctl->oldsaved; idp; idp = idp->next)
+ report(stdout, " %s", idp->id);
+ if (!idp)
+ report(stdout, "<empty>");
+ report(stdout, "\n");
+ }
+
+ report(stdout, "Scratch list of UIDs:");
+ for (idp = scratchlist; idp; idp = idp->next)
+ report(stdout, " %s", idp->id);
+ if (!idp)
+ report(stdout, "<empty>");
+ report(stdout, "\n");
+ }
}
#endif /* POP3_ENABLE */
}
#endif
-int str_in_list(struct idlist **idl, const char *str)
-/* is a given ID in the given list? (comparison is caseblind) */
+int str_in_list(struct idlist **idl, const char *str, const flag caseblind)
+/* is a given ID in the given list? (comparison may be caseblind) */
{
if (*idl == (struct idlist *)NULL || str == (char *) NULL)
return(0);
- else if (strcasecmp(str, (*idl)->id) == 0)
+ else if (!caseblind && strcmp(str, (*idl)->id) == 0)
+ return(1);
+ else if (caseblind && strcasecmp(str, (*idl)->id) == 0)
return(1);
else
- return(str_in_list(&(*idl)->next, str));
+ return(str_in_list(&(*idl)->next, str, caseblind));
}
int str_nr_in_list( struct idlist **idl, const char *str )
if ( !str )
return -1;
for( walk = *idl, nr = 0; walk; nr ++, walk = walk->next )
- if( strcasecmp( str, walk->id) == 0 )
+ if( strcmp( str, walk->id) == 0 )
return nr;
return -1;
}
if ( !str )
return -1;
for( walk = *idl, nr = 0; walk; nr ++, walk = walk->next )
- if( strcasecmp( str, walk->id) == 0 )
+ if( strcmp( str, walk->id) == 0 )
ret = nr;
return ret;
}
if (!str)
return;
for(walk = *idl, nr = 0; walk; nr ++, walk = walk->next)
- if (strcasecmp(str, walk->id) == 0)
+ if (strcmp(str, walk->id) == 0)
walk->val.status.mark = val;
}
free_str_list(&ctl->oldsaved);
ctl->oldsaved = ctl->newsaved;
ctl->newsaved = (struct idlist *) NULL;
+
+ if (outlevel >= O_DEBUG)
+ {
+ struct idlist *idp;
+
+ report(stdout, "New UID list from %s:", ctl->server.truename);
+ for (idp = ctl->oldsaved; idp; idp = idp->next)
+ report(stdout, " %s = %d", idp->id, idp->val.status.mark);
+ if (!idp)
+ report(stdout, "<empty>");
+ report(stdout, "\n");
+ }
}
void write_saved_lists(struct query *hostlist, const char *idfile)
/* either nuke the file or write updated last-seen IDs */
if (!idcount)
+ {
+ if (outlevel >= O_DEBUG)
+ report(stdout, "Deleting fetchids file.");
unlink(idfile);
+ }
else
if ((tmpfp = fopen(idfile, "w")) != (FILE *)NULL) {
for (ctl = hostlist; ctl; ctl = ctl->next) {