#include "send_message.h"
#include "stock_pixmap.h"
#include "hooks.h"
+#include "filtering.h"
static GList *messageview_list = NULL;
static void create_filter_cb (gpointer data,
guint action,
GtkWidget *widget);
+static void create_processing_cb (gpointer data,
+ guint action,
+ GtkWidget *widget);
static void about_cb (gpointer data,
guint action,
NULL, create_filter_cb, FILTER_BY_TO, NULL},
{N_("/_Tools/_Create filter rule/by _Subject"),
NULL, create_filter_cb, FILTER_BY_SUBJECT, NULL},
+ {N_("/_Tools/Create processing rule/"),
+ NULL, NULL, 0, "<Branch>"},
+ {N_("/_Tools/Create processing rule/_Automatically"),
+ NULL, create_processing_cb, FILTER_BY_AUTO, NULL},
+ {N_("/_Tools/Create processing rule/by _From"),
+ NULL, create_processing_cb, FILTER_BY_FROM, NULL},
+ {N_("/_Tools/Create processing rule/by _To"),
+ NULL, create_processing_cb, FILTER_BY_TO, NULL},
+ {N_("/_Tools/Create processing rule/by _Subject"),
+ NULL, create_processing_cb, FILTER_BY_SUBJECT, NULL},
{N_("/_Tools/---"), NULL, NULL, 0, "<Separator>"},
{N_("/_Tools/Actio_ns"), NULL, NULL, 0, "<Branch>"},
return encinfo;
}
-void messageview_show(MessageView *messageview, MsgInfo *msginfo,
+gint messageview_show(MessageView *messageview, MsgInfo *msginfo,
gboolean all_headers)
{
gchar *file;
MimeInfo *mimeinfo, *encinfo;
- g_return_if_fail(msginfo != NULL);
+ g_return_val_if_fail(msginfo != NULL, -1);
mimeinfo = procmime_scan_message(msginfo);
- g_return_if_fail(mimeinfo != NULL);
+ if (!mimeinfo) {
+ textview_show_error(messageview->mimeview->textview);
+ return -1;
+ }
while ((encinfo = find_encrypted_part(mimeinfo)) != NULL) {
debug_print("decrypting message part\n");
if (!file) {
g_warning("can't get message file path.\n");
procmime_mimeinfo_free_all(mimeinfo);
- return;
+ textview_show_error(messageview->mimeview->textview);
+ return -1;
}
if (messageview->msginfo != msginfo) {
noticeview_hide(messageview->noticeview);
g_free(file);
+
+ return 0;
}
void messageview_reflect_prefs_pixmap_theme(void)
static void create_filter_cb(gpointer data, guint action, GtkWidget *widget)
{
MessageView *messageview = (MessageView *)data;
- gchar *header = NULL;
- gchar *key = NULL;
-
+ FolderItem * item;
+
if (!messageview->msginfo) return;
+
+ item = messageview->msginfo->folder;
+ summary_msginfo_filter_open(item, messageview->msginfo,
+ (PrefsFilterType)action, 0);
+}
- procmsg_get_filter_keyword(messageview->msginfo, &header, &key,
- (PrefsFilterType)action);
- prefs_filtering_open(NULL, header, key);
-
- g_free(header);
- g_free(key);
+static void create_processing_cb(gpointer data, guint action,
+ GtkWidget *widget)
+{
+ MessageView *messageview = (MessageView *)data;
+ FolderItem * item;
+
+ if (!messageview->msginfo) return;
+
+ item = messageview->msginfo->folder;
+ summary_msginfo_filter_open(item, messageview->msginfo,
+ (PrefsFilterType)action, 1);
}
static void about_cb(gpointer data, guint action, GtkWidget *widget)