Commit 258f98b0 authored by Thomas Roessler's avatar Thomas Roessler

A possible work-around for #939. From Daniel Eisenbud.

parent 838f63aa
......@@ -349,14 +349,10 @@ int imap_fetch_message (MESSAGE *msg, CONTEXT *ctx, int msgno)
* envelope into the old one. Also messy and lowlevel. */
if (ctx->id_hash && h->env->message_id)
hash_delete (ctx->id_hash, h->env->message_id, h, NULL);
if (ctx->subj_hash && h->env->real_subj)
hash_delete (ctx->subj_hash, h->env->real_subj, h, NULL);
mutt_free_envelope (&h->env);
h->env = mutt_read_rfc822_header (msg->fp, h, 0, 0);
if (ctx->id_hash && h->env->message_id)
hash_insert (ctx->id_hash, h->env->message_id, h, 0);
if (ctx->subj_hash && h->env->real_subj)
hash_insert (ctx->subj_hash, h->env->real_subj, h, 1);
/* see above. We want the new status in h->read, so we unset it manually
* and let mutt_set_flag set it correctly, updating context. */
......
......@@ -1082,8 +1082,6 @@ int mutt_reopen_mailbox (CONTEXT *ctx, int *index_hint)
/* simulate a close */
if (ctx->id_hash)
hash_destroy (&ctx->id_hash, NULL);
if (ctx->subj_hash)
hash_destroy (&ctx->subj_hash, NULL);
mutt_clear_threads (ctx);
safe_free ((void **) &ctx->v2r);
if (ctx->readonly)
......@@ -1110,7 +1108,6 @@ int mutt_reopen_mailbox (CONTEXT *ctx, int *index_hint)
ctx->flagged = 0;
ctx->changed = 0;
ctx->id_hash = NULL;
ctx->subj_hash = NULL;
switch (ctx->magic)
{
......
......@@ -746,8 +746,6 @@ void mx_fastclose_mailbox (CONTEXT *ctx)
if (ctx->magic == M_POP)
pop_close_mailbox (ctx);
#endif /* USE_POP */
if (ctx->subj_hash)
hash_destroy (&ctx->subj_hash, NULL);
if (ctx->id_hash)
hash_destroy (&ctx->id_hash, NULL);
mutt_clear_threads (ctx);
......@@ -1091,8 +1089,6 @@ void mx_update_tables(CONTEXT *ctx, int committing)
ctx->hdrs[i]->content->offset -
ctx->hdrs[i]->content->hdr_offset);
/* remove message from the hash tables */
if (ctx->subj_hash && ctx->hdrs[i]->env->real_subj)
hash_delete (ctx->subj_hash, ctx->hdrs[i]->env->real_subj, ctx->hdrs[i], NULL);
if (ctx->id_hash && ctx->hdrs[i]->env->message_id)
hash_delete (ctx->id_hash, ctx->hdrs[i]->env->message_id, ctx->hdrs[i], NULL);
mutt_free_header (&ctx->hdrs[i]);
......@@ -1605,8 +1601,6 @@ void mx_update_context (CONTEXT *ctx, int new_messages)
/* add this message to the hash tables */
if (ctx->id_hash && h->env->message_id)
hash_insert (ctx->id_hash, h->env->message_id, h, 0);
if (ctx->subj_hash && h->env->real_subj)
hash_insert (ctx->subj_hash, h->env->real_subj, h, 1);
if (option (OPTSCORE))
mutt_score_message (ctx, h, 0);
......
......@@ -435,8 +435,9 @@ static void pseudo_threads (CONTEXT *ctx)
THREAD *tree = ctx->tree, *top = tree;
THREAD *tmp, *cur, *parent, *curchild, *nextchild;
if (!ctx->subj_hash)
ctx->subj_hash = mutt_make_subj_hash (ctx);
if (ctx->subj_hash)
hash_destroy (&ctx->subj_hash, NULL);
ctx->subj_hash = mutt_make_subj_hash (ctx);
while (tree)
{
......@@ -504,6 +505,8 @@ void mutt_clear_threads (CONTEXT *ctx)
if (ctx->thread_hash)
hash_destroy (&ctx->thread_hash, *free);
if (ctx->subj_hash)
hash_destroy (&ctx->subj_hash, NULL);
}
int compare_threads (const void *a, const void *b)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment