2011-12-02 [paul] 3.7.10cvs109
[claws.git] / src / messageview.c
index 974a06dfb8b4d49d1686915e71e13837d4c58f58..edc5d3d7443b74791c6a157b1b186278dc9b66a2 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * 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
@@ -58,7 +58,6 @@
 #include "hooks.h"
 #include "filtering.h"
 #include "partial_download.h"
-#include "gedit-print.h"
 #include "uri_opener.h"
 #include "inc.h"
 #include "log.h"
@@ -94,10 +93,8 @@ static void partial_recv_unmark_clicked (NoticeView  *noticeview,
                                          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,
@@ -138,6 +135,15 @@ static void goto_unread_folder_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);
 
@@ -193,9 +199,7 @@ static GtkActionEntry msgview_entries[] =
 
 /* 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) },
@@ -229,6 +233,12 @@ static GtkActionEntry msgview_entries[] =
        {"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, "---" },
@@ -276,13 +286,13 @@ static GtkActionEntry msgview_entries[] =
        {"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) }, 
@@ -303,9 +313,9 @@ static GtkActionEntry msgview_entries[] =
 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[] =
@@ -333,6 +343,7 @@ 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 */
@@ -454,9 +465,7 @@ static void messageview_add_toolbar(MessageView *msgview, GtkWidget *window)
 
 /* 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)
@@ -471,25 +480,31 @@ static void messageview_add_toolbar(MessageView *msgview, GtkWidget *window)
        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)
@@ -535,6 +550,7 @@ static void messageview_add_toolbar(MessageView *msgview, GtkWidget *window)
        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)
@@ -561,9 +577,9 @@ static void messageview_add_toolbar(MessageView *msgview, GtkWidget *window)
        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)
@@ -615,6 +631,9 @@ static void messageview_add_toolbar(MessageView *msgview, GtkWidget *window)
        hildon_window_set_menu(HILDON_WINDOW(window), GTK_MENU(menubar));
 #endif
 
+       cm_toggle_menu_set_active_full(msgview->ui_manager, "Menu/View/AllHeaders",
+                                       prefs_common.show_all_headers);
+
        if (prefs_common.toolbar_detachable) {
                handlebox = gtk_handle_box_new();
        } else {
@@ -730,8 +749,8 @@ static void notification_convert_header(gchar *dest, gint len,
 {
        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;
 
@@ -864,7 +883,7 @@ static gint disposition_notification_send(MsgInfo *msginfo)
        addrp = addr;
        
        /* write queue headers */
