aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>1999-12-26 14:30:30 +0000
committerEric S. Raymond <esr@thyrsus.com>1999-12-26 14:30:30 +0000
commit17c363ec5e29760a99502afd70769d6a4c7ae63e (patch)
tree8313c91aff4c0e6825327ac9c98f1e78a83a48b4
parent1c34302390ef8d7a3419d1723682a4487796f75c (diff)
downloadfetchmail-17c363ec5e29760a99502afd70769d6a4c7ae63e.tar.gz
fetchmail-17c363ec5e29760a99502afd70769d6a4c7ae63e.tar.bz2
fetchmail-17c363ec5e29760a99502afd70769d6a4c7ae63e.zip
Drastically simplified UIDL code.
svn path=/trunk/; revision=2686
-rw-r--r--NEWS2
-rw-r--r--driver.c1
-rw-r--r--fetchmail.c15
-rw-r--r--fetchmail.h2
-rw-r--r--uid.c32
5 files changed, 15 insertions, 37 deletions
diff --git a/NEWS b/NEWS
index 87f2e148..c3528a9c 100644
--- a/NEWS
+++ b/NEWS
@@ -11,7 +11,7 @@ a Certifying Authority we recognize?).
* Arrange for fetchmail to restart itself quietly when the rc file is touched.
* Improvements to IPv6 code from Jun-ichiro itojun Hagino <itojun@iijlab.net>.
-* Patch to update UIDL lists on a MAXFETCH return, from Ken Estes.
+* Drastic simplification of UIDL code, suggested by Ken Estes.
fetchmail-5.2.1 (Sun Dec 19 23:08:53 EST 1999), 18330 lines:
* Added FAQ item R10 on timeouts during messages.
diff --git a/driver.c b/driver.c
index 543bac78..b1cb6843 100644
--- a/driver.c
+++ b/driver.c
@@ -2146,7 +2146,6 @@ const int maxfetch; /* maximum number of messages to fetch */
{
report(stdout, _("fetchlimit %d reached; %d messages left on server\n"),
maxfetch, count - fetches);
- uid_expunge(ctl);
ok = PS_MAXFETCH;
goto cleanUp;
}
diff --git a/fetchmail.c b/fetchmail.c
index 08d051af..570238b1 100644
--- a/fetchmail.c
+++ b/fetchmail.c
@@ -627,17 +627,12 @@ int main(int argc, char **argv)
querystatus = query_host(ctl);
#ifdef POP3_ENABLE
- /* Save UID list to prevent re-fetch in cases fetchmail
- recover from crash */
if (!check_only)
- if ((querystatus==PS_SUCCESS)||(querystatus==PS_MAXFETCH))
- {
- update_str_lists(ctl);
-
- write_saved_lists(querylist, run.idfile);
- if (outlevel >= O_DEBUG)
- report(stdout, _("saved UID List\n"));
- }
+ {
+ write_saved_lists(querylist, run.idfile);
+ if (outlevel >= O_DEBUG)
+ report(stdout, _("saved UID lists\n"));
+ }
#endif /* POP3_ENABLE */
if (querystatus == PS_SUCCESS)
diff --git a/fetchmail.h b/fetchmail.h
index 2a4f7af2..c98c18ea 100644
--- a/fetchmail.h
+++ b/fetchmail.h
@@ -433,8 +433,6 @@ char *str_find(struct idlist **, int);
char *idpair_find(struct idlist **, const char *);
void append_str_list(struct idlist **, struct idlist **);
void expunge_uids(struct query *);
-void update_str_lists(struct query *);
-void uid_expunge(struct query *);
void write_saved_lists(struct query *, const char *);
/* rcfile_y.y */
diff --git a/uid.c b/uid.c
index c7f007e4..6bf4bf10 100644
--- a/uid.c
+++ b/uid.c
@@ -368,14 +368,21 @@ void expunge_uids(struct query *ctl)
idl->val.status.mark = UID_EXPUNGED;
}
-void update_str_lists(struct query *ctl)
-/* perform end-of-query actions on UID lists */
+void write_saved_lists(struct query *hostlist, const char *idfile)
+/* perform end-of-run write of seen-messages list */
{
+ int idcount;
+ FILE *tmpfp;
+ struct query *ctl;
+ struct idlist *idp;
+
+ /* old state of mailbox is now irrelevant */
free_str_list(&ctl->oldsaved);
free_str_list(&scratchlist);
ctl->oldsaved = ctl->newsaved;
ctl->newsaved = (struct idlist *) NULL;
+ /* debugging code */
if (ctl->server.uidl && outlevel >= O_DEBUG)
{
struct idlist *idp;
@@ -387,27 +394,6 @@ void update_str_lists(struct query *ctl)
report_build(stdout, " <empty>");
report_complete(stdout, "\n");
}
-}
-
-void uid_expunge(struct query *ctl)
-/* transfer seen UIDs from newsaved to oldsaved
- to simulate writing anad rereading .fetchids */
-{
- struct idlist *i;
-
- for (i = ctl->newsaved; i; i = i->next)
- if (i->val.status.mark == UID_SEEN &&
- !str_in_list(&ctl->oldsaved, i->id, FALSE))
- save_str(&ctl->oldsaved, i->id, UID_SEEN);
-}
-
-void write_saved_lists(struct query *hostlist, const char *idfile)
-/* perform end-of-run write of seen-messages list */
-{
- int idcount;
- FILE *tmpfp;
- struct query *ctl;
- struct idlist *idp;
/* if all lists are empty, nuke the file */
idcount = 0;