diff options
Diffstat (limited to 'mail')
-rw-r--r-- | mail/ChangeLog | 9 | ||||
-rw-r--r-- | mail/em-folder-view.c | 36 | ||||
-rw-r--r-- | mail/mail-ops.c | 85 | ||||
-rw-r--r-- | mail/mail-ops.h | 2 |
4 files changed, 18 insertions, 114 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 9f907f81a8..65421c4ec3 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,12 @@ +2004-03-11 Radek Doulik <rodo@ximian.com> + + * mail-ops.c: remove junk learning thread, it's handled in + camel-folder.c:folder_changed now + + * em-folder-view.c (emfv_popup_mark_junk): use + em_folder_view_mark_selected, set junk, junk-learn and seen flags + (emfv_popup_mark_nojunk): similar, reset junk, set junk-learn flags + 2004-03-12 Jeffrey Stedfast <fejj@ximian.com> * mail-ops.c (mail_send_mail): Removed. No longer in use (hasn't diff --git a/mail/em-folder-view.c b/mail/em-folder-view.c index 7d104c99e4..175650fa8c 100644 --- a/mail/em-folder-view.c +++ b/mail/em-folder-view.c @@ -560,37 +560,16 @@ emfv_popup_mark_unimportant(GtkWidget *w, EMFolderView *emfv) static void emfv_popup_mark_junk (GtkWidget *w, EMFolderView *emfv) { - GPtrArray *uids, *uidsjunk; - int i; - - if (emfv->folder == NULL) - return; + GPtrArray *uids; - uidsjunk = g_ptr_array_new(); uids = message_list_get_selected(emfv->list); - camel_folder_freeze(emfv->folder); - - for (i=0; i<uids->len; i++) { - char *uid = uids->pdata[i]; - - if (camel_folder_set_message_flags(emfv->folder, uid, - CAMEL_MESSAGE_SEEN|CAMEL_MESSAGE_JUNK, - CAMEL_MESSAGE_SEEN|CAMEL_MESSAGE_JUNK)) { - g_ptr_array_add(uidsjunk, g_strdup(uid)); - } - } - - camel_folder_thaw(emfv->folder); - + em_folder_view_mark_selected(emfv, + CAMEL_MESSAGE_SEEN|CAMEL_MESSAGE_JUNK|CAMEL_MESSAGE_JUNK_LEARN, + CAMEL_MESSAGE_SEEN|CAMEL_MESSAGE_JUNK|CAMEL_MESSAGE_JUNK_LEARN); if (uids->len == 1) message_list_select(emfv->list, MESSAGE_LIST_SELECT_NEXT, 0, 0, FALSE); message_list_free_uids(emfv->list, uids); - - if (uidsjunk->len) - mail_mark_junk(emfv->folder, uidsjunk, TRUE); - else - em_utils_uids_free(uidsjunk); } static void @@ -599,10 +578,13 @@ emfv_popup_mark_nojunk (GtkWidget *w, EMFolderView *emfv) GPtrArray *uids; uids = message_list_get_selected(emfv->list); - em_folder_view_mark_selected(emfv, CAMEL_MESSAGE_JUNK, 0); + em_folder_view_mark_selected(emfv, + CAMEL_MESSAGE_JUNK|CAMEL_MESSAGE_JUNK_LEARN, + CAMEL_MESSAGE_JUNK_LEARN); if (uids->len == 1) message_list_select(emfv->list, MESSAGE_LIST_SELECT_NEXT, 0, 0, FALSE); - mail_mark_junk(emfv->folder, uids, FALSE); + + message_list_free_uids(emfv->list, uids); } static void diff --git a/mail/mail-ops.c b/mail/mail-ops.c index 99a7367378..ca2027c25d 100644 --- a/mail/mail-ops.c +++ b/mail/mail-ops.c @@ -2349,88 +2349,3 @@ mail_execute_shell_command (CamelFilterDriver *driver, int argc, char **argv, vo gnome_execute_async_fds (NULL, argc, argv, TRUE); } - -/* [Un]mark junk flag */ - -struct _mark_junk_mail_msg { - struct _mail_msg msg; - - CamelFolder *folder; - GPtrArray *uids; - gboolean junk; -}; - -static char * -mark_junk_describe (struct _mail_msg *mm, int complete) -{ - return g_strdup (_("Changing junk status")); -} - -static void -mark_junk_mark (struct _mail_msg *mm) -{ - struct _mark_junk_mail_msg *m = (struct _mark_junk_mail_msg *) mm; - CamelJunkPlugin *csp = ((CamelService *)m->folder->parent_store)->session->junk_plugin; - gboolean commit_reports = FALSE; - void (*report)(CamelJunkPlugin *, CamelMimeMessage *); - int i; - - if (csp == NULL) - return; - - /* FIXME: This should probably be implictly handled by the - folder when you apply the junk bit, e.g. at sync time. */ - - if (m->junk) - report = camel_junk_plugin_report_junk; - else - report = camel_junk_plugin_report_notjunk; - - for (i=0; i<m->uids->len; i++) { - CamelMimeMessage *msg = camel_folder_get_message(m->folder, m->uids->pdata[i], NULL); - - if (msg) { - report(csp, msg); - commit_reports = TRUE; - camel_object_unref(msg); - } - } - - if (commit_reports) - camel_junk_plugin_commit_reports(csp); -} - -static void -mark_junk_marked (struct _mail_msg *mm) -{ -} - -static void -mark_junk_free (struct _mail_msg *mm) -{ - struct _mark_junk_mail_msg *m = (struct _mark_junk_mail_msg *)mm; - - camel_object_unref(m->folder); - em_utils_uids_free(m->uids); -} - -static struct _mail_msg_op mark_junk_op = { - mark_junk_describe, - mark_junk_mark, - mark_junk_marked, - mark_junk_free, -}; - -void -mail_mark_junk(CamelFolder *folder, GPtrArray *uids, gboolean junk) -{ - struct _mark_junk_mail_msg *m; - - m = mail_msg_new(&mark_junk_op, NULL, sizeof (*m)); - m->folder = folder; - camel_object_ref(folder); - m->uids = uids; - m->junk = junk; - - e_thread_put(mail_thread_queued, (EMsg *) m); -} diff --git a/mail/mail-ops.h b/mail/mail-ops.h index eb4c216ed1..7751ea337f 100644 --- a/mail/mail-ops.h +++ b/mail/mail-ops.h @@ -154,8 +154,6 @@ int mail_store_set_offline(CamelStore *store, gboolean offline, /* filter driver execute shell command async callback */ void mail_execute_shell_command (CamelFilterDriver *driver, int argc, char **argv, void *data); -void mail_mark_junk(CamelFolder *folder, GPtrArray *uids, int junk); - #ifdef __cplusplus } #endif /* __cplusplus */ |