2007-09-16 [colin] 3.0.0cvs17
[claws.git] / src / messageview.c
index 2ad85b02426ed2f7cb2cb5d5b79b43f54cbf3c70..028f0d07e6b51b6900bff7d937000ef41be47abf 100644 (file)
@@ -66,6 +66,7 @@
 #include "uri_opener.h"
 #include "inc.h"
 #include "log.h"
+#include "combobox.h"
 
 static GList *messageview_list = NULL;
 
@@ -153,7 +154,8 @@ static void open_urls_cb            (gpointer        data,
 static void about_cb                   (gpointer        data,
                                         guint           action,
                                         GtkWidget      *widget);
-static void messageview_update         (MessageView *msgview);
+static void messageview_update         (MessageView    *msgview,
+                                        MsgInfo        *old_msginfo);
 static gboolean messageview_update_msg (gpointer source, gpointer data);
 
 static GList *msgview_list = NULL;
@@ -586,7 +588,7 @@ static gint disposition_notification_send(MsgInfo *msginfo)
        if (ok != 0) {
                AlertValue val;
                gchar *message;
-               message = g_strdup_printf(
+               message = g_markup_printf_escaped(
                  _("The notification address to which the return receipt is\n"
                    "to be sent does not correspond to the return path:\n"
                    "Notification address: %s\n"
@@ -707,6 +709,16 @@ static gint disposition_notification_send(MsgInfo *msginfo)
        fprintf(fp, "Subject: Disposition notification: %s\n", buf);
 
        /* Message ID */
+       if (account->set_domain && account->domain) {
+               g_snprintf(buf, sizeof(buf), "%s", account->domain); 
+       } else if (!strncmp(get_domain_name(), "localhost", strlen("localhost"))) {
+               g_snprintf(buf, sizeof(buf), "%s", 
+                       strchr(account->address, '@') ?
+                               strchr(account->address, '@')+1 :
+                               account->address);
+       } else {
+               g_snprintf(buf, sizeof(buf), "%s", "");
+       }
        generate_msgid(buf, sizeof(buf));
        fprintf(fp, "Message-ID: <%s>\n", buf);
 
@@ -869,7 +881,9 @@ gint messageview_show(MessageView *messageview, MsgInfo *msginfo,
        }
        mimeview_show_message(messageview->mimeview, mimeinfo, file);
        
+#ifndef MAEMO
        messageview_set_position(messageview, 0);
+#endif
 
        if (messageview->window && msginfo->subject) {
                subject = g_strdup(msginfo->subject);
@@ -951,12 +965,14 @@ void messageview_destroy(MessageView *messageview)
        debug_print("destroy messageview\n");
        messageview_list = g_list_remove(messageview_list, messageview);
 
-       if (messageview->mainwin->summaryview->messageview == messageview)
+       if (messageview->mainwin->summaryview->messageview == messageview) {
+               messageview->mainwin->summaryview->displayed = NULL;
                messageview->mainwin->summaryview->messageview = NULL;
-
-       if (messageview->mainwin->summaryview->ext_messageview == messageview)
+       }
+       if (messageview->mainwin->summaryview->ext_messageview == messageview) {
+               messageview->mainwin->summaryview->displayed = NULL;
                messageview->mainwin->summaryview->ext_messageview = NULL;
-
+       }
        if (!messageview->deferred_destroy) {
                hooks_unregister_hook(MSGINFO_UPDATE_HOOKLIST,
                              messageview->msginfo_update_callback_id);
@@ -1051,7 +1067,7 @@ void messageview_delete(MessageView *msgview)
  *        leave unchanged if summaryview is empty
  * \param pointer to MessageView
  */    
-static void messageview_update(MessageView *msgview)
+static void messageview_update(MessageView *msgview, MsgInfo *old_msginfo)
 {
        SummaryView *summaryview = (SummaryView*)msgview->mainwin->summaryview;
 
@@ -1059,7 +1075,7 @@ static void messageview_update(MessageView *msgview)
        
        if (summaryview->selected) {
                MsgInfo *msginfo = summary_get_selected_msg(summaryview);
-               if (msginfo == NULL)
+               if (msginfo == NULL || msginfo == old_msginfo)
                        return;
 
                messageview_show(msgview, msginfo, 
@@ -1400,26 +1416,22 @@ static void partial_recv_unmark_clicked(NoticeView *noticeview,
 
 static void select_account_cb(GtkWidget *w, gpointer data)
 {
-       *(gint*)data = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(w), MENU_VAL_ID));
+       *(gint*)data = combobox_get_active_data(GTK_COMBO_BOX(w));
 }
-       
+
 static PrefsAccount *select_account_from_list(GList *ac_list)
 {
        GtkWidget *optmenu;
-       GtkWidget *menu;
        gint account_id;
 
        g_return_val_if_fail(ac_list != NULL, NULL);
        g_return_val_if_fail(ac_list->data != NULL, NULL);
        
-       optmenu = gtk_option_menu_new();
-       menu = gtkut_account_menu_new(ac_list, 
-                       G_CALLBACK(select_account_cb), 
+       optmenu = gtkut_account_menu_new(ac_list,
+                       G_CALLBACK(select_account_cb),
                        &account_id);
-       if (!menu)
+       if (!optmenu)
                return NULL;
-       gtk_option_menu_set_menu(GTK_OPTION_MENU(optmenu), menu);
-       gtk_option_menu_set_history(GTK_OPTION_MENU(optmenu), 0);
        account_id = ((PrefsAccount *) ac_list->data)->account_id;
        if (alertpanel_with_widget(
                                _("Return Receipt Notification"),
@@ -1807,8 +1819,9 @@ static gboolean messageview_update_msg(gpointer source, gpointer data)
                return FALSE;
 
        if (msginfo_update->flags & MSGINFO_UPDATE_DELETED) {
+               MsgInfo *old_msginfo = messageview->msginfo;
                messageview_clear(messageview);
-               messageview_update(messageview);
+               messageview_update(messageview, old_msginfo);
        }
 
        return FALSE;
@@ -1873,10 +1886,13 @@ void messageview_list_urls (MessageView *msgview)
        GSList *newlist = NULL;
        for (; cur; cur = cur->next) {
                ClickableText *uri = (ClickableText *)cur->data;
-               if (!uri->uri || !g_ascii_strncasecmp(uri->uri, "mailto:", 7) 
-               ||  uri->is_quote)
-                       continue;
-               newlist = g_slist_prepend(newlist, uri);
+               if (uri->uri &&
+                   (!g_ascii_strncasecmp(uri->uri, "ftp.", 4) ||
+                    !g_ascii_strncasecmp(uri->uri, "ftp:", 4) ||
+                    !g_ascii_strncasecmp(uri->uri, "www.", 4) ||
+                    !g_ascii_strncasecmp(uri->uri, "http:", 5) ||
+                    !g_ascii_strncasecmp(uri->uri, "https:", 6)))
+                       newlist = g_slist_prepend(newlist, uri);
        }
        newlist = g_slist_reverse(newlist);
        uri_opener_open(msgview, newlist);