#warning "Add a better base class function to get counts specific to normal/vee folder."
if (unread == -1) {
- int j;
- CamelMessageInfo *info;
if (!CAMEL_IS_VEE_FOLDER (folder)) {
/* TODO: Locking? */
}
+static void
+update_summary (CamelMessageInfoBase *info)
+{
+ int unread=0, deleted=0, junk=0;
+ guint32 flags = info->flags;
+
+ d(printf("Updating summary of %s\n", info->summary->folder->full_name));
+ if (flags & CAMEL_MESSAGE_SEEN)
+ unread = 1;
+
+ if (flags & CAMEL_MESSAGE_DELETED)
+ deleted = 1;
+
+ if (flags & CAMEL_MESSAGE_JUNK)
+ junk = 1;
+
+ info->flags |= CAMEL_MESSAGE_FOLDER_FLAGGED;
+ info->dirty = TRUE;
+
+ if (info->summary) {
+ camel_folder_summary_touch(info->summary);
+
+ if (unread)
+ info->summary->unread_count += unread;
+ if (deleted)
+ info->summary->deleted_count += deleted;
+ if (junk)
+ info->summary->junk_count += junk;
+ if (junk && !deleted)
+ info->summary->junk_not_deleted_count += junk;
+ if (junk || deleted)
+ info->summary->visible_count -= junk ? junk : deleted;
+ info->summary->saved_count++;
+
+ }
+}
/**
* camel_folder_append_message:
g_return_if_fail (CAMEL_IS_FOLDER (folder));
CAMEL_FOLDER_REC_LOCK(folder, lock);
-
CF_CLASS (folder)->append_message (folder, message, info, appended_uid, ex);
-
CAMEL_FOLDER_REC_UNLOCK(folder, lock);
}
vuid = g_malloc(strlen(uid)+9);
memcpy(vuid, hash, 8);
strcpy(vuid+8, uid);
- g_ptr_array_add(result, camel_pstring_strdup(vuid));
+ g_ptr_array_add(result, (gpointer) camel_pstring_strdup(vuid));
g_free (vuid);
}
camel_folder_search_free(f, matches);
camel_folder_free_summary (folder, infos);
CAMEL_VEE_FOLDER_UNLOCK(folder, subfolder_lock);
- g_ptr_array_foreach (uids, camel_pstring_free, NULL);
+ g_ptr_array_foreach (uids, (GFunc) camel_pstring_free, NULL);
g_ptr_array_free(uids, TRUE);
return result;
vuid = g_malloc(strlen(uid)+9);
memcpy(vuid, hash, 8);
strcpy(vuid+8, uid);
- g_ptr_array_add(result, camel_pstring_strdup(vuid));
+ g_ptr_array_add(result, (gpointer) camel_pstring_strdup(vuid));
g_free (vuid);
}
camel_folder_search_free(f, matches);
vinfo = (CamelVeeMessageInfo *)camel_folder_summary_uid(((CamelFolder *)vf)->summary, vuid);
if (vinfo == NULL) {
CamelMessageInfo *tinfo;
- tinfo = camel_vee_summary_add((CamelVeeSummary *)((CamelFolder *)vf)->summary, ssummary, uid, hash);
+ tinfo = (CamelMessageInfo *) camel_vee_summary_add((CamelVeeSummary *)((CamelFolder *)vf)->summary, ssummary, uid, hash);
if (tinfo) {
camel_folder_change_info_add_uid(((CamelVeeFolder *)vf)->changes, vuid);
camel_message_info_free (tinfo);
}
for (i=0;i<infos->len;i++) {
- CamelMessageInfo *info;
char *uid = infos->pdata[i];
vtrash_uid_added((CamelVTrashFolder *)vf, uid, sub->summary, hash);
}
- g_ptr_array_foreach (infos, camel_pstring_free, NULL);
+ g_ptr_array_foreach (infos, (GFunc) camel_pstring_free, NULL);
g_ptr_array_free (infos, TRUE);
if (camel_folder_change_info_changed(vf->changes)) {