automatically select account for mail replys
authorChristoph Hohmann <reboot@gmx.ch>
Wed, 20 Jun 2001 14:09:16 +0000 (14:09 +0000)
committerChristoph Hohmann <reboot@gmx.ch>
Wed, 20 Jun 2001 14:09:16 +0000 (14:09 +0000)
src/compose.c
src/prefs_common.c
src/prefs_common.h

index bf745dab13e270505e38db51a785e04f5f0f661a..4cf8e994168d25bc0b3e5a532f79f343ae031bd9 100644 (file)
@@ -551,6 +551,14 @@ static void compose_generic_reply(MsgInfo *msginfo, gboolean quote,
        g_return_if_fail(msginfo->folder != NULL);
 
        account = msginfo->folder->folder->account;
+       if (!account && msginfo->to && prefs_common.reply_account_autoselect) {
+               gchar *to;
+
+               to = g_strdup(msginfo->to);
+               extract_address(to);
+               account = account_find_mail_from_address(to);
+               g_free(to);
+       }
        if (!account) account = cur_account;
        g_return_if_fail(account != NULL);
 
index affdcb4dd5dc372b1aa5931370e53615d491739d..da4ab0865f9c25e75de9d0ed96f0d4abf6eb7708 100644 (file)
@@ -102,6 +102,7 @@ static struct Compose {
        GtkWidget *checkbtn_wrapatsend;
 
        GtkWidget * checkbtn_forward_as_attachment;
+       GtkWidget * checkbtn_reply_account_autoselect;
 } compose;
 
 static struct Display {
@@ -283,6 +284,9 @@ static PrefParam param[] = {
        {"forward_as_attachment", "FALSE", &prefs_common.forward_as_attachment,
         P_BOOL, &compose.checkbtn_forward_as_attachment,
         prefs_set_data_from_toggle, prefs_set_toggle},
+       {"reply_account_autoselect", "TRUE", &prefs_common.reply_account_autoselect,
+        P_BOOL, &compose.checkbtn_reply_account_autoselect,
+        prefs_set_data_from_toggle, prefs_set_toggle},
 
        {"show_ruler", "TRUE", &prefs_common.show_ruler, P_BOOL,
         NULL, NULL, NULL},
@@ -1047,6 +1051,7 @@ static void prefs_compose_create(void)
        GtkWidget *checkbtn_wrapatsend;
 
        GtkWidget *checkbtn_forward_as_attachment;
+       GtkWidget *checkbtn_reply_account_autoselect;
 
        vbox1 = gtk_vbox_new (FALSE, VSPACING);
        gtk_widget_show (vbox1);
@@ -1175,6 +1180,8 @@ static void prefs_compose_create(void)
        PACK_CHECK_BUTTON (vbox1, checkbtn_forward_as_attachment,
                           _("Forward as attachment"));
 
+       PACK_CHECK_BUTTON (vbox1, checkbtn_reply_account_autoselect,
+                          _("Automatically select account for mail replys"));
 
        /*
        compose.checkbtn_quote   = checkbtn_quote;
@@ -1191,6 +1198,8 @@ static void prefs_compose_create(void)
 
        compose.checkbtn_forward_as_attachment =
                checkbtn_forward_as_attachment;
+       compose.checkbtn_reply_account_autoselect =
+               checkbtn_reply_account_autoselect;
 }
 
 static void date_format_ok_btn_clicked(GtkButton *button, GtkWidget **widget)
index ab528c71f5e8f025150fdf1075c4c95841effb8f..28ae02e844cc911d2e5b3e82961900cf42c89ec2 100644 (file)
@@ -65,6 +65,7 @@ struct _PrefsCommon
        gchar *fw_quotemark;
        gchar *fw_quotefmt;
        gboolean forward_as_attachment;
+       gboolean reply_account_autoselect;
 
        /* Display */
        gchar *widgetfont;