static struct idlist *scratchlist;
#ifdef POP3_ENABLE
+/** Read saved IDs from \a idfile and attach to each host in \a hostlist. */
void initialize_saved_lists(struct query *hostlist, const char *idfile)
-/* read file of saved IDs and attach to each host */
{
struct stat statbuf;
FILE *tmpfp;
}
#endif /* POP3_ENABLE */
-/* return a pointer to the last element of the list to help the quick,
- * constant-time addition to the list, NOTE: this function does not dup
- * the string, the caller must do that. */
-/*@shared@*/ static struct idlist **save_str_quick(/*@shared@*/ struct idlist **idl,
- /*@only@*/ char *str, flag status)
+/** Save string \a str to idlist \a idl with status \a status.
+ * \return Pointer to the last element of the list to help the quick,
+ * constant-time addition to the list. */
+/*@shared@*/ static
+struct idlist **save_str_quick(/*@shared@*/ struct idlist **idl,
+ /*@only@*/ char *str /** caller-allocated string */, flag status)
/* save a number/UID pair on the given UID list */
{
struct idlist **end;
return end;
}
-/* return the end list element for direct modification */
-struct idlist *save_str(struct idlist **idl, const char *str, flag st)
+/** Save string \a str to idlist \a idl with status \a status.
+ * \return the end list element for direct modification. */
+struct idlist *save_str(struct idlist **idl, const char *str /** implicitly strdup()ed */, flag status)
{
- return *save_str_quick(idl, str ? xstrdup(str) : NULL, st);
+ return *save_str_quick(idl, str ? xstrdup(str) : NULL, status);
}
+/** Free string list \a idl and free each of the id members. */
void free_str_list(struct idlist **idl)
-/* free the given UID list */
{
struct idlist *i = *idl;
*idl = 0;
}
+/** Save an ID pair made of \a str1 and \a str2 on the given idlist \a idl. */
void save_str_pair(struct idlist **idl, const char *str1, const char *str2)
-/* save an ID pair on the given list */
{
struct idlist **end;
}
#endif
-struct idlist *str_in_list(struct idlist **idl, const char *str, const flag caseblind)
-/* is a given ID in the given list? (comparison may be caseblind) */
+/** Check if ID \a str is in idlist \a idl. \return idlist entry if found,
+ * NULL if not found. */
+struct idlist *str_in_list(struct idlist **idl, const char *str,
+const flag caseblind /** if true, use strcasecmp, if false, use strcmp */)
{
struct idlist *walk;
if (caseblind) {
return NULL;
}
-/** return the position of first occurrence of \a str in \a idl */
+/** \return position of first occurrence of \a str in idlist \a idl */
int str_nr_in_list(struct idlist **idl, const char *str)
{
int nr;
return -1;
}
+/** \return position of last occurrence of \a str in idlist \a idl */
int str_nr_last_in_list( struct idlist **idl, const char *str)
-/* return the last position of str in idl */
{
int nr, ret = -1;
struct idlist *walk;
return ret;
}
+/** Update the mark of an id \a str in idlist \a idl to given value \a val. */
void str_set_mark( struct idlist **idl, const char *str, const flag val)
-/* update the mark on an of an id to given value */
{
int nr;
struct idlist *walk;
walk->val.status.mark = val;
}
+/** Count the number of elements in the idlist \a idl.
+ * \return number of elements */
int count_list( struct idlist **idl)
-/* count the number of elements in the list */
{
if( !*idl )
return 0;
return 1 + count_list( &(*idl)->next );
}
+/** return the \a number'th id string on idlist \a idl */
/*@null@*/ char *str_from_nr_list(struct idlist **idl, long number)
-/* return the number'th string in idl */
{
if( !*idl || number < 0)
return 0;
}
+/** Search idlist \a idl for entry with given \a number.
+ * \return id member of idlist entry. */
char *str_find(struct idlist **idl, long number)
-/* return the id of the given number in the given list. */
{
if (*idl == (struct idlist *) 0)
return((char *) 0);
return(str_find(&(*idl)->next, number));
}
+/** Search idlist \a idl for entry with given \a number.
+ * \return idlist entry. */
struct idlist *id_find(struct idlist **idl, long number)
-/* return the id of the given number in the given list. */
{
struct idlist *idp;
for (idp = *idl; idp; idp = idp->next)
return(0);
}
+/** Return the id of the given \a id in the given idlist \a idl, comparing
+ * case insensitively. \returns the respective other \a idlist member (the one
+ * that was not searched for). */
char *idpair_find(struct idlist **idl, const char *id)
-/* return the id of the given id in the given list (caseblind comparison) */
{
if (*idl == (struct idlist *) 0)
return((char *) 0);
return(idpair_find(&(*idl)->next, id));
}
+/** Mark message number \a num on given idlist \a idl as deleted.
+ * \return 1 if found, 0 if not found. */
int delete_str(struct idlist **idl, long num)
-/* delete given message from given list */
{
struct idlist *idp;
return(0);
}
+/** Copy the given UID list \a idl. \return A newly malloc()ed copy of the list. */
struct idlist *copy_str_list(struct idlist *idl)
-/* copy the given UID list */
{
struct idlist *newnode ;
}
}
+/** Append \a nidl to \a idl (does not copy *) */
void append_str_list(struct idlist **idl, struct idlist **nidl)
-/* append nidl to idl (does not copy *) */
{
if ((*nidl) == (struct idlist *)NULL || *nidl == *idl)
return;
}
#ifdef POP3_ENABLE
+/** Assert that all UIDs marked deleted in query \a ctl have actually been
+expunged. */
void expunge_uids(struct query *ctl)
-/* assert that all UIDs marked deleted have actually been expunged */
{
struct idlist *idl;
idl->val.status.mark = UID_EXPUNGED;
}
-void uid_swap_lists(struct query *ctl)
/* finish a query */
+void uid_swap_lists(struct query *ctl)
{
/* debugging code */
if (ctl->server.uidl && outlevel >= O_DEBUG)
report(stdout, GT_("not swapping UID lists, no UIDs seen this query\n"));
}
-void uid_discard_new_list(struct query *ctl)
/* finish a query which had errors */
+void uid_discard_new_list(struct query *ctl)
{
/* debugging code */
if (ctl->server.uidl && outlevel >= O_DEBUG)
}
}
+/** Reset the number associated with each id */
void uid_reset_num(struct query *ctl)
-/* reset the number associated with each id */
{
struct idlist *idp;
for (idp = ctl->oldsaved; idp; idp = idp->next)
idp->val.status.num = 0;
}
+/** Write list of seen messages, at end of run. */
void write_saved_lists(struct query *hostlist, const char *idfile)
-/* perform end-of-run write of seen-messages list */
{
long idcount;
FILE *tmpfp;