** See bug #53258.
2004-02-06 Not Zed <NotZed@Ximian.com> ** See bug #53258. * em-format-html-display.c (efhd_find_handler): force any bonobo handler types to always be inline, even attachments. * em-format.c (em_format_is_inline): use handler flags for special cases, removing all hard-coded types. * em-format.h (EMFormatHandler): add a flags field, so far a flag to set default inline viewing of the content. 2004-02-06 Not Zed <NotZed@Ximian.com> * em-folder-properties.c: include string.h to kill warning. ** See bug #53627. * em-folder-view.c (emfv_popup_mark_junk): changed to work like delete does, jumping to the next message if required, and marking things immediately, then queuing up the junk marking job if required. * mail-ops.c (mail_mark_junk): ugh, this stuff totally can't go accessing messagelist from another thread!!!! Changed so this code only does the junk reporting, not setting flags. UGH! It should be doing this implictly on the folder when you set the flags, or at least when you sync the folder!!! Changed ot use the queued thread. * message-list.c (find_next_undeleted): changed to find next-unhidden, i.e. junk as well as deleted, if we're in hide-deleted mode. (build_tree): always call find_next_undeleted if we have a cursor. (build_flat): same. svn path=/trunk/; revision=24644
This commit is contained in:
@@ -1,3 +1,40 @@
|
||||
2004-02-06 Not Zed <NotZed@Ximian.com>
|
||||
|
||||
** See bug #53258.
|
||||
|
||||
* em-format-html-display.c (efhd_find_handler): force any bonobo
|
||||
handler types to always be inline, even attachments.
|
||||
|
||||
* em-format.c (em_format_is_inline): use handler flags for special
|
||||
cases, removing all hard-coded types.
|
||||
|
||||
* em-format.h (EMFormatHandler): add a flags field, so far a flag
|
||||
to set default inline viewing of the content.
|
||||
|
||||
2004-02-06 Not Zed <NotZed@Ximian.com>
|
||||
|
||||
* em-folder-properties.c: include string.h to kill warning.
|
||||
|
||||
** See bug #53627.
|
||||
|
||||
* em-folder-view.c (emfv_popup_mark_junk): changed to work like
|
||||
delete does, jumping to the next message if required, and marking
|
||||
things immediately, then queuing up the junk marking job if
|
||||
required.
|
||||
|
||||
* mail-ops.c (mail_mark_junk): ugh, this stuff totally can't go
|
||||
accessing messagelist from another thread!!!! Changed so this
|
||||
code only does the junk reporting, not setting flags. UGH! It
|
||||
should be doing this implictly on the folder when you set the
|
||||
flags, or at least when you sync the folder!!! Changed ot use the
|
||||
queued thread.
|
||||
|
||||
* message-list.c (find_next_undeleted): changed to find
|
||||
next-unhidden, i.e. junk as well as deleted, if we're in
|
||||
hide-deleted mode.
|
||||
(build_tree): always call find_next_undeleted if we have a cursor.
|
||||
(build_flat): same.
|
||||
|
||||
2004-02-05 Rodney Dawes <dobey@ximian.com>
|
||||
|
||||
* em-message-browser.c (emmb_list_message_selected): Grab focus on
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <gtk/gtkbox.h>
|
||||
#include <gtk/gtkcheckbutton.h>
|
||||
#include <gtk/gtkdialog.h>
|
||||
@@ -260,7 +262,7 @@ em_folder_properties_show(GtkWindow *parent, CamelFolder *folder, const char *ur
|
||||
if (!strncmp(uri, "vfolder:", 8))
|
||||
vfolder_edit_rule(uri);
|
||||
else if (folder == NULL)
|
||||
mail_get_folder (uri, 0, emfp_dialog_got_folder, NULL, mail_thread_new);
|
||||
mail_get_folder(uri, 0, emfp_dialog_got_folder, NULL, mail_thread_new);
|
||||
else
|
||||
emfp_dialog_got_folder((char *)uri, folder, NULL);
|
||||
}
|
||||
|
||||
+40
-6
@@ -558,13 +558,47 @@ emfv_popup_mark_unimportant(GtkWidget *w, EMFolderView *emfv)
|
||||
static void
|
||||
emfv_popup_mark_junk (GtkWidget *w, EMFolderView *emfv)
|
||||
{
|
||||
mail_mark_junk (emfv->folder, emfv->list, TRUE);
|
||||
GPtrArray *uids, *uidsjunk;
|
||||
int i;
|
||||
|
||||
if (emfv->folder == NULL)
|
||||
return;
|
||||
|
||||
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_DELETED|CAMEL_MESSAGE_JUNK,
|
||||
CAMEL_MESSAGE_JUNK)) {
|
||||
g_ptr_array_add(uidsjunk, g_strdup(uid));
|
||||
}
|
||||
}
|
||||
|
||||
camel_folder_thaw(emfv->folder);
|
||||
|
||||
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
|
||||
emfv_popup_mark_nojunk (GtkWidget *w, EMFolderView *emfv)
|
||||
{
|
||||
mail_mark_junk (emfv->folder, emfv->list, FALSE);
|
||||
GPtrArray *uids;
|
||||
|
||||
uids = message_list_get_selected(emfv->list);
|
||||
em_folder_view_mark_selected(emfv, CAMEL_MESSAGE_JUNK, 0);
|
||||
mail_mark_junk(emfv->folder, uids, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -572,13 +606,13 @@ emfv_popup_delete(GtkWidget *w, EMFolderView *emfv)
|
||||
{
|
||||
GPtrArray *uids;
|
||||
|
||||
uids = message_list_get_selected (emfv->list);
|
||||
em_folder_view_mark_selected (emfv, CAMEL_MESSAGE_SEEN|CAMEL_MESSAGE_DELETED, CAMEL_MESSAGE_SEEN|CAMEL_MESSAGE_DELETED);
|
||||
uids = message_list_get_selected(emfv->list);
|
||||
em_folder_view_mark_selected(emfv, CAMEL_MESSAGE_SEEN|CAMEL_MESSAGE_DELETED, CAMEL_MESSAGE_SEEN|CAMEL_MESSAGE_DELETED);
|
||||
|
||||
if (uids->len == 1)
|
||||
message_list_select (emfv->list, MESSAGE_LIST_SELECT_NEXT, 0, 0, FALSE);
|
||||
message_list_select(emfv->list, MESSAGE_LIST_SELECT_NEXT, 0, 0, FALSE);
|
||||
|
||||
em_utils_uids_free (uids);
|
||||
em_utils_uids_free(uids);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
@@ -912,6 +911,7 @@ static const EMFormatHandler *efhd_find_handler(EMFormat *emf, const char *mime_
|
||||
|
||||
h->mime_type = g_strdup(mime_type);
|
||||
h->handler = efhd_bonobo_unknown;
|
||||
h->flags = EM_FORMAT_HANDLER_INLINE_DISPOSITION;
|
||||
g_hash_table_insert(efhd_bonobo_handlers, h->mime_type, h);
|
||||
|
||||
handle = h;
|
||||
@@ -1461,7 +1461,7 @@ efhd_format_attachment(EMFormat *emf, CamelStream *stream, CamelMimePart *part,
|
||||
info = (struct _attach_puri *)em_format_add_puri(emf, sizeof(*info), classid, part, efhd_attachment_frame);
|
||||
em_format_html_add_pobject((EMFormatHTML *)emf, sizeof(EMFormatHTMLPObject), classid, part, efhd_attachment_button);
|
||||
info->handle = handle;
|
||||
info->shown = em_format_is_inline(emf, info->puri.part) && handle != NULL;
|
||||
info->shown = em_format_is_inline(emf, info->puri.part, handle);
|
||||
info->snoop_mime_type = emf->snoop_mime_type;
|
||||
|
||||
camel_stream_write_string(stream,
|
||||
|
||||
@@ -1658,7 +1658,7 @@ efh_format_attachment(EMFormat *emf, CamelStream *stream, CamelMimePart *part, c
|
||||
|
||||
camel_stream_write_string(stream, "</font></td></tr><tr></table>");
|
||||
|
||||
if (handle && em_format_is_inline(emf, part))
|
||||
if (handle && em_format_is_inline(emf, part, handle))
|
||||
handle->handler(emf, stream, part, handle);
|
||||
}
|
||||
|
||||
|
||||
+17
-18
@@ -821,39 +821,38 @@ int em_format_is_attachment(EMFormat *emf, CamelMimePart *part)
|
||||
* em_format_is_inline:
|
||||
* @emf:
|
||||
* @part:
|
||||
* @handle: handler for this part
|
||||
*
|
||||
* Returns true if the part should be displayed inline. Any part with
|
||||
* a Content-Disposition of inline, or any message type is displayed
|
||||
* inline.
|
||||
* a Content-Disposition of inline, or if the @handle has a default
|
||||
* inline set, will be shown inline.
|
||||
*
|
||||
* ::set_inline() called on the same part will override any calculated
|
||||
* :set_inline() called on the same part will override any calculated
|
||||
* value.
|
||||
*
|
||||
* Return value:
|
||||
**/
|
||||
int em_format_is_inline(EMFormat *emf, CamelMimePart *part)
|
||||
int em_format_is_inline(EMFormat *emf, CamelMimePart *part, const EMFormatHandler *handle)
|
||||
{
|
||||
void *dummy, *override;
|
||||
const char *tmp;
|
||||
CamelContentType *ct;
|
||||
|
||||
if (handle == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (g_hash_table_lookup_extended(emf->inline_table, part, &dummy, &override))
|
||||
return GPOINTER_TO_INT(override);
|
||||
|
||||
ct = camel_mime_part_get_content_type(part);
|
||||
|
||||
/* TODO: make this depend on libnss supported */
|
||||
/* For some reason rfc2633 says we always add this as an attachment, which
|
||||
stuffs us up since we don't want to treat it that way at all ... */
|
||||
if (camel_content_type_is(ct, "application", "x-pkcs7-mime"))
|
||||
/* some types need to override the disposition, e.g. application/x-pkcs7-mime */
|
||||
if (handle->flags & EM_FORMAT_HANDLER_INLINE_DISPOSITION)
|
||||
return TRUE;
|
||||
|
||||
tmp = camel_mime_part_get_disposition(part);
|
||||
if (tmp)
|
||||
return g_ascii_strcasecmp(tmp, "inline") == 0;
|
||||
|
||||
/* messages are always inline? */
|
||||
return camel_content_type_is (ct, "message", "*");
|
||||
/* otherwise, use the default for this handler type */
|
||||
return (handle->flags & EM_FORMAT_HANDLER_INLINE) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1348,7 +1347,7 @@ emf_message_rfc822(EMFormat *emf, CamelStream *stream, CamelMimePart *part, cons
|
||||
|
||||
static EMFormatHandler type_builtin_table[] = {
|
||||
#ifdef HAVE_NSS
|
||||
{ "application/x-pkcs7-mime", (EMFormatFunc)emf_application_xpkcs7mime },
|
||||
{ "application/x-pkcs7-mime", (EMFormatFunc)emf_application_xpkcs7mime, EM_FORMAT_HANDLER_INLINE_DISPOSITION },
|
||||
#endif
|
||||
{ "multipart/alternative", emf_multipart_alternative },
|
||||
{ "multipart/appledouble", emf_multipart_appledouble },
|
||||
@@ -1357,13 +1356,13 @@ static EMFormatHandler type_builtin_table[] = {
|
||||
{ "multipart/signed", emf_multipart_signed },
|
||||
{ "multipart/related", emf_multipart_related },
|
||||
{ "multipart/*", emf_multipart_mixed },
|
||||
{ "message/rfc822", emf_message_rfc822 },
|
||||
{ "message/news", emf_message_rfc822 },
|
||||
{ "message/*", emf_message_rfc822 },
|
||||
{ "message/rfc822", emf_message_rfc822, EM_FORMAT_HANDLER_INLINE },
|
||||
{ "message/news", emf_message_rfc822, EM_FORMAT_HANDLER_INLINE },
|
||||
{ "message/*", emf_message_rfc822, EM_FORMAT_HANDLER_INLINE },
|
||||
|
||||
/* Insert brokenly-named parts here */
|
||||
#ifdef HAVE_NSS
|
||||
{ "application/pkcs7-mime", (EMFormatFunc)emf_application_xpkcs7mime },
|
||||
{ "application/pkcs7-mime", (EMFormatFunc)emf_application_xpkcs7mime, EM_FORMAT_HANDLER_INLINE_DISPOSITION },
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
+7
-1
@@ -57,9 +57,15 @@ typedef enum _em_format_mode_t {
|
||||
struct _EMFormatHandler {
|
||||
char *mime_type;
|
||||
EMFormatFunc handler;
|
||||
guint32 flags;
|
||||
GList *applications; /* gnome vfs short-list of applications, do we care? */
|
||||
};
|
||||
|
||||
/* inline by default */
|
||||
#define EM_FORMAT_HANDLER_INLINE (1<<0)
|
||||
/* inline by default, and override content-disposition always */
|
||||
#define EM_FORMAT_HANDLER_INLINE_DISPOSITION (1<<1)
|
||||
|
||||
typedef struct _EMFormatPURI EMFormatPURI;
|
||||
typedef void (*EMFormatPURIFunc)(EMFormat *md, struct _CamelStream *stream, EMFormatPURI *puri);
|
||||
|
||||
@@ -184,7 +190,7 @@ void em_format_add_header(EMFormat *emf, const char *name, guint32 flags);
|
||||
Or maybe it should live with sub-classes? */
|
||||
|
||||
int em_format_is_attachment(EMFormat *emf, struct _CamelMimePart *part);
|
||||
int em_format_is_inline(EMFormat *emf, struct _CamelMimePart *part);
|
||||
int em_format_is_inline(EMFormat *emf, struct _CamelMimePart *part, const EMFormatHandler *handle);
|
||||
/* FIXME: not sure about this api */
|
||||
void em_format_set_inline(EMFormat *emf, struct _CamelMimePart *part, int state);
|
||||
char *em_format_describe_part(struct _CamelMimePart *part, const char *mimetype);
|
||||
|
||||
+24
-35
@@ -2406,7 +2406,7 @@ struct _mark_junk_mail_msg {
|
||||
struct _mail_msg msg;
|
||||
|
||||
CamelFolder *folder;
|
||||
MessageList *list;
|
||||
GPtrArray *uids;
|
||||
gboolean junk;
|
||||
};
|
||||
|
||||
@@ -2420,45 +2420,34 @@ static void
|
||||
mark_junk_mark (struct _mail_msg *mm)
|
||||
{
|
||||
struct _mark_junk_mail_msg *m = (struct _mark_junk_mail_msg *) mm;
|
||||
CamelJunkPlugin *csp = NULL;
|
||||
GPtrArray *uids;
|
||||
CamelJunkPlugin *csp = ((CamelService *)m->folder->parent_store)->session->junk_plugin;
|
||||
gboolean commit_reports = FALSE;
|
||||
void (*report)(CamelJunkPlugin *, CamelMimeMessage *);
|
||||
int i;
|
||||
|
||||
if (m->folder == NULL)
|
||||
if (csp == NULL)
|
||||
return;
|
||||
|
||||
uids = message_list_get_selected (m->list);
|
||||
camel_folder_freeze (m->folder);
|
||||
|
||||
for (i=0; i<uids->len; i++) {
|
||||
guint32 flags;
|
||||
/* FIXME: This should probably be implictly handled by the
|
||||
folder when you apply the junk bit, e.g. at sync time. */
|
||||
|
||||
flags = camel_folder_get_message_flags (m->folder, uids->pdata[i]);
|
||||
if (((flags & CAMEL_MESSAGE_JUNK) == CAMEL_MESSAGE_JUNK) != m->junk) {
|
||||
CamelMimeMessage *msg = camel_folder_get_message (m->folder, uids->pdata[i], NULL);
|
||||
if (m->junk)
|
||||
report = camel_junk_plugin_report_junk;
|
||||
else
|
||||
report = camel_junk_plugin_report_notjunk;
|
||||
|
||||
if (msg) {
|
||||
csp = CAMEL_SERVICE (m->folder->parent_store)->session->junk_plugin;
|
||||
if (m->junk)
|
||||
camel_junk_plugin_report_junk (csp, msg);
|
||||
else
|
||||
camel_junk_plugin_report_notjunk (csp, msg);
|
||||
for (i=0; i<m->uids->len; i++) {
|
||||
CamelMimeMessage *msg = camel_folder_get_message(m->folder, m->uids->pdata[i], NULL);
|
||||
|
||||
commit_reports = TRUE;
|
||||
camel_object_unref (msg);
|
||||
}
|
||||
if (msg) {
|
||||
report(csp, msg);
|
||||
commit_reports = TRUE;
|
||||
camel_object_unref(msg);
|
||||
}
|
||||
camel_folder_set_message_flags(m->folder, uids->pdata[i],
|
||||
CAMEL_MESSAGE_JUNK | (m->junk ? CAMEL_MESSAGE_DELETED : 0),
|
||||
m->junk ? CAMEL_MESSAGE_JUNK : 0);
|
||||
}
|
||||
|
||||
if (commit_reports)
|
||||
camel_junk_plugin_commit_reports (csp);
|
||||
|
||||
message_list_free_uids(m->list, uids);
|
||||
camel_folder_thaw(m->folder);
|
||||
camel_junk_plugin_commit_reports(csp);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -2471,8 +2460,8 @@ mark_junk_free (struct _mail_msg *mm)
|
||||
{
|
||||
struct _mark_junk_mail_msg *m = (struct _mark_junk_mail_msg *)mm;
|
||||
|
||||
if (m->folder)
|
||||
camel_object_unref (m->folder);
|
||||
camel_object_unref(m->folder);
|
||||
em_utils_uids_free(m->uids);
|
||||
}
|
||||
|
||||
static struct _mail_msg_op mark_junk_op = {
|
||||
@@ -2483,15 +2472,15 @@ static struct _mail_msg_op mark_junk_op = {
|
||||
};
|
||||
|
||||
void
|
||||
mail_mark_junk (CamelFolder *folder, MessageList *list, gboolean junk)
|
||||
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 = mail_msg_new(&mark_junk_op, NULL, sizeof (*m));
|
||||
m->folder = folder;
|
||||
camel_object_ref (folder);
|
||||
m->list = list;
|
||||
camel_object_ref(folder);
|
||||
m->uids = uids;
|
||||
m->junk = junk;
|
||||
|
||||
e_thread_put (mail_thread_new, (EMsg *) m);
|
||||
e_thread_put(mail_thread_queued, (EMsg *) m);
|
||||
}
|
||||
|
||||
+1
-3
@@ -36,8 +36,6 @@ extern "C" {
|
||||
#include "camel/camel-mime-message.h"
|
||||
#include "camel/camel-operation.h"
|
||||
|
||||
#include "message-list.h"
|
||||
|
||||
#include "e-util/e-msgport.h"
|
||||
#include "e-util/e-account.h"
|
||||
|
||||
@@ -160,7 +158,7 @@ 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, MessageList *list, gboolean junk);
|
||||
void mail_mark_junk(CamelFolder *folder, GPtrArray *uids, int junk);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
+13
-14
@@ -1892,13 +1892,18 @@ find_next_undeleted (MessageList *ml)
|
||||
int vrow;
|
||||
ETree *et = ml->tree;
|
||||
CamelMessageInfo *info;
|
||||
|
||||
guint32 check;
|
||||
|
||||
node = g_hash_table_lookup (ml->uid_nodemap, ml->cursor_uid);
|
||||
if (node == NULL)
|
||||
return NULL;
|
||||
|
||||
|
||||
check = CAMEL_MESSAGE_JUNK;
|
||||
if (ml->hidedeleted)
|
||||
check |= CAMEL_MESSAGE_DELETED;
|
||||
|
||||
info = get_message_info (ml, node);
|
||||
if (info && (info->flags & CAMEL_MESSAGE_DELETED) == 0) {
|
||||
if (info && (info->flags & check) == 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -1915,7 +1920,7 @@ find_next_undeleted (MessageList *ml)
|
||||
|
||||
node = e_tree_node_at_row (et, vrow);
|
||||
info = get_message_info (ml, node);
|
||||
if (info && (info->flags & CAMEL_MESSAGE_DELETED) == 0) {
|
||||
if (info && (info->flags & check) == 0) {
|
||||
return g_strdup (camel_message_info_uid (info));
|
||||
}
|
||||
vrow ++;
|
||||
@@ -1957,11 +1962,8 @@ build_tree (MessageList *ml, CamelFolderThread *thread, CamelFolderChangeInfo *c
|
||||
ml->tree_root = e_tree_memory_node_insert(E_TREE_MEMORY(etm), NULL, 0, NULL);
|
||||
}
|
||||
|
||||
if (ml->cursor_uid) {
|
||||
if (ml->hidedeleted) {
|
||||
saveuid = find_next_undeleted(ml);
|
||||
}
|
||||
}
|
||||
if (ml->cursor_uid)
|
||||
saveuid = find_next_undeleted(ml);
|
||||
|
||||
#define BROKEN_ETREE /* avoid some broken code in etree(?) by not using the incremental update */
|
||||
|
||||
@@ -2274,11 +2276,8 @@ build_flat (MessageList *ml, GPtrArray *summary, CamelFolderChangeInfo *changes)
|
||||
gettimeofday(&start, NULL);
|
||||
#endif
|
||||
|
||||
if (ml->cursor_uid) {
|
||||
if (ml->hidedeleted) {
|
||||
saveuid = find_next_undeleted(ml);
|
||||
}
|
||||
}
|
||||
if (ml->cursor_uid)
|
||||
saveuid = find_next_undeleted(ml);
|
||||
|
||||
#ifndef BROKEN_ETREE
|
||||
if (changes) {
|
||||
|
||||
Reference in New Issue
Block a user