/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2007 Hiroyuki Yamamoto and the Claws Mail team
+ * Copyright (C) 1999-2011 Hiroyuki Yamamoto and the Claws Mail team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "hooks.h"
#include "filtering.h"
#include "partial_download.h"
-#include "gedit-print.h"
#include "uri_opener.h"
#include "inc.h"
#include "log.h"
MsgInfo *msginfo);
static void save_as_cb (GtkAction *action,
gpointer data);
-#if GTK_CHECK_VERSION(2,10,0) && !defined(USE_GNOMEPRINT)
static void page_setup_cb (GtkAction *action,
gpointer data);
-#endif
static void print_cb (GtkAction *action,
gpointer data);
static void close_cb (GtkAction *action,
static void goto_folder_cb (GtkAction *action,
gpointer data);
+static void scroll_prev_line_cb (GtkAction *action,
+ gpointer data);
+static void scroll_next_line_cb (GtkAction *action,
+ gpointer data);
+static void scroll_next_page_cb (GtkAction *action,
+ gpointer data);
+static void scroll_prev_page_cb (GtkAction *action,
+ gpointer data);
+
static void set_charset_cb (GtkAction *action, GtkRadioAction *current, gpointer data);
static void set_decode_cb (GtkAction *action, GtkRadioAction *current, gpointer data);
/* File menu */
{"File/SaveAs", NULL, N_("_Save as..."), "<control>S", NULL, G_CALLBACK(save_as_cb) },
-#if GTK_CHECK_VERSION(2,10,0) && !defined(USE_GNOMEPRINT)
{"File/PageSetup", NULL, N_("Page setup..."), NULL, NULL, G_CALLBACK(page_setup_cb) },
-#endif
{"File/Print", NULL, N_("_Print..."), "<control>P", NULL, G_CALLBACK(print_cb) },
{"File/---", NULL, "---", NULL, NULL, NULL },
{"File/Close", NULL, N_("_Close"), "<control>W", NULL, G_CALLBACK(close_cb) },
{"View/Goto/NextUnreadFolder", NULL, N_("Next unread _folder"), "<shift>G", NULL, G_CALLBACK(goto_unread_folder_cb) },
{"View/Goto/OtherFolder", NULL, N_("_Other folder..."), "G", NULL, G_CALLBACK(goto_folder_cb) },
/* {"View/Goto/---", NULL, "---", NULL, NULL, NULL }, */
+ {"View/Scroll", NULL, N_("Message Scroll") },
+ {"View/Scroll/PrevLine", NULL, N_("Previous line"), NULL, NULL, G_CALLBACK(scroll_prev_line_cb) },
+ {"View/Scroll/NextLine", NULL, N_("Next line"), NULL, NULL, G_CALLBACK(scroll_next_line_cb) },
+ {"View/Scroll/PrevPage", NULL, N_("Previous page"), NULL, NULL, G_CALLBACK(scroll_prev_page_cb) },
+ {"View/Scroll/NextPage", NULL, N_("Next page"), NULL, NULL, G_CALLBACK(scroll_next_page_cb) },
+ /* {"View/Scroll/---", NULL, "---", NULL, NULL, NULL }, */
{"View/Encoding", NULL, N_("Character _encoding") }, /* set_charset_cb */
{"View/Encoding/---", NULL, "---" },
{"Tools/AddSenderToAB", NULL, N_("Add sender to address boo_k"), NULL, NULL, G_CALLBACK(add_address_cb) },
{"Tools/---", NULL, "---", NULL, NULL, NULL },
- {"Tools/CreateFilterRule", NULL, "_Create filter rule" },
+ {"Tools/CreateFilterRule", NULL, N_("_Create filter rule") },
{"Tools/CreateFilterRule/Automatically", NULL, N_("_Automatically"), NULL, NULL, G_CALLBACK(create_filter_cb) }, /* FILTER_BY_AUTO */
{"Tools/CreateFilterRule/ByFrom", NULL, N_("By _From"), NULL, NULL, G_CALLBACK(create_filter_cb) }, /* FILTER_BY_FROM */
{"Tools/CreateFilterRule/ByTo", NULL, N_("By _To"), NULL, NULL, G_CALLBACK(create_filter_cb) }, /* FILTER_BY_TO */
{"Tools/CreateFilterRule/BySubject", NULL, N_("By _Subject"), NULL, NULL, G_CALLBACK(create_filter_cb) }, /* FILTER_BY_SUBJECT */
- {"Tools/CreateProcessingRule", NULL, "Create processing rule" },
+ {"Tools/CreateProcessingRule", NULL, N_("Create processing rule") },
{"Tools/CreateProcessingRule/Automatically", NULL, N_("_Automatically"), NULL, NULL, G_CALLBACK(create_processing_cb) },
{"Tools/CreateProcessingRule/ByFrom", NULL, N_("By _From"), NULL, NULL, G_CALLBACK(create_processing_cb) },
{"Tools/CreateProcessingRule/ByTo", NULL, N_("By _To"), NULL, NULL, G_CALLBACK(create_processing_cb) },
static GtkToggleActionEntry msgview_toggle_entries[] =
{
{"View/AllHeaders", NULL, N_("Show all _headers"), "<control>H", NULL, G_CALLBACK(show_all_header_cb) }, /* toggle */
- {"View/Quotes/FoldAll", NULL, N_("_Fold all"), "<control><shift>Q", NULL, G_CALLBACK(msg_hide_quotes_cb) }, /* 1 toggle */
- {"View/Quotes/Fold2", NULL, N_("Fold from level _2"), NULL, NULL, G_CALLBACK(msg_hide_quotes_cb) }, /* 2 toggle */
- {"View/Quotes/Fold3", NULL, N_("Fold from level _3"), NULL, NULL, G_CALLBACK(msg_hide_quotes_cb) }, /* 3 toggle */
+ {"View/Quotes/CollapseAll", NULL, N_("_Collapse all"), "<control><shift>Q", NULL, G_CALLBACK(msg_hide_quotes_cb) }, /* 1 toggle */
+ {"View/Quotes/Collapse2", NULL, N_("Collapse from level _2"), NULL, NULL, G_CALLBACK(msg_hide_quotes_cb) }, /* 2 toggle */
+ {"View/Quotes/Collapse3", NULL, N_("Collapse from level _3"), NULL, NULL, G_CALLBACK(msg_hide_quotes_cb) }, /* 3 toggle */
};
static GtkRadioActionEntry msgview_radio_enc_entries[] =
ENC_ACTION("Japanese/"CS_ISO_2022_JP_2, C_ISO_2022_JP_2, "ISO-2022-JP-_2"), /* RADIO set_charset_cb */
ENC_ACTION("Japanese/"CS_EUC_JP, C_EUC_JP, "_EUC-JP"), /* RADIO set_charset_cb */
ENC_ACTION("Japanese/"CS_SHIFT_JIS, C_SHIFT_JIS, "_Shift-JIS"), /* RADIO set_charset_cb */
+ ENC_ACTION("Chinese/"CS_GB18030, C_GB18030, "_GB18030"), /* RADIO set_charset_cb */
ENC_ACTION("Chinese/"CS_GB2312, C_GB2312, "_GB2312"), /* RADIO set_charset_cb */
ENC_ACTION("Chinese/"CS_GBK, C_GBK, "GB_K"), /* RADIO set_charset_cb */
ENC_ACTION("Chinese/"CS_BIG5, C_BIG5, "_Big5-JP"), /* RADIO set_charset_cb */
/* File menu */
MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/File", "SaveAs", "File/SaveAs", GTK_UI_MANAGER_MENUITEM)
-#if GTK_CHECK_VERSION(2,10,0) && !defined(USE_GNOMEPRINT)
MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/File", "PageSetup", "File/PageSetup", GTK_UI_MANAGER_MENUITEM)
-#endif
MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/File", "Print", "File/Print", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/File", "Separator1", "File/---", GTK_UI_MANAGER_SEPARATOR)
MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/File", "Close", "File/Close", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View", "Goto", "View/Goto", GTK_UI_MANAGER_MENU)
MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Goto", "Prev", "View/Goto/Prev", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Goto", "Next", "View/Goto/Next", GTK_UI_MANAGER_MENUITEM)
- MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Goto", "Separator1", "View/Goto/---", GTK_UI_MANAGER_MENUITEM)
+ MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Goto", "Separator1", "View/Goto/---", GTK_UI_MANAGER_SEPARATOR)
MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Goto", "PrevUnread", "View/Goto/PrevUnread", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Goto", "NextUnread", "View/Goto/NextUnread", GTK_UI_MANAGER_MENUITEM)
- MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Goto", "Separator2", "View/Goto/---", GTK_UI_MANAGER_MENUITEM)
+ MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Goto", "Separator2", "View/Goto/---", GTK_UI_MANAGER_SEPARATOR)
MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Goto", "PrevNew", "View/Goto/PrevNew", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Goto", "NextNew", "View/Goto/NextNew", GTK_UI_MANAGER_MENUITEM)
- MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Goto", "Separator3", "View/Goto/---", GTK_UI_MANAGER_MENUITEM)
+ MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Goto", "Separator3", "View/Goto/---", GTK_UI_MANAGER_SEPARATOR)
MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Goto", "PrevMarked", "View/Goto/PrevMarked", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Goto", "NextMarked", "View/Goto/NextMarked", GTK_UI_MANAGER_MENUITEM)
- MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Goto", "Separator4", "View/Goto/---", GTK_UI_MANAGER_MENUITEM)
+ MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Goto", "Separator4", "View/Goto/---", GTK_UI_MANAGER_SEPARATOR)
MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Goto", "PrevLabeled", "View/Goto/PrevLabeled", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Goto", "NextLabeled", "View/Goto/NextLabeled", GTK_UI_MANAGER_MENUITEM)
- MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Goto", "Separator5", "View/Goto/---", GTK_UI_MANAGER_MENUITEM)
+ MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Goto", "Separator5", "View/Goto/---", GTK_UI_MANAGER_SEPARATOR)
MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Goto", "LastRead", "View/Goto/LastRead", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Goto", "ParentMessage", "View/Goto/ParentMessage", GTK_UI_MANAGER_MENUITEM)
- MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Goto", "Separator6", "View/Goto/---", GTK_UI_MANAGER_MENUITEM)
+ MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Goto", "Separator6", "View/Goto/---", GTK_UI_MANAGER_SEPARATOR)
MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Goto", "NextUnreadFolder", "View/Goto/NextUnreadFolder", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Goto", "OtherFolder", "View/Goto/OtherFolder", GTK_UI_MANAGER_MENUITEM)
+ MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View", "Scroll", "View/Scroll", GTK_UI_MANAGER_MENU)
+ MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Scroll", "PrevLine", "View/Scroll/PrevLine", GTK_UI_MANAGER_MENUITEM)
+ MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Scroll", "NextLine", "View/Scroll/NextLine", GTK_UI_MANAGER_MENUITEM)
+ MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Scroll", "PrevPage", "View/Scroll/PrevPage", GTK_UI_MANAGER_MENUITEM)
+ MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Scroll", "NextPage", "View/Scroll/NextPage", GTK_UI_MANAGER_MENUITEM)
+
MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View", "Separator1", "View/---", GTK_UI_MANAGER_SEPARATOR)
MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View", "Encoding", "View/Encoding", GTK_UI_MANAGER_MENU)
MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Encoding/Japanese", CS_SHIFT_JIS, "View/Encoding/Japanese/"CS_SHIFT_JIS, GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Encoding", "Chinese", "View/Encoding/Chinese", GTK_UI_MANAGER_MENU)
+ MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Encoding/Chinese", CS_GB18030, "View/Encoding/Chinese/"CS_GB18030, GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Encoding/Chinese", CS_GB2312, "View/Encoding/Chinese/"CS_GB2312, GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Encoding/Chinese", CS_GBK, "View/Encoding/Chinese/"CS_GBK, GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Encoding/Chinese", CS_BIG5, "View/Encoding/Chinese/"CS_BIG5, GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View", "MessageSource", "View/MessageSource", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View", "AllHeaders", "View/AllHeaders", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View", "Quotes", "View/Quotes", GTK_UI_MANAGER_MENU)
- MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Quotes", "FoldAll", "View/Quotes/FoldAll", GTK_UI_MANAGER_MENUITEM)
- MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Quotes", "Fold2", "View/Quotes/Fold2", GTK_UI_MANAGER_MENUITEM)
- MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Quotes", "Fold3", "View/Quotes/Fold3", GTK_UI_MANAGER_MENUITEM)
+ MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Quotes", "CollapseAll", "View/Quotes/CollapseAll", GTK_UI_MANAGER_MENUITEM)
+ MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Quotes", "Collapse2", "View/Quotes/Collapse2", GTK_UI_MANAGER_MENUITEM)
+ MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Quotes", "Collapse3", "View/Quotes/Collapse3", GTK_UI_MANAGER_MENUITEM)
/* Message menu */
MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/Message", "Compose", "Message/Compose", GTK_UI_MANAGER_MENUITEM)
gtk_widget_set_size_request(window, prefs_common.msgwin_width,
prefs_common.msgwin_height);
+#ifdef G_OS_WIN32
+ gtk_window_move(GTK_WINDOW(window), 48, 48);
+#endif
msgview = messageview_create(mainwin);
{
char *src;
- g_return_if_fail(src_ != NULL);
- g_return_if_fail(dest != NULL);
+ cm_return_if_fail(src_ != NULL);
+ cm_return_if_fail(dest != NULL);
if (len < 1) return;
addrp = addr;
/* write queue headers */
- if (fprintf(fp, "AF:\n"
+ ok = fprintf(fp, "AF:\n"
"NF:0\n"
"PS:10\n"
"SRH:1\n"
"R:<%s>\n",
account->address,
account->smtp_server?account->smtp_server:"",
- addrp) < 0) {
- g_free(addrp);
- fclose(fp);
- claws_unlink(tmp);
- return -1;
- }
+ addrp);
g_free(addrp);
+ if (ok < 0)
+ goto FILE_ERROR;
/* check whether we need to save the message */
outbox = account_get_special_folder(account, F_OUTBOX);
outbox = NULL;
if (outbox) {
path = folder_item_get_identifier(outbox);
- if (fprintf(fp, "SCF:%s\n", path) < 0) {
- g_free(path);
- fclose(fp);
- claws_unlink(tmp);
- return -1;
- }
+ ok = fprintf(fp, "SCF:%s\n", path);
g_free(path);
+
+ if (ok < 0)
+ goto FILE_ERROR;
}
- if (fprintf(fp, "X-Claws-End-Special-Headers: 1\n") < 0) {
- fclose(fp);
- claws_unlink(tmp);
- return -1;
- }
+ if (fprintf(fp, "X-Claws-End-Special-Headers: 1\n") < 0)
+ goto FILE_ERROR;
/* Date */
get_rfc822_date(buf, sizeof(buf));
- if (fprintf(fp, "Date: %s\n", buf) < 0) {
- fclose(fp);
- claws_unlink(tmp);
- return -1;
- }
+ if (fprintf(fp, "Date: %s\n", buf) < 0)
+ goto FILE_ERROR;
/* From */
if (account->name && *account->name) {
notification_convert_header
(buf, sizeof(buf), account->name,
strlen("From: "));
- if (fprintf(fp, "From: %s <%s>\n", buf, account->address) < 0) {
- fclose(fp);
- claws_unlink(tmp);
- return -1;
- }
+ if (fprintf(fp, "From: %s <%s>\n", buf, account->address) < 0)
+ goto FILE_ERROR;
} else
- if (fprintf(fp, "From: %s\n", account->address) < 0) {
- fclose(fp);
- claws_unlink(tmp);
- return -1;
- }
+ if (fprintf(fp, "From: %s\n", account->address) < 0)
+ goto FILE_ERROR;
-
- if (fprintf(fp, "To: %s\n", to) < 0) {
- fclose(fp);
- claws_unlink(tmp);
- return -1;
- }
+ if (fprintf(fp, "To: %s\n", to) < 0)
+ goto FILE_ERROR;
/* Subject */
notification_convert_header(buf, sizeof(buf), msginfo->subject,
strlen("Subject: "));
- if (fprintf(fp, "Subject: Disposition notification: %s\n", buf) < 0) {
- fclose(fp);
- claws_unlink(tmp);
- return -1;
- }
+ if (fprintf(fp, "Subject: Disposition notification: %s\n", buf) < 0)
+ goto FILE_ERROR;
/* Message ID */
if (account->set_domain && account->domain) {
}
if (account->gen_msgid) {
- generate_msgid(buf, sizeof(buf));
-
- if (fprintf(fp, "Message-ID: <%s>\n", buf) < 0) {
- fclose(fp);
- claws_unlink(tmp);
- return -1;
+ gchar *addr = NULL;
+ if (account->msgid_with_addr) {
+ addr = account->address;
}
+ generate_msgid(buf, sizeof(buf), addr);
+
+ if (fprintf(fp, "Message-ID: <%s>\n", buf) < 0)
+ goto FILE_ERROR;
}
boundary = generate_mime_boundary("DN");
qp_encode_line(enc_sub, (const guchar *)msginfo->subject);
g_strstrip(enc_sub);
}
- if (fprintf(fp, "MIME-Version: 1.0\n"
+ ok = fprintf(fp,"MIME-Version: 1.0\n"
"Content-Type: multipart/report; report-type=disposition-notification;\n"
" boundary=\"%s\"\n"
"\n"
orig_to?orig_to:"No To:",
account->address,
msginfo->msgid?msginfo->msgid:"NO MESSAGE ID",
- boundary) < 0) {
- fclose(fp);
- claws_unlink(tmp);
- g_free(boundary);
- return -1;
- }
+ boundary);
g_free(enc_sub);
g_free(orig_to);
g_free(date);
g_free(boundary);
+ if (ok < 0)
+ goto FILE_ERROR;
+
if (fclose(fp) == EOF) {
FILE_OP_ERROR(tmp, "fclose");
claws_unlink(tmp);
/* send it */
path = folder_item_fetch_msg(queue, num);
- ok = procmsg_send_message_queue(path, &foo, queue, num, &queued_removed);
+ ok = procmsg_send_message_queue_with_lock(path, &foo, queue, num, &queued_removed);
g_free(path);
g_free(foo);
if (ok == 0 && !queued_removed)
folder_item_remove_msg(queue, num);
return ok;
+
+FILE_ERROR:
+ fclose(fp);
+ claws_unlink(tmp);
+ return -1;
}
static gboolean find_encrypted_func(GNode *node, gpointer data)
return encinfo;
}
+static gboolean find_broken_func(GNode *node, gpointer data)
+{
+ MimeInfo *mimeinfo = (MimeInfo *) node->data;
+ MimeInfo **brokeninfo = (MimeInfo **) data;
+
+ if (mimeinfo->broken) {
+ *brokeninfo = mimeinfo;
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+static MimeInfo *find_broken_part(MimeInfo *rootinfo)
+{
+ MimeInfo *brokeninfo = NULL;
+
+ g_node_traverse(rootinfo->node, G_IN_ORDER, G_TRAVERSE_ALL, -1,
+ find_broken_func, &brokeninfo);
+
+ return brokeninfo;
+}
+
gint messageview_show(MessageView *messageview, MsgInfo *msginfo,
gboolean all_headers)
{
gchar *text = NULL;
gchar *file;
- MimeInfo *mimeinfo, *encinfo;
+ MimeInfo *mimeinfo, *encinfo, *brokeninfo;
gchar *subject = NULL;
- g_return_val_if_fail(msginfo != NULL, -1);
+ cm_return_val_if_fail(msginfo != NULL, -1);
if (msginfo != messageview->msginfo)
messageview->show_full_text = FALSE;
noticeview_set_icon(messageview->noticeview,
STOCK_PIXMAP_NOTICE_WARN);
noticeview_set_text(messageview->noticeview, text);
+ gtk_widget_hide(messageview->noticeview->button);
+ gtk_widget_hide(messageview->noticeview->button2);
g_free(text);
break;
}
return_receipt_show(messageview->noticeview,
messageview->msginfo);
+ if ((brokeninfo = find_broken_part(mimeinfo)) != NULL) {
+ noticeview_set_icon(messageview->noticeview,
+ STOCK_PIXMAP_NOTICE_WARN);
+ if (!noticeview_is_visible(messageview->noticeview)) {
+ noticeview_set_text(messageview->noticeview, _("Message doesn't conform to MIME standard. "
+ "It may render wrongly."));
+ gtk_widget_hide(messageview->noticeview->button);
+ gtk_widget_hide(messageview->noticeview->button2);
+ } else {
+ gchar *full = g_strconcat(
+ gtk_label_get_text(GTK_LABEL(messageview->noticeview->text)),
+ "\n",
+ _("Message doesn't conform to MIME standard. "
+ "It may render wrongly."), NULL);
+ noticeview_set_text(messageview->noticeview, full);
+ g_free(full);
+ }
+ noticeview_show(messageview->noticeview);
+ }
+
mimeinfo = procmime_mimeinfo_next(mimeinfo);
if (!all_headers && mimeinfo
&& (mimeinfo->type != MIMETYPE_TEXT ||
MimeInfo *alt_parent = mimeinfo;
/* if multipart/{related,mixed} part, look inside for a multipart/alternative child */
- if (prefs_common.promote_html_part &&
- mimeinfo->type == MIMETYPE_MULTIPART &&
+ if (mimeinfo->type == MIMETYPE_MULTIPART &&
(!strcasecmp(mimeinfo->subtype, "related") ||
!strcasecmp(mimeinfo->subtype, "mixed"))) {
for (; mimeinfo; mimeinfo = procmime_mimeinfo_next(mimeinfo)) {
break;
}
if (mimeinfo->type == MIMETYPE_TEXT &&
- !strcasecmp(mimeinfo->subtype, "html")) {
- /* we got it */
+ !strcasecmp(mimeinfo->subtype, "calendar") &&
+ mimeview_has_viewer_for_content_type(messageview->mimeview,
+ "text/calendar")) {
+ mimeview_select_mimepart_icon(messageview->mimeview, mimeinfo);
+ goto done;
+ } else if (mimeinfo->type == MIMETYPE_TEXT &&
+ !strcasecmp(mimeinfo->subtype, "html") &&
+ prefs_common.promote_html_part) {
mimeview_select_mimepart_icon(messageview->mimeview, mimeinfo);
goto done;
}
/* if we now have a multipart/alternative part (possibly inside a
* multipart/{related,mixed} part, look for an HTML part inside */
- if (prefs_common.promote_html_part && mimeinfo &&
- mimeinfo->type == MIMETYPE_MULTIPART &&
+ if (mimeinfo && mimeinfo->type == MIMETYPE_MULTIPART &&
!strcasecmp(mimeinfo->subtype, "alternative")) {
for (; mimeinfo; mimeinfo = procmime_mimeinfo_next(mimeinfo)) {
if (mimeinfo->node->parent != alt_parent->node) {
continue;
}
if (mimeinfo->type == MIMETYPE_TEXT &&
- !strcasecmp(mimeinfo->subtype, "html")) {
- /* we got it */
+ !strcasecmp(mimeinfo->subtype, "calendar") &&
+ mimeview_has_viewer_for_content_type(messageview->mimeview,
+ "text/calendar")) {
+ mimeview_select_mimepart_icon(messageview->mimeview, mimeinfo);
+ goto done;
+ } else if (mimeinfo->type == MIMETYPE_TEXT &&
+ !strcasecmp(mimeinfo->subtype, "html") &&
+ prefs_common.promote_html_part) {
mimeview_select_mimepart_icon(messageview->mimeview, mimeinfo);
goto done;
}
}
}
done:
+ /* plugins may hook in here to work with the message view */
+ hooks_invoke(MESSAGE_VIEW_SHOW_DONE_HOOKLIST, messageview);
+
g_free(file);
return 0;
} else {
msginfo = msgview->msginfo;
- g_return_if_fail(msginfo != NULL);
+ cm_return_if_fail(msginfo != NULL);
/* to get the trash folder, we have to choose either
* the folder's or account's trash default - we prefer
trash = folder_get_default_trash();
}
- g_return_if_fail(trash != NULL);
+ cm_return_if_fail(trash != NULL);
if (prefs_common.immediate_exec)
/* TODO: Delete from trash */
{
SummaryView *summaryview = (SummaryView*)msgview->mainwin->summaryview;
- g_return_if_fail(summaryview != NULL);
+ cm_return_if_fail(summaryview != NULL);
if (summaryview->selected) {
MsgInfo *msginfo = summary_get_selected_msg(summaryview);
static void messageview_size_allocate_cb(GtkWidget *widget,
GtkAllocation *allocation)
{
- g_return_if_fail(allocation != NULL);
+ cm_return_if_fail(allocation != NULL);
prefs_common.msgwin_width = allocation->width;
prefs_common.msgwin_height = allocation->height;
static gboolean key_pressed(GtkWidget *widget, GdkEventKey *event,
MessageView *messageview)
{
- if (event && event->keyval == GDK_Escape && messageview->window) {
+ if (event && event->keyval == GDK_KEY_Escape && messageview->window) {
messageview_destroy(messageview);
return TRUE;
}
- if ((event->state & (GDK_MOD1_MASK|GDK_CONTROL_MASK|GDK_SHIFT_MASK)) != 0)
+ if (event && (event->state & (GDK_MOD1_MASK|GDK_CONTROL_MASK)) != 0)
+ return FALSE;
+ if (event && (event->state & GDK_SHIFT_MASK) && event->keyval != GDK_KEY_space)
return FALSE;
- g_signal_stop_emission_by_name(G_OBJECT(widget),
- "key_press_event");
- mimeview_pass_key_press_event(messageview->mimeview, event);
- return FALSE;
+ return mimeview_pass_key_press_event(messageview->mimeview, event);
}
#endif
GtkWidget *optmenu;
gint account_id;
- g_return_val_if_fail(ac_list != NULL, NULL);
- g_return_val_if_fail(ac_list->data != NULL, NULL);
+ cm_return_val_if_fail(ac_list != NULL, NULL);
+ cm_return_val_if_fail(ac_list->data != NULL, NULL);
optmenu = gtkut_account_menu_new(ac_list,
G_CALLBACK(select_account_cb),
GtkTextBuffer *textbuf;
gint body_pos = 0;
- g_return_val_if_fail(msgview != NULL, NULL);
+ cm_return_val_if_fail(msgview != NULL, NULL);
if (msgview->mimeview->type == MIMEVIEW_VIEWER) {
MimeViewer *viewer = msgview->mimeview->mimeviewer;
}
textview = messageview_get_current_textview(msgview);
- g_return_val_if_fail(textview != NULL, NULL);
+ cm_return_val_if_fail(textview != NULL, NULL);
edit = GTK_TEXT_VIEW(textview->text);
- g_return_val_if_fail(edit != NULL, NULL);
+ cm_return_val_if_fail(edit != NULL, NULL);
body_pos = textview->body_pos;
textbuf = gtk_text_view_get_buffer(edit);
messageview_save_as(messageview);
}
-#if defined(USE_GNOMEPRINT) || GTK_CHECK_VERSION(2,10,0)
static void print_mimeview(MimeView *mimeview, gint sel_start, gint sel_end, gint partnum)
{
-#if !defined(USE_GNOMEPRINT) && GTK_CHECK_VERSION(2,10,0)
MainWindow *mainwin;
-#endif
if (!mimeview
|| !mimeview->textview
|| !mimeview->textview->text)
gtk_text_buffer_get_iter_at_offset(buffer, &end, sel_end);
gtk_text_buffer_select_range(buffer, &start, &end);
}
-#if defined(USE_GNOMEPRINT)
- gedit_print(GTK_TEXT_VIEW(mimeview->textview->text));
-#else
/* TODO: Get the real parent window, not the main window */
mainwin = mainwindow_get_mainwindow();
printing_print(GTK_TEXT_VIEW(mimeview->textview->text),
mainwin ? GTK_WINDOW(mainwin->window) : NULL,
sel_start, sel_end);
-#endif
}
}
}
messageview_destroy(tmpview);
}
-#endif
-#if GTK_CHECK_VERSION(2,10,0) && !defined(USE_GNOMEPRINT)
static void page_setup_cb(GtkAction *action, gpointer data)
{
MessageView *messageview = (MessageView *)data;
printing_page_setup(messageview ?
GTK_WINDOW(messageview->window) : NULL);
}
-#endif
static void print_cb(GtkAction *action, gpointer data)
{
MessageView *messageview = (MessageView *)data;
-#if !defined(USE_GNOMEPRINT) && !GTK_CHECK_VERSION(2,10,0)
- gchar *cmdline = NULL;
- gchar *p;
-#else
gint sel_start = -1, sel_end = -1, partnum = 0;
-#endif
if (!messageview->msginfo) return;
-#if !defined(USE_GNOMEPRINT) && !GTK_CHECK_VERSION(2,10,0)
- cmdline = input_dialog(_("Print"),
- _("Enter the print command-line:\n"
- "('%s' will be replaced with file name)"),
- prefs_common.print_cmd);
- if (!cmdline) return;
- if (!(p = strchr(cmdline, '%')) || *(p + 1) != 's' ||
- strchr(p + 2, '%')) {
- alertpanel_error(_("Print command-line is invalid:\n'%s'"),
- cmdline);
- g_free(cmdline);
- return;
- }
- procmsg_print_message(messageview->msginfo, cmdline);
- g_free(cmdline);
-#else
partnum = mimeview_get_selected_part_num(messageview->mimeview);
textview_get_selection_offsets(messageview->mimeview->textview,
&sel_start, &sel_end);
messageview_print(messageview->msginfo, messageview->all_headers,
sel_start, sel_end, partnum);
-#endif
}
static void close_cb(GtkAction *action, gpointer data)
}
}
+static void scroll_prev_line_cb(GtkAction *action, gpointer data)
+{
+ MessageView *messageview = (MessageView *)data;
+ mimeview_scroll_one_line(messageview->mimeview,TRUE);
+}
+
+static void scroll_next_line_cb(GtkAction *action, gpointer data)
+{
+ MessageView *messageview = (MessageView *)data;
+ mimeview_scroll_one_line(messageview->mimeview,FALSE);
+}
+
+static void scroll_prev_page_cb(GtkAction *action, gpointer data)
+{
+ MessageView *messageview = (MessageView *)data;
+ mimeview_scroll_page(messageview->mimeview,TRUE);
+}
+
+static void scroll_next_page_cb(GtkAction *action, gpointer data)
+{
+ MessageView *messageview = (MessageView *)data;
+ mimeview_scroll_page(messageview->mimeview,FALSE);
+}
+
static void set_charset_cb(GtkAction *action, GtkRadioAction *current, gpointer data)
{
MessageView *messageview = (MessageView *)data;
return;
if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action))) {
const gchar *a_name = gtk_action_get_name(GTK_ACTION(action));
- if (!strcmp(a_name, "View/Quotes/FoldAll")) prefs_common.hide_quotes = 1;
- else if (!strcmp(a_name, "View/Quotes/Fold2")) prefs_common.hide_quotes = 2;
- else if (!strcmp(a_name, "View/Quotes/Fold3")) prefs_common.hide_quotes = 3;
+ if (!strcmp(a_name, "View/Quotes/CollapseAll")) prefs_common.hide_quotes = 1;
+ else if (!strcmp(a_name, "View/Quotes/Collapse2")) prefs_common.hide_quotes = 2;
+ else if (!strcmp(a_name, "View/Quotes/Collapse3")) prefs_common.hide_quotes = 3;
} else
prefs_common.hide_quotes = 0;
updating_menu=TRUE;
- cm_toggle_menu_set_active_full(messageview->ui_manager, "Menu/View/Quotes/FoldAll", (prefs_common.hide_quotes == 1));
- cm_toggle_menu_set_active_full(messageview->ui_manager, "Menu/View/Quotes/Fold2", (prefs_common.hide_quotes == 2));
- cm_toggle_menu_set_active_full(messageview->ui_manager, "Menu/View/Quotes/Fold3", (prefs_common.hide_quotes == 3));
+ cm_toggle_menu_set_active_full(messageview->ui_manager, "Menu/View/Quotes/CollapseAll", (prefs_common.hide_quotes == 1));
+ cm_toggle_menu_set_active_full(messageview->ui_manager, "Menu/View/Quotes/Collapse2", (prefs_common.hide_quotes == 2));
+ cm_toggle_menu_set_active_full(messageview->ui_manager, "Menu/View/Quotes/Collapse3", (prefs_common.hide_quotes == 3));
updating_menu=FALSE;
if (!msginfo) return;
if (item) {
ac = account_find_from_item(item);
if (ac && ac->protocol == A_NNTP &&
- item->stype == F_NEWS) {
+ FOLDER_TYPE(item->folder) == F_NEWS) {
compose_new(ac, item->path, NULL);
return;
}
gint action = COMPOSE_REPLY;
const gchar *a_name = gtk_action_get_name(gaction);
- g_return_if_fail(messageview->msginfo);
+ cm_return_if_fail(messageview->msginfo);
DO_ACTION("Message/Reply", COMPOSE_REPLY);
DO_ACTION("Message/ReplyTo/All", COMPOSE_REPLY_TO_ALL);
full_msginfo->extradata &&
full_msginfo->extradata->xface) {
image = xface_get_from_header(full_msginfo->extradata->xface,
- &messageview->mainwin->summaryview->ctree->style->white,
- messageview->window->window);
+ &(gtk_widget_get_style(messageview->mainwin->summaryview->ctree)->white),
+ gtk_widget_get_window(messageview->window));
}
#endif
procmsg_msginfo_free(full_msginfo);
/* do some smart things */
if (!messageview->menubar) return;
- cm_toggle_menu_set_active_full(messageview->ui_manager, "Menu/View/Quotes/FoldAll", (prefs_common.hide_quotes == 1));
- cm_toggle_menu_set_active_full(messageview->ui_manager, "Menu/View/Quotes/Fold2", (prefs_common.hide_quotes == 2));
- cm_toggle_menu_set_active_full(messageview->ui_manager, "Menu/View/Quotes/Fold3", (prefs_common.hide_quotes == 3));
+ cm_toggle_menu_set_active_full(messageview->ui_manager, "Menu/View/Quotes/CollapseAll", (prefs_common.hide_quotes == 1));
+ cm_toggle_menu_set_active_full(messageview->ui_manager, "Menu/View/Quotes/Collapse2", (prefs_common.hide_quotes == 2));
+ cm_toggle_menu_set_active_full(messageview->ui_manager, "Menu/View/Quotes/Collapse3", (prefs_common.hide_quotes == 3));
}
void messageview_learn (MessageView *msgview, gboolean is_spam)
{
GSList *cur = msgview->mimeview->textview->uri_list;
GSList *newlist = NULL;
- GHashTable *uri_hashtable = g_hash_table_new(g_str_hash, g_str_equal);
+ GHashTable *uri_hashtable;
+ gchar *tmp;
+
+ uri_hashtable = g_hash_table_new_full(g_str_hash, g_str_equal,
+ (GDestroyNotify) g_free, NULL);
+
for (; cur; cur = cur->next) {
ClickableText *uri = (ClickableText *)cur->data;
if (uri->uri &&
!g_ascii_strncasecmp(uri->uri, "http:", 5) ||
!g_ascii_strncasecmp(uri->uri, "https:", 6)))
{
- if(g_hash_table_lookup(uri_hashtable, uri->uri))
+ tmp = g_utf8_strdown(uri->uri, -1);
+
+ if (g_hash_table_lookup(uri_hashtable, tmp)) {
+ g_free(tmp);
continue;
+ }
newlist = g_slist_prepend(newlist, uri);
- g_hash_table_insert(uri_hashtable, uri->uri,
- GUINT_TO_POINTER(g_str_hash(uri->uri)));
+ g_hash_table_insert(uri_hashtable, tmp,
+ GUINT_TO_POINTER(g_str_hash(tmp)));
}
}
newlist = g_slist_reverse(newlist);