-       if (fprintf(fp, "AF:\n"
+       ok = fprintf(fp, "AF:\n"
                    "NF:0\n"
                    "PS:10\n"
                    "SRH:1\n"
@@ -880,14 +899,11 @@ static gint disposition_notification_send(MsgInfo *msginfo)
                    "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); 
@@ -895,61 +911,40 @@ static gint disposition_notification_send(MsgInfo *msginfo)
                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) {
@@ -964,13 +959,14 @@ static gint disposition_notification_send(MsgInfo *msginfo)
        }
        
        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");
@@ -985,7 +981,7 @@ static gint disposition_notification_send(MsgInfo *msginfo)
                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"
@@ -1034,18 +1030,16 @@ static gint disposition_notification_send(MsgInfo *msginfo)
                        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);
@@ -1075,13 +1069,18 @@ static gint disposition_notification_send(MsgInfo *msginfo)
 
        /* 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)
@@ -1107,14 +1106,37 @@ static MimeInfo *find_encrypted_part(MimeInfo *rootinfo)
        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, *root;
        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;
@@ -1220,9 +1242,6 @@ gint messageview_show(MessageView *messageview, MsgInfo *msginfo,
 
        messageview_set_position(messageview, 0);
 
-       textview_set_all_headers(messageview->mimeview->textview, 
-                       messageview->all_headers);
-
 #ifdef MAEMO
        maemo_window_full_screen_if_needed(GTK_WINDOW(messageview->window));
 #endif
@@ -1271,6 +1290,27 @@ gint messageview_show(MessageView *messageview, MsgInfo *msginfo,
                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);
+       }
+                       
+       root = mimeinfo;
        mimeinfo = procmime_mimeinfo_next(mimeinfo);
        if (!all_headers && mimeinfo 
                        && (mimeinfo->type != MIMETYPE_TEXT || 
@@ -1282,8 +1322,7 @@ gint messageview_show(MessageView *messageview, MsgInfo *msginfo,
                        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)) {
@@ -1299,8 +1338,14 @@ gint messageview_show(MessageView *messageview, MsgInfo *msginfo,
                                                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;
                                        }
@@ -1309,8 +1354,7 @@ gint messageview_show(MessageView *messageview, MsgInfo *msginfo,
 
                        /* 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) {
@@ -1320,8 +1364,14 @@ gint messageview_show(MessageView *messageview, MsgInfo *msginfo,
                                                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;
                                        }
@@ -1332,7 +1382,8 @@ gint messageview_show(MessageView *messageview, MsgInfo *msginfo,
                        if (!mimeinfo) 
                                mimeinfo = saved_mimeinfo;
 
-                       mimeview_show_part(messageview->mimeview,mimeinfo);
+                       if (!mimeview_show_part(messageview->mimeview, mimeinfo))
+                               mimeview_select_mimepart_icon(messageview->mimeview, root);
                        goto done;
                } else if (prefs_common.invoke_plugin_on_html) {
                        mimeview_select_mimepart_icon(messageview->mimeview, mimeinfo);
@@ -1352,7 +1403,12 @@ gint messageview_show(MessageView *messageview, MsgInfo *msginfo,
                        mimeinfo = procmime_mimeinfo_next(mimeinfo);
                }
        }
+
+       mimeview_select_mimepart_icon(messageview->mimeview, root);
 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;
@@ -1451,7 +1507,7 @@ void messageview_delete(MessageView *msgview)
        } 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
@@ -1466,7 +1522,7 @@ void messageview_delete(MessageView *msgview)
                                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 */
@@ -1493,7 +1549,7 @@ static void messageview_update(MessageView *msgview, MsgInfo *old_msginfo)
 {
        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);
@@ -1656,7 +1712,7 @@ static gint messageview_delete_cb(GtkWidget *widget, GdkEventAny *event,
 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;
@@ -1665,18 +1721,17 @@ static void messageview_size_allocate_cb(GtkWidget *widget,
 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
 
@@ -1870,8 +1925,8 @@ static PrefsAccount *select_account_from_list(GList *ac_list)
        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),
@@ -1907,7 +1962,7 @@ gchar *messageview_get_selection(MessageView *msgview)
        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;
@@ -1919,10 +1974,10 @@ gchar *messageview_get_selection(MessageView *msgview)
        }
 
        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);
@@ -1946,12 +2001,9 @@ static void save_as_cb(GtkAction *action, gpointer data)
        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)
@@ -1978,15 +2030,11 @@ static void print_mimeview(MimeView *mimeview, gint sel_start, gint sel_end, gin
                        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
        }
 }
 
@@ -2018,51 +2066,26 @@ void messageview_print(MsgInfo *msginfo, gboolean all_headers,
        }
        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)
@@ -2445,6 +2468,30 @@ static void goto_folder_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;
@@ -2501,13 +2548,14 @@ static void show_all_header_cb(GtkToggleAction *action, gpointer data)
        if (messageview->updating)
                return;
 
-       messageview->all_headers = 
+       messageview->all_headers = prefs_common.show_all_headers =
                        gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
        if (!msginfo) return;
        messageview->msginfo = NULL;
-       messageview_show(messageview, msginfo,gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)));
+       messageview_show(messageview, msginfo, messageview->all_headers);
        procmsg_msginfo_free(msginfo);
        main_window_set_menu_sensitive(messageview->mainwin);
+       summary_redisplay_msg(messageview->mainwin->summaryview);
 }
 
 static void msg_hide_quotes_cb(GtkToggleAction *action, gpointer data)
@@ -2520,17 +2568,17 @@ static void msg_hide_quotes_cb(GtkToggleAction *action, gpointer 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;
@@ -2557,7 +2605,7 @@ static void compose_cb(GtkAction *action, gpointer data)
        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;
                }
@@ -2575,7 +2623,7 @@ static void reply_cb(GtkAction *gaction, gpointer data)
        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);
@@ -2622,8 +2670,8 @@ static void add_address_cb(GtkAction *action, gpointer data)
                 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);
@@ -2709,9 +2757,9 @@ void messageview_set_menu_sensitive(MessageView *messageview)
        /* 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)
@@ -2742,7 +2790,12 @@ void messageview_list_urls (MessageView  *msgview)
 {
        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 &&
@@ -2752,12 +2805,16 @@ void messageview_list_urls (MessageView *msgview)
                     !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);