char buf[LONG_STRING];
char tempfile[_POSIX_PATH_MAX];
- mutt_mktemp (tempfile);
+ mutt_mktemp (tempfile, sizeof (tempfile));
if (!(f = safe_fopen (tempfile, "w+")))
{
mutt_perror (tempfile);
}
}
- fclose (f);
+ safe_fclose (&f);
unlink (tempfile);
return ret;
}
*/
static int pop_fetch_headers (CONTEXT *ctx)
{
- int i, ret, old_count, new_count;
+ int i, ret, old_count, new_count, deleted;
unsigned short hcached = 0, bcached;
POP_DATA *pop_data = (POP_DATA *)ctx->data;
progress_t progress;
if (ret == 0)
{
- for (i = 0; i < old_count; i++)
+ for (i = 0, deleted = 0; i < old_count; i++)
+ {
if (ctx->hdrs[i]->refno == -1)
+ {
ctx->hdrs[i]->deleted = 1;
+ deleted++;
+ }
+ }
+ if (deleted > 0)
+ {
+ mutt_error (_("%d messages have been lost. Try reopening the mailbox."),
+ deleted);
+ mutt_sleep (2);
+ }
for (i = old_count; i < new_count; i++)
{
memset (ctx->rights, 0, sizeof (ctx->rights));
mutt_bit_set (ctx->rights, M_ACL_SEEN);
mutt_bit_set (ctx->rights, M_ACL_DELETE);
+#if USE_HCACHE
+ /* flags are managed using header cache, so it only makes sense to
+ * enable them in that case */
+ mutt_bit_set (ctx->rights, M_ACL_WRITE);
+#endif
FOREVER
{
{
/* no */
bcache = 0;
- mutt_mktemp (path);
+ mutt_mktemp (path, sizeof (path));
if (!(msg->fp = safe_fopen (path, "w+")))
{
mutt_perror (path);
for (i = 0, j = 0, ret = 0; ret == 0 && i < ctx->msgcount; i++)
{
- if (ctx->hdrs[i]->deleted)
+ if (ctx->hdrs[i]->deleted && ctx->hdrs[i]->refno != -1)
{
j++;
if (!ctx->quiet)
#endif
}
}
+
+#if USE_HCACHE
+ if (ctx->hdrs[i]->changed)
+ {
+ mutt_hcache_store (hc, ctx->hdrs[i]->data, ctx->hdrs[i], 0, strlen);
+ }
+#endif
+
}
#if USE_HCACHE