/*
* Copyright (C) 2000-2002 Vsevolod Volkov <vvv@mutt.org.ua>
- * Copyright (C) 2006 Rocco Rutte <pdmef@gmx.net>
+ * Copyright (C) 2006-7 Rocco Rutte <pdmef@gmx.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
}
}
- 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
{
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