struct Mailbox *mailbox;
anum_t first;
anum_t last;
- int restore;
+ bool restore;
unsigned char *messages;
struct Progress progress;
#ifdef USE_HCACHE
/**
* nntp_fetch_headers - Fetch headers
- * @param ctx Mailbox
+ * @param m Mailbox
* @param hc Header cache
* @param first Number of first header to fetch
* @param last Number of last header to fetch
* @retval 0 Success
* @retval -1 Failure
*/
-static int nntp_fetch_headers(struct Context *ctx, void *hc, anum_t first,
- anum_t last, int restore)
+static int nntp_fetch_headers(struct Mailbox *m, void *hc, anum_t first,
+ anum_t last, bool restore)
{
- if (!ctx || !ctx->mailbox)
+ if (!m)
return -1;
- struct Mailbox *m = ctx->mailbox;
-
struct NntpMboxData *mdata = m->mdata;
struct FetchCtx fc;
struct Email *e = NULL;
char buf[HUGE_STRING];
int rc = 0;
- int oldmsgcount = m->msg_count;
anum_t current;
anum_t first_over = first;
#ifdef USE_HCACHE
}
}
- if (m->msg_count > oldmsgcount)
- mx_update_context(ctx, m->msg_count - oldmsgcount);
-
FREE(&fc.messages);
if (rc != 0)
return -1;
nntp_hcache_update(mdata, hc);
}
#endif
- rc = nntp_fetch_headers(ctx, hc, mdata->last_loaded + 1, mdata->last_message, 0);
+ int old_msg_count = m->msg_count;
+ rc = nntp_fetch_headers(m, hc, mdata->last_loaded + 1, mdata->last_message, false);
m->quiet = quiet;
- if (rc >= 0)
+ if (rc == 0)
+ {
+ if (m->msg_count > old_msg_count)
+ mx_update_context(ctx, m->msg_count > old_msg_count);
mdata->last_loaded = mdata->last_message;
+ }
if (ret == 0 && m->msg_count > oldmsgcount)
ret = MUTT_NEW_MAIL;
}
#ifdef USE_HCACHE
hc = nntp_hcache_open(mdata);
#endif
+ int old_msg_count = m->msg_count;
for (int i = 0; i < cc.num; i++)
{
- rc = nntp_fetch_headers(ctx, hc, cc.child[i], cc.child[i], 1);
+ rc = nntp_fetch_headers(m, hc, cc.child[i], cc.child[i], true);
if (rc < 0)
break;
}
+ if (m->msg_count > old_msg_count)
+ mx_update_context(ctx, m->msg_count > old_msg_count);
+
#ifdef USE_HCACHE
mutt_hcache_close(hc);
#endif
mutt_bit_unset(m->rights, MUTT_ACL_DELETE);
}
nntp_newsrc_close(adata);
- rc = nntp_fetch_headers(ctx, hc, first, mdata->last_message, 0);
+ rc = nntp_fetch_headers(m, hc, first, mdata->last_message, false);
#ifdef USE_HCACHE
mutt_hcache_close(hc);
#endif