gchar *folder_id = NULL;
g_return_val_if_fail(item != NULL, NULL);
- g_return_val_if_fail(item->path != NULL, NULL);
+
+ if (item->path == NULL)
+ return NULL;
folder_id = folder_get_identifier(item->folder);
id = g_strconcat(folder_id, "/", item->path, NULL);
continue;
if (folder->inbox == NULL)
continue;
+ if (folder->klass->type == F_UNKNOWN)
+ continue;
return folder->inbox;
}
continue;
if (folder->outbox == NULL)
continue;
+ if (folder->klass->type == F_UNKNOWN)
+ continue;
return folder->outbox;
}
continue;
if (folder->draft == NULL)
continue;
+ if (folder->klass->type == F_UNKNOWN)
+ continue;
return folder->draft;
}
continue;
if (folder->queue == NULL)
continue;
+ if (folder->klass->type == F_UNKNOWN)
+ continue;
return folder->queue;
}
continue;
if (folder->trash == NULL)
continue;
+ if (folder->klass->type == F_UNKNOWN)
+ continue;
return folder->trash;
}
/* Processing */
buf = g_strdup_printf(_("Processing (%s)...\n"),
item->path ? item->path : item->name);
- debug_print("%s\n", buf);
g_free(buf);
if (before_proc_func)
if (after_proc_func)
after_proc_func(data);
- debug_print("done.\n");
item->processing_pending = FALSE;
return;
}
gint folder_item_open(FolderItem *item)
{
- START_TIMING("folder_item_open");
+ START_TIMING("");
if (item->no_select)
return -1;
folder_item_update_freeze();
if (newmsg_list != NULL) {
GSList *elem, *to_filter = NULL;
- int total = g_slist_length(newmsg_list), cur = 0;
-
- if ((filtering == TRUE) &&
- (item->stype == F_INBOX) &&
- (item->folder->account != NULL) &&
- (item->folder->account->filter_on_recv))
- statusbar_print_all(_("Filtering messages...\n"));
+ gboolean do_filter = (filtering == TRUE) &&
+ (item->stype == F_INBOX) &&
+ (item->folder->account != NULL) &&
+ (item->folder->account->filter_on_recv);
for (elem = newmsg_list; elem != NULL; elem = g_slist_next(elem)) {
MsgInfo *msginfo = (MsgInfo *) elem->data;
- statusbar_progress_all(cur++,total, 10);
-
msgcache_add_msg(item->cache, msginfo);
- if ((filtering == TRUE) &&
- (item->stype == F_INBOX) &&
- (item->folder->account != NULL) &&
- (item->folder->account->filter_on_recv) &&
- procmsg_msginfo_filter(msginfo))
- to_filter = g_slist_prepend(to_filter, msginfo);
- else {
+ if (!do_filter) {
exists_list = g_slist_prepend(exists_list, msginfo);
-
+
if(prefs_common.thread_by_subject &&
MSG_IS_IGNORE_THREAD(msginfo->flags) &&
!subject_table_lookup(subject_table, msginfo->subject)) {
subject_table_insert(subject_table, msginfo->subject, msginfo);
- }
+ }
}
}
- filtering_move_and_copy_msgs(to_filter);
- for (elem = to_filter; elem; elem = g_slist_next(elem)) {
- MsgInfo *msginfo = (MsgInfo *)elem->data;
- procmsg_msginfo_free(msginfo);
- }
- g_slist_free(to_filter);
+ if (do_filter) {
+ GSList *unfiltered;
+ procmsg_msglist_filter(newmsg_list, item->folder->account,
+ &to_filter, &unfiltered,
+ TRUE);
+
+ filtering_move_and_copy_msgs(newmsg_list);
+ if (to_filter != NULL) {
+ for (elem = to_filter; elem; elem = g_slist_next(elem)) {
+ MsgInfo *msginfo = (MsgInfo *)elem->data;
+ procmsg_msginfo_free(msginfo);
+ }
+ g_slist_free(to_filter);
+ }
+ if (unfiltered != NULL) {
+ for (elem = unfiltered; elem; elem = g_slist_next(elem)) {
+ MsgInfo *msginfo = (MsgInfo *)elem->data;
+ exists_list = g_slist_prepend(exists_list, msginfo);
+
+ if(prefs_common.thread_by_subject &&
+ MSG_IS_IGNORE_THREAD(msginfo->flags) &&
+ !subject_table_lookup(subject_table, msginfo->subject)) {
+ subject_table_insert(subject_table, msginfo->subject, msginfo);
+ }
+ }
+ g_slist_free(unfiltered);
+ }
+ }
+
g_slist_free(newmsg_list);
- statusbar_progress_all(0,0,0);
- statusbar_pop_all();
update_flags |= F_ITEM_UPDATE_MSGCNT | F_ITEM_UPDATE_CONTENT;
}
g_hash_table_destroy(subject_table);
}
+ if (item->new_msgs != newcnt || item->unread_msgs != unreadcnt
+ || item->total_msgs != totalcnt || item->marked_msgs != markedcnt
+ || item->unreadmarked_msgs != unreadmarkedcnt) {
+ update_flags |= F_ITEM_UPDATE_CONTENT;
+ }
+
item->new_msgs = newcnt;
item->unread_msgs = unreadcnt;
item->total_msgs = totalcnt;
void folder_item_read_cache(FolderItem *item)
{
gchar *cache_file, *mark_file;
- START_TIMING("folder_item_read_cache");
+ START_TIMING("");
g_return_if_fail(item != NULL);
if (item->path != NULL) {
FolderItemPrefs *prefs;
gint filemode = 0;
gchar *id;
+ time_t last_mtime = (time_t)0;
+ gboolean need_scan = FALSE;
if (!item || !item->path || !item->cache)
return;
+ if (FOLDER_TYPE(item->folder) == F_MH) {
+ last_mtime = item->mtime;
+ need_scan = item->folder->klass->scan_required(item->folder, item);
+ }
+
id = folder_item_get_identifier(item);
debug_print("Save cache for folder %s\n", id);
g_free(id);
}
}
+ if (!need_scan && FOLDER_TYPE(item->folder) == F_MH) {
+ if (item->mtime == last_mtime) {
+ mh_set_mtime(item);
+ }
+ }
+
g_free(cache_file);
g_free(mark_file);
}
|| strcmp(mimeinfo->subtype, "pgp-signature"))
procmsg_msginfo_set_flags(msginfo, 0, MSG_HAS_ATTACHMENT);
} else if (mimeinfo->disposition == DISPOSITIONTYPE_INLINE &&
- (mimeinfo->type != MIMETYPE_TEXT || strcmp(mimeinfo->subtype, "plain")) &&
strcmp(mimeinfo->subtype, "pgp-signature") &&
(procmime_mimeinfo_get_parameter(mimeinfo, "name") != NULL ||
procmime_mimeinfo_get_parameter(mimeinfo, "filename") != NULL)) {
perm_flags |= MSG_IGNORE_THREAD;
/* Unset tmp flags that should not be copied */
- tmp_flags &= ~(MSG_MOVE | MSG_COPY);
+ tmp_flags &= ~(MSG_MOVE | MSG_COPY | MSG_MOVE_DONE);
/* unset flags that are set but should not */
/* and set new flags */
* copying was successfull and update folder
* message counts
*/
- if (item->folder->klass->remove_msgs) {
+ if (not_moved == NULL && item->folder->klass->remove_msgs) {
item->folder->klass->remove_msgs(item->folder,
msginfo->folder,
msglist,
GSList *processing_list;
GSList *mlist, *cur;
guint total = 0, curmsg = 0;
+ gint last_apply_per_account;
g_return_if_fail(item != NULL);
&& !post_global_processing)
return;
+ debug_print("processing %s\n", item->name);
folder_item_update_freeze();
mlist = folder_item_get_msg_list(item);
total = g_slist_length(mlist);
statusbar_print_all(_("Processing messages..."));
+
+ last_apply_per_account = prefs_common.apply_per_account_filtering_rules;
+ prefs_common.apply_per_account_filtering_rules = FILTERING_ACCOUNT_RULES_SKIP;
+
for (cur = mlist ; cur != NULL ; cur = cur->next) {
MsgInfo * msginfo;
statusbar_progress_all(curmsg++,total, 10);
/* apply pre global rules */
- filter_message_by_msginfo(pre_global_processing, msginfo);
+ filter_message_by_msginfo(pre_global_processing, msginfo, NULL);
/* apply rules of the folder */
- filter_message_by_msginfo(processing_list, msginfo);
+ filter_message_by_msginfo(processing_list, msginfo, NULL);
/* apply post global rules */
- filter_message_by_msginfo(post_global_processing, msginfo);
+ filter_message_by_msginfo(post_global_processing, msginfo, NULL);
}
+ prefs_common.apply_per_account_filtering_rules = last_apply_per_account;
+
if (pre_global_processing || processing_list
|| post_global_processing)
filtering_move_and_copy_msgs(mlist);
/* here's an exception: Inbox subfolders are normal. */
if (item->parent_stype == -1 && cur->stype == F_INBOX
&& item != cur) {
- debug_print("set item %s parent type to %d "
- "even if %s is F_INBOX\n",
- item->path ? item->path : "(null)",
- 0, cur->path);
item->parent_stype = F_NORMAL;
break;
}
* well copy it instead of going up the full way */
if (cur->parent_stype != -1) {
item->parent_stype = cur->parent_stype;
- debug_print("set item %s parent type to %d "
- "from %s's parent type\n",
- item->path ? item->path : "(null)",
- cur->parent_stype ? cur->parent_stype : 0,
- cur->path ? cur->path : "(null)");
break;
}
/* we found a parent that has a special type. That's
* our parent type. */
if (cur->stype != F_NORMAL) {
- debug_print("set item %s parent type to %d "
- "from %s's type\n",
- item->path ? item->path : "(null)",
- cur->stype ? cur->stype : 0,
- cur->path ? cur->path : "(null)");
cur->parent_stype = cur->stype;
item->parent_stype = cur->stype;
break;
/* as we still didn't find anything, our parents must all be
* normal. */
if (item->parent_stype == -1) {
- debug_print("set item %s to 0 from default\n",
- item->path ? item->path : "(null)");
item->parent_stype = F_NORMAL;
}
}
return FALSE;
}
+
+gboolean folder_get_sort_type (Folder *folder,
+ FolderSortKey *sort_key,
+ FolderSortType *sort_type)
+{
+ if (!folder || !sort_key || !sort_type)
+ return FALSE;
+ if (folder->klass->get_sort_type == NULL)
+ return FALSE;
+ folder->klass->get_sort_type(folder, sort_key, sort_type);
+ return TRUE;
+}
+
#undef PUT_ESCAPE_STR