-/* CACHE: must be loaded xover cache here */
-num = nntp_data->lastCached - first + 1;
-if (option (OPTNEWSCACHE) && nntp_data->cache && num > 0) {
-nntp_cache_expand (buf, nntp_data->cache);
-mutt_message (msg2);
-
-if ((f = safe_fopen (buf, "r"))) {
- int r = 0, c = 0;
-
- /* counting number of lines */
- while (fgets (buf, sizeof (buf), f) != NULL)
- r++;
- rewind (f);
- while (r > num && fgets (buf, sizeof (buf), f) != NULL)
- r--;
- oldmsgcount = ctx->msgcount;
- fc.first = first;
- fc.last = first + num - 1;
- fc.msg = NULL;
- while (fgets (buf, sizeof (buf), f) != NULL) {
- if (ReadInc && ((++c) % ReadInc == 0))
- mutt_message ("%s %d/%d", msg2, c, r);
- add_xover_line (buf, &fc);
+ /* CACHE: must be loaded xover cache here */
+ num = nntp_data->lastCached - first + 1;
+ if (option (OPTNEWSCACHE) && nntp_data->cache && num > 0) {
+ nntp_cache_expand (buf, nntp_data->cache);
+ mutt_message (msg2);
+
+ if ((f = safe_fopen (buf, "r"))) {
+ int r = 0, c = 0;
+
+ /* counting number of lines */
+ while (fgets (buf, sizeof (buf), f) != NULL)
+ r++;
+ rewind (f);
+ while (r > num && fgets (buf, sizeof (buf), f) != NULL)
+ r--;
+ oldmsgcount = ctx->msgcount;
+ fc.first = first;
+ fc.last = first + num - 1;
+ fc.msg = NULL;
+ while (fgets (buf, sizeof (buf), f) != NULL) {
+ if (ReadInc && ((++c) % ReadInc == 0))
+ mutt_message ("%s %d/%d", msg2, c, r);
+ add_xover_line (buf, &fc);
+ }
+ m_fclose(&f);
+ nntp_data->lastLoaded = fc.last;
+ first = fc.last + 1;
+ if (ctx->msgcount > oldmsgcount)
+ mx_update_context (ctx, ctx->msgcount - oldmsgcount);
+ }
+ else
+ nntp_delete_cache (nntp_data);
+ }
+ num = last - first + 1;
+ if (num <= 0) {
+ bits_wipe(&fc.messages);
+ return 0;