Revision 360 src/mh.c

mh.c (revision 360)
1 1
/*
2 2
 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3
 * Copyright (C) 1999-2003 Hiroyuki Yamamoto
3
 * Copyright (C) 1999-2005 Hiroyuki Yamamoto
4 4
 *
5 5
 * This program is free software; you can redistribute it and/or modify
6 6
 * it under the terms of the GNU General Public License as published by
......
42 42
#include "procmsg.h"
43 43
#include "procheader.h"
44 44
#include "utils.h"
45
#include "prefs_common.h"
45 46

  
46 47
static void	mh_folder_init		(Folder		*folder,
47 48
					 const gchar	*name,
......
210 211
				item->cache_dirty = TRUE;
211 212
		}
212 213
	} else if (use_cache) {
213
		GSList *newlist;
214
		GSList *newlist, *cur, *next;
214 215

  
215
		mlist = procmsg_read_cache(item, TRUE);
216
		mlist = procmsg_read_cache
217
			(item, prefs_common.strict_cache_check);
216 218
		msg_table = procmsg_msg_hash_table_create(mlist);
217 219
		newlist = mh_get_uncached_msgs(msg_table, item);
218 220
		if (newlist)
......
220 222
		if (msg_table)
221 223
			g_hash_table_destroy(msg_table);
222 224

  
225
		if (!prefs_common.strict_cache_check) {
226
			/* remove nonexistent messages */
227
			for (cur = mlist; cur != NULL; cur = next) {
228
				MsgInfo *msginfo = (MsgInfo *)cur->data;
229
				next = cur->next;
230
				if (!MSG_IS_CACHED(msginfo->flags)) {
231
					debug_print("removing nonexistent message %d from cache\n", msginfo->msgnum);
232
					mlist = g_slist_remove(mlist, msginfo);
233
					procmsg_msginfo_free(msginfo);
234
					item->cache_dirty = TRUE;
235
					item->mark_dirty = TRUE;
236
				}
237
			}
238
		}
239

  
223 240
		mlist = g_slist_concat(mlist, newlist);
224 241
	} else {
225 242
		mlist = mh_get_uncached_msgs(NULL, item);
......
987 1004
			msginfo = g_hash_table_lookup
988 1005
				(msg_table, GUINT_TO_POINTER(num));
989 1006

  
990
			if (!msginfo) {
1007
			if (msginfo) {
1008
				MSG_SET_TMP_FLAGS(msginfo->flags, MSG_CACHED);
1009
			} else {
991 1010
				/* not found in the cache (uncached message) */
992 1011
				msginfo = mh_parse_msg(d->d_name, item);
993 1012
				if (!msginfo) continue;

Also available in: Unified diff