diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2001-06-18 16:29:03 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2001-06-18 16:29:03 +0000 |
commit | 5f489f143b88042e8e25a0727f468337fc0d34c4 (patch) | |
tree | a016f0e9327a44215a7dc70eeafc3bc2332916cc /driver.c | |
parent | 62b09af0022536f1f54eeeaf46a185ba4bf19d69 (diff) | |
download | fetchmail-5f489f143b88042e8e25a0727f468337fc0d34c4.tar.gz fetchmail-5f489f143b88042e8e25a0727f468337fc0d34c4.tar.bz2 fetchmail-5f489f143b88042e8e25a0727f468337fc0d34c4.zip |
Oversized-marking fix.
svn path=/trunk/; revision=3357
Diffstat (limited to 'driver.c')
-rw-r--r-- | driver.c | 96 |
1 files changed, 47 insertions, 49 deletions
@@ -319,6 +319,51 @@ static void send_size_warnings(struct query *ctl) close_warning_by_mail(ctl, (struct msgblk *)NULL); } +static void mark_oversized(int num, struct query *ctl, int *msgsizes) +/* mark a message oversized */ +{ + struct idlist *current=NULL, *tmp=NULL; + char size[32]; + int cnt; + + /* convert sz to string */ + sprintf(size, "%d", msgsizes[num-1]); + + /* build a list of skipped messages + * val.id = size of msg (string cnvt) + * val.status.num = warning_poll_count + * val.status.mask = nbr of msg this size + */ + + current = ctl->skipped; + + /* initialise warning_poll_count to the + * current value so that all new msg will + * be included in the next mail + */ + cnt = current ? current->val.status.num : 0; + + /* if entry exists, increment the count */ + if (current && str_in_list(¤t, size, FALSE)) + { + for ( ; current; current = current->next) + { + if (strcmp(current->id, size) == 0) + { + current->val.status.mark++; + break; + } + } + } + /* otherwise, create a new entry */ + /* initialise with current poll count */ + else + { + tmp = save_str(&ctl->skipped, size, 1); + tmp->val.status.num = cnt; + } +} + static int fetch_messages(int mailserver_socket, struct query *ctl, int count, int *msgsizes, int new, int force, int maxfetch, @@ -326,7 +371,6 @@ static int fetch_messages(int mailserver_socket, struct query *ctl, /* fetch messages in lockstep mode */ { int num, ok, len; - struct idlist *current=NULL, *tmp=NULL; for (num = 1; num <= count; num++) { @@ -359,64 +403,18 @@ static int fetch_messages(int mailserver_socket, struct query *ctl, continue; } - /* - * We may want to reject this message if it's old - * or oversized, and we're not forcing retrieval. - */ if (!fetch_it) { + if (toolarge && !check_only) + mark_oversized(num, ctl, msgsizes); if (outlevel > O_SILENT) { report_build(stdout, _("skipping message %d (%d octets)"), num, msgsizes[num-1]); if (toolarge && !check_only) - { - char size[32]; - int cnt; - - /* convert sz to string */ - sprintf(size, "%d", msgsizes[num-1]); - - /* build a list of skipped messages - * val.id = size of msg (string cnvt) - * val.status.num = warning_poll_count - * val.status.mask = nbr of msg this size - */ - - current = ctl->skipped; - - /* initialise warning_poll_count to the - * current value so that all new msg will - * be included in the next mail - */ - cnt = current ? current->val.status.num : 0; - - /* if entry exists, increment the count */ - if (current && - str_in_list(¤t, size, FALSE)) - { - for ( ; current; - current = current->next) - { - if (strcmp(current->id, size) == 0) - { - current->val.status.mark++; - break; - } - } - } - /* otherwise, create a new entry */ - /* initialise with current poll count */ - else - { - tmp = save_str(&ctl->skipped, size, 1); - tmp->val.status.num = cnt; - } - report_build(stdout, _(" (oversized, %d octets)"), msgsizes[num-1]); - } } } else |