sync with 0.8.1cvs21
[claws.git] / src / prefs_account.c
index 41361889b0077a8285f9f80180c945d446fd74f2..e24e03692d68d47b027e9025bb8706a18a5f10d5 100644 (file)
@@ -46,6 +46,7 @@
 #include "gtkutils.h"
 #include "utils.h"
 #include "alertpanel.h"
+#include "colorlabel.h"
 
 static gboolean cancelled;
 
@@ -85,7 +86,10 @@ static struct Basic {
 static struct Receive {
        GtkWidget *pop3_frame;
        GtkWidget *rmmail_chkbtn;
+       GtkWidget *leave_time_entry;
        GtkWidget *getall_chkbtn;
+       GtkWidget *sd_filter_on_recv_chkbtn;
+       GtkWidget *sd_rmmail_chkbtn;
        GtkWidget *size_limit_chkbtn;
        GtkWidget *size_limit_entry;
        GtkWidget *filter_on_recv_chkbtn;
@@ -93,9 +97,6 @@ static struct Receive {
        GtkWidget *inbox_entry;
        GtkWidget *inbox_btn;
 
-       GtkWidget *imap_frame;
-       GtkWidget *imapdir_entry;
-
        GtkWidget *recvatgetall_chkbtn;
 } receive;
 
@@ -106,14 +107,15 @@ static struct Send {
        GtkWidget *customhdr_chkbtn;
 
        GtkWidget *smtp_auth_chkbtn;
-       GtkWidget *smtp_userid_entry;
-       GtkWidget *smtp_passwd_entry;
+       GtkWidget *smtp_auth_type_optmenu;
+       GtkWidget *smtp_uid_entry;
+       GtkWidget *smtp_pass_entry;
        GtkWidget *pop_bfr_smtp_chkbtn;
-} send;
+} p_send;
 
 static struct Compose {
        GtkWidget *sigpath_entry;
-        
+
        GtkWidget *autocc_chkbtn;
        GtkWidget *autocc_entry;
        GtkWidget *autobcc_chkbtn;
@@ -124,9 +126,9 @@ static struct Compose {
 
 #if USE_GPGME
 static struct Privacy {
-       GtkWidget *checkbtn_default_encrypt;
-       GtkWidget *checkbtn_ascii_armored;
-       GtkWidget *checkbtn_default_sign;
+       GtkWidget *default_encrypt_chkbtn;
+       GtkWidget *default_sign_chkbtn;
+       GtkWidget *ascii_armored_chkbtn;
        GtkWidget *defaultkey_radiobtn;
        GtkWidget *emailkey_radiobtn;
        GtkWidget *customkey_radiobtn;
@@ -136,14 +138,24 @@ static struct Privacy {
 
 #if USE_SSL
 static struct SSLPrefs {
-       GtkWidget *receive_frame;
-       GtkWidget *pop_chkbtn;
-       GtkWidget *imap_chkbtn;
+       GtkWidget *pop_frame;
+       GtkWidget *pop_nossl_radiobtn;
+       GtkWidget *pop_ssltunnel_radiobtn;
+       GtkWidget *pop_starttls_radiobtn;
+
+       GtkWidget *imap_frame;
+       GtkWidget *imap_nossl_radiobtn;
+       GtkWidget *imap_ssltunnel_radiobtn;
+       GtkWidget *imap_starttls_radiobtn;
+
+       GtkWidget *nntp_frame;
+       GtkWidget *nntp_nossl_radiobtn;
+       GtkWidget *nntp_ssltunnel_radiobtn;
 
        GtkWidget *send_frame;
        GtkWidget *smtp_nossl_radiobtn;
        GtkWidget *smtp_ssltunnel_radiobtn;
-       GtkWidget *smtp_sslstarttls_radiobtn;
+       GtkWidget *smtp_starttls_radiobtn;
 } ssl;
 #endif /* USE_SSL */
 
@@ -163,6 +175,18 @@ static struct Advanced {
        GtkWidget *domain_entry;
        GtkWidget *tunnelcmd_chkbtn;
        GtkWidget *tunnelcmd_entry;
+       GtkWidget *crosspost_chkbtn;
+       GtkWidget *crosspost_colormenu;
+
+       GtkWidget *imap_frame;
+       GtkWidget *imapdir_entry;
+
+       GtkWidget *sent_folder_chkbtn;
+       GtkWidget *sent_folder_entry;
+       GtkWidget *draft_folder_chkbtn;
+       GtkWidget *draft_folder_entry;
+       GtkWidget *trash_folder_chkbtn;
+       GtkWidget *trash_folder_entry;
 } advanced;
 
 static void prefs_account_fix_size                     (void);
@@ -170,13 +194,23 @@ static void prefs_account_fix_size                        (void);
 static void prefs_account_protocol_set_data_from_optmenu(PrefParam *pparam);
 static void prefs_account_protocol_set_optmenu         (PrefParam *pparam);
 static void prefs_account_protocol_activated           (GtkMenuItem *menuitem);
+
+static void prefs_account_smtp_auth_type_set_data_from_optmenu
+                                                       (PrefParam *pparam);
+static void prefs_account_smtp_auth_type_set_optmenu   (PrefParam *pparam);
+
 #if USE_GPGME || USE_SSL
 static void prefs_account_enum_set_data_from_radiobtn  (PrefParam *pparam);
 static void prefs_account_enum_set_radiobtn            (PrefParam *pparam);
-static void prefs_account_ascii_armored_warning(GtkWidget* widget, 
-                                              gpointer unused);
 #endif /* USE_GPGME || USE_SSL */
 
+#if USE_GPGME
+static void prefs_account_ascii_armored_warning                (GtkWidget *widget);
+#endif /* USE_GPGME */
+
+static void prefs_account_crosspost_set_data_from_colormenu(PrefParam *pparam);
+static void prefs_account_crosspost_set_colormenu(PrefParam *pparam);
+
 static void prefs_account_nntpauth_toggled(GtkToggleButton *button,
                                           gpointer user_data);
 static void prefs_account_mailcmd_toggled(GtkToggleButton *button,
@@ -222,7 +256,7 @@ static PrefParam param[] = {
        {"use_mail_command", "FALSE", &tmp_ac_prefs.use_mail_command, P_BOOL,
         &basic.mailcmd_chkbtn, prefs_set_data_from_toggle, prefs_set_toggle},
 
-       {"mail_command", "/usr/sbin/sendmail", &tmp_ac_prefs.mail_command, P_STRING,
+       {"mail_command", "/usr/sbin/sendmail -t", &tmp_ac_prefs.mail_command, P_STRING,
         &basic.mailcmd_entry, prefs_set_data_from_entry, prefs_set_entry},
 
        {"use_nntp_auth", "FALSE", &tmp_ac_prefs.use_nntp_auth, P_BOOL,
@@ -243,6 +277,10 @@ static PrefParam param[] = {
         &receive.rmmail_chkbtn,
         prefs_set_data_from_toggle, prefs_set_toggle},
 
+       {"message_leave_time", "0", &tmp_ac_prefs.msg_leave_time, P_INT,
+        &receive.leave_time_entry,
+        prefs_set_data_from_entry, prefs_set_entry},
+
        {"get_all_mail", "FALSE", &tmp_ac_prefs.getall, P_BOOL,
         &receive.getall_chkbtn,
         prefs_set_data_from_toggle, prefs_set_toggle},
@@ -258,8 +296,13 @@ static PrefParam param[] = {
         &receive.filter_on_recv_chkbtn,
         prefs_set_data_from_toggle, prefs_set_toggle},
 
-       {"imap_directory", NULL, &tmp_ac_prefs.imap_dir, P_STRING,
-        &receive.imapdir_entry, prefs_set_data_from_entry, prefs_set_entry},
+       /* selective download */        
+       {"sd_filter_on_receive", "TRUE", &tmp_ac_prefs.sd_filter_on_recv, P_BOOL,
+        &receive.sd_filter_on_recv_chkbtn,
+        prefs_set_data_from_toggle, prefs_set_toggle},
+       {"sd_remove_mail_on_download", "TRUE", &tmp_ac_prefs.sd_rmmail_on_download, P_BOOL,
+        &receive.sd_rmmail_chkbtn,
+        prefs_set_data_from_toggle, prefs_set_toggle},
 
        {"receive_at_get_all", "TRUE", &tmp_ac_prefs.recv_at_getall, P_BOOL,
         &receive.recvatgetall_chkbtn,
@@ -267,29 +310,33 @@ static PrefParam param[] = {
 
        /* Send */
        {"add_date", "TRUE", &tmp_ac_prefs.add_date, P_BOOL,
-        &send.date_chkbtn,
+        &p_send.date_chkbtn,
         prefs_set_data_from_toggle, prefs_set_toggle},
 
        {"generate_msgid", "TRUE", &tmp_ac_prefs.gen_msgid, P_BOOL,
-        &send.msgid_chkbtn,
+        &p_send.msgid_chkbtn,
         prefs_set_data_from_toggle, prefs_set_toggle},
 
        {"add_custom_header", "FALSE", &tmp_ac_prefs.add_customhdr, P_BOOL,
-        &send.customhdr_chkbtn,
+        &p_send.customhdr_chkbtn,
         prefs_set_data_from_toggle, prefs_set_toggle},
 
        {"use_smtp_auth", "FALSE", &tmp_ac_prefs.use_smtp_auth, P_BOOL,
-        &send.smtp_auth_chkbtn,
+        &p_send.smtp_auth_chkbtn,
         prefs_set_data_from_toggle, prefs_set_toggle},
 
-       {"smtp_user_id", NULL, &tmp_ac_prefs.smtp_userid, P_STRING,
-        &send.smtp_userid_entry, prefs_set_data_from_entry, prefs_set_entry},
+       {"smtp_auth_method", "0", &tmp_ac_prefs.smtp_auth_type, P_ENUM,
+        &p_send.smtp_auth_type_optmenu,
+        prefs_account_smtp_auth_type_set_data_from_optmenu,
+        prefs_account_smtp_auth_type_set_optmenu},
 
+       {"smtp_user_id", NULL, &tmp_ac_prefs.smtp_userid, P_STRING,
+        &p_send.smtp_uid_entry, prefs_set_data_from_entry, prefs_set_entry},
        {"smtp_password", NULL, &tmp_ac_prefs.smtp_passwd, P_STRING,
-        &send.smtp_passwd_entry, prefs_set_data_from_entry, prefs_set_entry},
+        &p_send.smtp_pass_entry, prefs_set_data_from_entry, prefs_set_entry},
 
        {"pop_before_smtp", "FALSE", &tmp_ac_prefs.pop_before_smtp, P_BOOL,
-        &send.pop_bfr_smtp_chkbtn,
+        &p_send.pop_bfr_smtp_chkbtn,
         prefs_set_data_from_toggle, prefs_set_toggle},
 
        /* Compose */
@@ -319,19 +366,18 @@ static PrefParam param[] = {
 
        {"auto_replyto", NULL, &tmp_ac_prefs.auto_replyto, P_STRING,
         &compose.autoreplyto_entry,
-
         prefs_set_data_from_entry, prefs_set_entry},
 
 #if USE_GPGME
        /* Privacy */
        {"default_encrypt", "FALSE", &tmp_ac_prefs.default_encrypt, P_BOOL,
-        &privacy.checkbtn_default_encrypt,
-        prefs_set_data_from_toggle, prefs_set_toggle},
-       {"ascii_armored", "FALSE", &tmp_ac_prefs.ascii_armored, P_BOOL,
-        &privacy.checkbtn_ascii_armored,
+        &privacy.default_encrypt_chkbtn,
         prefs_set_data_from_toggle, prefs_set_toggle},
        {"default_sign", "FALSE", &tmp_ac_prefs.default_sign, P_BOOL,
-        &privacy.checkbtn_default_sign,
+        &privacy.default_sign_chkbtn,
+        prefs_set_data_from_toggle, prefs_set_toggle},
+       {"ascii_armored", "FALSE", &tmp_ac_prefs.ascii_armored, P_BOOL,
+        &privacy.ascii_armored_chkbtn,
         prefs_set_data_from_toggle, prefs_set_toggle},
        {"sign_key", NULL, &tmp_ac_prefs.sign_key, P_ENUM,
         &privacy.defaultkey_radiobtn,
@@ -344,14 +390,22 @@ static PrefParam param[] = {
 
 #if USE_SSL
        /* SSL */
+       {"ssl_pop", "0", &tmp_ac_prefs.ssl_pop, P_ENUM,
+        &ssl.pop_nossl_radiobtn,
+        prefs_account_enum_set_data_from_radiobtn,
+        prefs_account_enum_set_radiobtn},
+       {"ssl_imap", "0", &tmp_ac_prefs.ssl_imap, P_ENUM,
+        &ssl.imap_nossl_radiobtn,
+        prefs_account_enum_set_data_from_radiobtn,
+        prefs_account_enum_set_radiobtn},
+       {"ssl_nntp", "0", &tmp_ac_prefs.ssl_nntp, P_ENUM,
+        &ssl.nntp_nossl_radiobtn,
+        prefs_account_enum_set_data_from_radiobtn,
+        prefs_account_enum_set_radiobtn},
        {"ssl_smtp", "0", &tmp_ac_prefs.ssl_smtp, P_ENUM,
         &ssl.smtp_nossl_radiobtn,
         prefs_account_enum_set_data_from_radiobtn,
         prefs_account_enum_set_radiobtn},
-       {"ssl_pop", "FALSE", &tmp_ac_prefs.ssl_pop, P_BOOL,
-        &ssl.pop_chkbtn, prefs_set_data_from_toggle, prefs_set_toggle},
-       {"ssl_imap", "FALSE", &tmp_ac_prefs.ssl_imap, P_BOOL,
-        &ssl.imap_chkbtn, prefs_set_data_from_toggle, prefs_set_toggle},
 #endif /* USE_SSL */
 
        /* Advanced */
@@ -403,6 +457,39 @@ static PrefParam param[] = {
         &advanced.tunnelcmd_entry,
         prefs_set_data_from_entry, prefs_set_entry},
 
+       {"mark_crosspost_read", "FALSE", &tmp_ac_prefs.mark_crosspost_read, P_BOOL,
+        &advanced.crosspost_chkbtn,
+        prefs_set_data_from_toggle, prefs_set_toggle},
+
+       {"crosspost_color", NULL, &tmp_ac_prefs.crosspost_col, P_ENUM,
+        &advanced.crosspost_colormenu,
+        prefs_account_crosspost_set_data_from_colormenu,
+        prefs_account_crosspost_set_colormenu},
+
+       {"imap_directory", NULL, &tmp_ac_prefs.imap_dir, P_STRING,
+        &advanced.imapdir_entry, prefs_set_data_from_entry, prefs_set_entry},
+
+       {"set_sent_folder", "FALSE", &tmp_ac_prefs.set_sent_folder, P_BOOL,
+        &advanced.sent_folder_chkbtn,
+        prefs_set_data_from_toggle, prefs_set_toggle},
+       {"sent_folder", NULL, &tmp_ac_prefs.sent_folder, P_STRING,
+        &advanced.sent_folder_entry,
+        prefs_set_data_from_entry, prefs_set_entry},
+
+       {"set_draft_folder", "FALSE", &tmp_ac_prefs.set_draft_folder, P_BOOL,
+        &advanced.draft_folder_chkbtn,
+        prefs_set_data_from_toggle, prefs_set_toggle},
+       {"draft_folder", NULL, &tmp_ac_prefs.draft_folder, P_STRING,
+        &advanced.draft_folder_entry,
+        prefs_set_data_from_entry, prefs_set_entry},
+
+       {"set_trash_folder", "FALSE", &tmp_ac_prefs.set_trash_folder, P_BOOL,
+        &advanced.trash_folder_chkbtn,
+        prefs_set_data_from_toggle, prefs_set_toggle},
+       {"trash_folder", NULL, &tmp_ac_prefs.trash_folder, P_STRING,
+        &advanced.trash_folder_entry,
+        prefs_set_data_from_entry, prefs_set_entry},
+
        {NULL, NULL, NULL, P_OTHER, NULL, NULL, NULL}
 };
 
@@ -419,7 +506,8 @@ static void prefs_account_ssl_create                (void);
 #endif /* USE_SSL */
 static void prefs_account_advanced_create      (void);
 
-static void prefs_account_select_inbox_cb      (void);
+static void prefs_account_select_folder_cb     (GtkWidget      *widget,
+                                                gpointer        data);
 static void prefs_account_edit_custom_header   (void);
 
 static gint prefs_account_deleted              (GtkWidget      *widget,
@@ -966,19 +1054,21 @@ static void prefs_account_receive_create(void)
        GtkWidget *frame1;
        GtkWidget *vbox2;
        GtkWidget *rmmail_chkbtn;
+       GtkWidget *hbox_spc;
+       GtkWidget *leave_time_label;
+       GtkWidget *leave_time_entry;
        GtkWidget *getall_chkbtn;
        GtkWidget *hbox1;
        GtkWidget *size_limit_chkbtn;
        GtkWidget *size_limit_entry;
        GtkWidget *label;
        GtkWidget *filter_on_recv_chkbtn;
+       GtkWidget *sd_filter_on_recv_chkbtn;
+       GtkWidget *sd_rmmail_chkbtn;
        GtkWidget *vbox3;
        GtkWidget *inbox_label;
        GtkWidget *inbox_entry;
        GtkWidget *inbox_btn;
-       GtkWidget *frame2;
-       GtkWidget *imapdir_label;
-       GtkWidget *imapdir_entry;
        GtkWidget *recvatgetall_chkbtn;
 
        vbox1 = gtk_vbox_new (FALSE, VSPACING);
@@ -995,8 +1085,54 @@ static void prefs_account_receive_create(void)
 
        PACK_CHECK_BUTTON (vbox2, rmmail_chkbtn,
                           _("Remove messages on server when received"));
+
+       hbox1 = gtk_hbox_new (FALSE, 8);
+       gtk_widget_show (hbox1);
+       gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, FALSE, 0);
+
+       hbox_spc = gtk_hbox_new (FALSE, 0);
+       gtk_widget_show (hbox_spc);
+       gtk_box_pack_start (GTK_BOX (hbox1), hbox_spc, FALSE, FALSE, 0);
+       gtk_widget_set_usize (hbox_spc, 12, -1);
+
+       leave_time_label = gtk_label_new (_("Remove after"));
+       gtk_widget_show (leave_time_label);
+       gtk_box_pack_start (GTK_BOX (hbox1), leave_time_label, FALSE, FALSE, 0);
+
+       leave_time_entry = gtk_entry_new ();
+       gtk_widget_show (leave_time_entry);
+       gtk_widget_set_usize (leave_time_entry, 64, -1);
+       gtk_box_pack_start (GTK_BOX (hbox1), leave_time_entry, FALSE, FALSE, 0);
+
+       leave_time_label = gtk_label_new (_("days"));
+       gtk_widget_show (leave_time_label);
+       gtk_box_pack_start (GTK_BOX (hbox1), leave_time_label, FALSE, FALSE, 0);
+
+       SET_TOGGLE_SENSITIVITY (rmmail_chkbtn, hbox1);
+
+       PACK_VSPACER(vbox2, vbox3, VSPACING_NARROW_2);
+
+       hbox1 = gtk_hbox_new (FALSE, 8);
+       gtk_widget_show (hbox1);
+       gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, FALSE, 0);
+
+       hbox_spc = gtk_hbox_new (FALSE, 0);
+       gtk_widget_show (hbox_spc);
+       gtk_box_pack_start (GTK_BOX (hbox1), hbox_spc, FALSE, FALSE, 0);
+       gtk_widget_set_usize (hbox_spc, 12, -1);
+
+       leave_time_label = gtk_label_new (_("(0 days: remove immediately)"));
+       gtk_widget_show (leave_time_label);
+       gtk_box_pack_start (GTK_BOX (hbox1), leave_time_label, FALSE, FALSE, 0);
+
+       SET_TOGGLE_SENSITIVITY (rmmail_chkbtn, hbox1);
+
        PACK_CHECK_BUTTON (vbox2, getall_chkbtn,
                           _("Download all messages on server"));
+       PACK_CHECK_BUTTON (vbox2, sd_filter_on_recv_chkbtn,
+                          _("Use filtering rules with Selective Download"));
+       PACK_CHECK_BUTTON (vbox2, sd_rmmail_chkbtn,
+                          _("Remove mail after downloading with Selective Download"));
 
        hbox1 = gtk_hbox_new (FALSE, 8);
        gtk_widget_show (hbox1);
@@ -1037,8 +1173,8 @@ static void prefs_account_receive_create(void)
        gtk_widget_show (inbox_btn);
        gtk_box_pack_start (GTK_BOX (hbox1), inbox_btn, FALSE, FALSE, 0);
        gtk_signal_connect (GTK_OBJECT (inbox_btn), "clicked",
-                           GTK_SIGNAL_FUNC (prefs_account_select_inbox_cb),
-                           NULL);
+                           GTK_SIGNAL_FUNC (prefs_account_select_folder_cb),
+                           inbox_entry);
 
        PACK_VSPACER(vbox2, vbox3, VSPACING_NARROW_2);
 
@@ -1052,43 +1188,24 @@ static void prefs_account_receive_create(void)
        gtk_box_pack_start (GTK_BOX (hbox1), label, FALSE, FALSE, 0);
        gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
 
-       PACK_FRAME (vbox1, frame2, _("IMAP4"));
-
-       vbox2 = gtk_vbox_new (FALSE, VSPACING_NARROW);
-       gtk_widget_show (vbox2);
-       gtk_container_add (GTK_CONTAINER (frame2), vbox2);
-       gtk_container_set_border_width (GTK_CONTAINER (vbox2), 8);
-
-       hbox1 = gtk_hbox_new (FALSE, 8);
-       gtk_widget_show (hbox1);
-       gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, FALSE, 0);
-
-       imapdir_label = gtk_label_new (_("IMAP server directory"));
-       gtk_widget_show (imapdir_label);
-       gtk_box_pack_start (GTK_BOX (hbox1), imapdir_label, FALSE, FALSE, 0);
-
-       imapdir_entry = gtk_entry_new();
-       gtk_widget_show (imapdir_entry);
-       gtk_box_pack_start (GTK_BOX (hbox1), imapdir_entry, TRUE, TRUE, 0);
-
        PACK_CHECK_BUTTON
                (vbox1, recvatgetall_chkbtn,
                 _("`Get all' checks for new messages on this account"));
 
-       receive.pop3_frame            = frame1;
-       receive.rmmail_chkbtn         = rmmail_chkbtn;
-       receive.getall_chkbtn         = getall_chkbtn;
-       receive.size_limit_chkbtn     = size_limit_chkbtn;
-       receive.size_limit_entry      = size_limit_entry;
-       receive.filter_on_recv_chkbtn = filter_on_recv_chkbtn;
-       receive.inbox_label           = inbox_label;
-       receive.inbox_entry           = inbox_entry;
-       receive.inbox_btn             = inbox_btn;
-
-       receive.imap_frame    = frame2;
-       receive.imapdir_entry = imapdir_entry;
-
-       receive.recvatgetall_chkbtn   = recvatgetall_chkbtn;
+       receive.pop3_frame               = frame1;
+       receive.rmmail_chkbtn            = rmmail_chkbtn;
+       receive.leave_time_entry         = leave_time_entry;
+       receive.getall_chkbtn            = getall_chkbtn;
+       receive.size_limit_chkbtn        = size_limit_chkbtn;
+       receive.size_limit_entry         = size_limit_entry;
+       receive.filter_on_recv_chkbtn    = filter_on_recv_chkbtn;
+       receive.sd_filter_on_recv_chkbtn = sd_filter_on_recv_chkbtn;
+       receive.sd_rmmail_chkbtn         = sd_rmmail_chkbtn;
+       receive.inbox_label              = inbox_label;
+       receive.inbox_entry              = inbox_entry;
+       receive.inbox_btn                = inbox_btn;
+
+       receive.recvatgetall_chkbtn      = recvatgetall_chkbtn;
 }
 
 static void prefs_account_send_create(void)
@@ -1101,16 +1218,17 @@ static void prefs_account_send_create(void)
        GtkWidget *hbox;
        GtkWidget *customhdr_chkbtn;
        GtkWidget *customhdr_edit_btn;
-       GtkWidget *frame3;
        GtkWidget *vbox3;
        GtkWidget *smtp_auth_chkbtn;
-       GtkWidget *hbox2;
-       GtkWidget *smtp_auth_hbox;
+       GtkWidget *optmenu;
+       GtkWidget *optmenu_menu;
+       GtkWidget *menuitem;
+       GtkWidget *vbox4;
+       GtkWidget *hbox_spc;
        GtkWidget *label;
-       GtkWidget *uid_label;
-       GtkWidget *smtp_userid_entry;
-       GtkWidget *pass_label;
-       GtkWidget *smtp_passwd_entry;
+       GtkWidget *smtp_uid_entry;
+       GtkWidget *smtp_pass_entry;
+       GtkWidget *vbox_spc;
        GtkWidget *pop_bfr_smtp_chkbtn;
 
        vbox1 = gtk_vbox_new (FALSE, VSPACING);
@@ -1145,80 +1263,110 @@ static void prefs_account_send_create(void)
 
        SET_TOGGLE_SENSITIVITY (customhdr_chkbtn, customhdr_edit_btn);
 
-       PACK_FRAME (vbox1, frame3, _("Authentication"));
+       PACK_FRAME (vbox1, frame, _("Authentication"));
 
        vbox3 = gtk_vbox_new (FALSE, 0);
        gtk_widget_show (vbox3);
-       gtk_container_add (GTK_CONTAINER (frame3), vbox3);
+       gtk_container_add (GTK_CONTAINER (frame), vbox3);
        gtk_container_set_border_width (GTK_CONTAINER (vbox3), 8);
 
        PACK_CHECK_BUTTON (vbox3, smtp_auth_chkbtn,
                _("SMTP Authentication (SMTP AUTH)"));
 
-       hbox2 = gtk_hbox_new (FALSE, 8);
-       gtk_widget_show (hbox2);
-       gtk_box_pack_start (GTK_BOX (vbox3), hbox2, FALSE, FALSE, 0);
+       vbox4 = gtk_vbox_new (FALSE, 0);
+       gtk_widget_show (vbox4);
+       gtk_box_pack_start (GTK_BOX (vbox3), vbox4, FALSE, FALSE, 0);
 
-       label = gtk_label_new ("");
+       hbox = gtk_hbox_new (FALSE, 8);
+       gtk_widget_show (hbox);
+       gtk_box_pack_start (GTK_BOX (vbox4), hbox, FALSE, FALSE, 0);
+
+       hbox_spc = gtk_hbox_new (FALSE, 0);
+       gtk_widget_show (hbox_spc);
+       gtk_box_pack_start (GTK_BOX (hbox), hbox_spc, FALSE, FALSE, 0);
+       gtk_widget_set_usize (hbox_spc, 12, -1);
+
+       label = gtk_label_new (_("Authentication method"));
        gtk_widget_show (label);
-       gtk_box_pack_start (GTK_BOX (hbox2), label, FALSE, FALSE, 0);
-       gtk_widget_set_usize (label, 16, -1);
+       gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
 
-       label = gtk_label_new (_("(Leave User ID empty to use receive server's account information)"));
+       optmenu = gtk_option_menu_new ();
+       gtk_widget_show (optmenu);
+       gtk_box_pack_start (GTK_BOX (hbox), optmenu, FALSE, FALSE, 0);
+
+       optmenu_menu = gtk_menu_new ();
+
+       MENUITEM_ADD (optmenu_menu, menuitem, _("Automatic"), 0);
+       MENUITEM_ADD (optmenu_menu, menuitem, "LOGIN", SMTPAUTH_LOGIN);
+       MENUITEM_ADD (optmenu_menu, menuitem, "CRAM-MD5", SMTPAUTH_CRAM_MD5);
+       MENUITEM_ADD (optmenu_menu, menuitem, "DIGEST-MD5", SMTPAUTH_DIGEST_MD5);
+       gtk_widget_set_sensitive (menuitem, FALSE);
+
+       gtk_option_menu_set_menu (GTK_OPTION_MENU (optmenu), optmenu_menu);
+
+       PACK_VSPACER(vbox4, vbox_spc, VSPACING_NARROW_2);
+
+       hbox = gtk_hbox_new (FALSE, 8);
+       gtk_widget_show (hbox);
+       gtk_box_pack_start (GTK_BOX (vbox4), hbox, FALSE, FALSE, 0);
+
+       hbox_spc = gtk_hbox_new (FALSE, 0);
+       gtk_widget_show (hbox_spc);
+       gtk_box_pack_start (GTK_BOX (hbox), hbox_spc, FALSE, FALSE, 0);
+       gtk_widget_set_usize (hbox_spc, 12, -1);
+
+       label = gtk_label_new (_("User ID"));
        gtk_widget_show (label);
-       gtk_box_pack_start (GTK_BOX (hbox2), label,
-                           FALSE, FALSE, 0);
+       gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
 
-       smtp_auth_hbox = gtk_hbox_new (FALSE, 8);
-       gtk_widget_show (smtp_auth_hbox);
-       gtk_box_pack_start (GTK_BOX (vbox3), smtp_auth_hbox, FALSE, FALSE, 0);
+       smtp_uid_entry = gtk_entry_new ();
+       gtk_widget_show (smtp_uid_entry);
+       gtk_widget_set_usize (smtp_uid_entry, DEFAULT_ENTRY_WIDTH, -1);
+       gtk_box_pack_start (GTK_BOX (hbox), smtp_uid_entry, TRUE, TRUE, 0);
 
-       label = gtk_label_new ("");
+       label = gtk_label_new (_("Password"));
        gtk_widget_show (label);
-       gtk_box_pack_start (GTK_BOX (smtp_auth_hbox), label, FALSE, FALSE, 0);
-       gtk_widget_set_usize (label, 16, -1);
+       gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
 
-       uid_label = gtk_label_new (_("User ID"));
-       gtk_widget_show (uid_label);
-       gtk_box_pack_start (GTK_BOX (smtp_auth_hbox), uid_label,
-                           FALSE, FALSE, 0);
-       gtk_misc_set_alignment (GTK_MISC (uid_label), 1, 0.5);
+       smtp_pass_entry = gtk_entry_new ();
+       gtk_widget_show (smtp_pass_entry);
+       gtk_widget_set_usize (smtp_pass_entry, DEFAULT_ENTRY_WIDTH, -1);
+       gtk_box_pack_start (GTK_BOX (hbox), smtp_pass_entry, TRUE, TRUE, 0);
+       gtk_entry_set_visibility (GTK_ENTRY (smtp_pass_entry), FALSE);
 
-       smtp_userid_entry = gtk_entry_new ();
-       gtk_widget_show (smtp_userid_entry);
-       gtk_widget_set_usize (smtp_userid_entry, DEFAULT_ENTRY_WIDTH, -1);
-       gtk_box_pack_start (GTK_BOX (smtp_auth_hbox), smtp_userid_entry,
-                           TRUE, TRUE, 0);
+       PACK_VSPACER(vbox4, vbox_spc, VSPACING_NARROW_2);
 
-       pass_label = gtk_label_new (_("Password"));
-       gtk_widget_show (pass_label);
-       gtk_box_pack_start (GTK_BOX (smtp_auth_hbox), pass_label,
-                           FALSE, FALSE, 0);
+       hbox = gtk_hbox_new (FALSE, 8);
+       gtk_widget_show (hbox);
+       gtk_box_pack_start (GTK_BOX (vbox4), hbox, FALSE, FALSE, 0);
 
-       smtp_passwd_entry = gtk_entry_new ();
-       gtk_widget_show (smtp_passwd_entry);
-       gtk_widget_set_usize (smtp_passwd_entry, DEFAULT_ENTRY_WIDTH, -1);
-       gtk_box_pack_start (GTK_BOX (smtp_auth_hbox), smtp_passwd_entry,
-                           TRUE, TRUE, 0);
-       gtk_entry_set_visibility (GTK_ENTRY (smtp_passwd_entry), FALSE);
+       hbox_spc = gtk_hbox_new (FALSE, 0);
+       gtk_widget_show (hbox_spc);
+       gtk_box_pack_start (GTK_BOX (hbox), hbox_spc, FALSE, FALSE, 0);
+       gtk_widget_set_usize (hbox_spc, 12, -1);
 
-       SET_TOGGLE_SENSITIVITY (smtp_auth_chkbtn, smtp_auth_hbox);
-       gtk_signal_connect(GTK_OBJECT(smtp_userid_entry), "changed",
-                          GTK_SIGNAL_FUNC(prefs_account_smtp_userid_cb), smtp_passwd_entry);
-       prefs_account_smtp_userid_cb(GTK_EDITABLE(smtp_userid_entry), smtp_passwd_entry);
+       label = gtk_label_new
+               (_("If you leave these entries empty, the same\n"
+                  "user ID and password as receiving will be used."));
+       gtk_widget_show (label);
+       gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
+       gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
+
+       SET_TOGGLE_SENSITIVITY (smtp_auth_chkbtn, vbox4);
 
        PACK_CHECK_BUTTON (vbox3, pop_bfr_smtp_chkbtn,
                _("Authenticate with POP3 before sending"));
        gtk_widget_set_sensitive(pop_bfr_smtp_chkbtn, FALSE);
 
-       send.date_chkbtn      = date_chkbtn;
-       send.msgid_chkbtn     = msgid_chkbtn;
-       send.customhdr_chkbtn = customhdr_chkbtn;
+       p_send.date_chkbtn      = date_chkbtn;
+       p_send.msgid_chkbtn     = msgid_chkbtn;
+       p_send.customhdr_chkbtn = customhdr_chkbtn;
 
-       send.smtp_auth_chkbtn    = smtp_auth_chkbtn;
-       send.smtp_userid_entry   = smtp_userid_entry;
-       send.smtp_passwd_entry   = smtp_passwd_entry;
-       send.pop_bfr_smtp_chkbtn = pop_bfr_smtp_chkbtn;
+       p_send.smtp_auth_chkbtn       = smtp_auth_chkbtn;
+       p_send.smtp_auth_type_optmenu = optmenu;
+       p_send.smtp_uid_entry         = smtp_uid_entry;
+       p_send.smtp_pass_entry        = smtp_pass_entry;
+       p_send.pop_bfr_smtp_chkbtn    = pop_bfr_smtp_chkbtn;
 }
 
 static void prefs_account_compose_create(void)
@@ -1317,13 +1465,11 @@ static void prefs_account_privacy_create(void)
        GtkWidget *vbox1;
        GtkWidget *frame1;
        GtkWidget *vbox2;
-       GtkWidget *frame2;
-       GtkWidget *vbox3;
        GtkWidget *hbox1;
        GtkWidget *label;
-       GtkWidget *checkbtn_default_encrypt;
-       GtkWidget *checkbtn_ascii_armored;
-       GtkWidget *checkbtn_default_sign;
+       GtkWidget *default_encrypt_chkbtn;
+       GtkWidget *default_sign_chkbtn;
+       GtkWidget *ascii_armored_chkbtn;
        GtkWidget *defaultkey_radiobtn;
        GtkWidget *emailkey_radiobtn;
        GtkWidget *customkey_radiobtn;
@@ -1334,35 +1480,30 @@ static void prefs_account_privacy_create(void)
        gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1);
        gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER);
 
-       PACK_FRAME (vbox1, frame1, _("Default Actions"));
-
        vbox2 = gtk_vbox_new (FALSE, 0);
        gtk_widget_show (vbox2);
-       gtk_container_add (GTK_CONTAINER (frame1), vbox2);
-       gtk_container_set_border_width (GTK_CONTAINER (vbox2), 8);
+       gtk_box_pack_start (GTK_BOX (vbox1), vbox2, FALSE, FALSE, 0);
 
-       PACK_CHECK_BUTTON (vbox2, checkbtn_default_encrypt,
+       PACK_CHECK_BUTTON (vbox2, default_encrypt_chkbtn,
                           _("Encrypt message by default"));
-
-       PACK_CHECK_BUTTON (vbox2, checkbtn_ascii_armored,
-                          _("Plain ASCII armored"));
-       gtk_signal_connect(GTK_OBJECT(checkbtn_ascii_armored), "toggled",
-                               prefs_account_ascii_armored_warning, (gpointer)0);
-
-       PACK_CHECK_BUTTON (vbox2, checkbtn_default_sign,
+       PACK_CHECK_BUTTON (vbox2, default_sign_chkbtn,
                           _("Sign message by default"));
+       PACK_CHECK_BUTTON (vbox2, ascii_armored_chkbtn,
+                          _("Use ASCII-armored format"));
+       gtk_signal_connect (GTK_OBJECT (ascii_armored_chkbtn), "toggled",
+                           prefs_account_ascii_armored_warning, NULL);
 
-       PACK_FRAME (vbox1, frame2, _("Sign key"));
+       PACK_FRAME (vbox1, frame1, _("Sign key"));
 
-       vbox3 = gtk_vbox_new (FALSE, VSPACING_NARROW);
-       gtk_widget_show (vbox3);
-       gtk_container_add (GTK_CONTAINER (frame2), vbox3);
-       gtk_container_set_border_width (GTK_CONTAINER (vbox3), 8);
+       vbox2 = gtk_vbox_new (FALSE, 0);
+       gtk_widget_show (vbox2);
+       gtk_container_add (GTK_CONTAINER (frame1), vbox2);
+       gtk_container_set_border_width (GTK_CONTAINER (vbox2), 8);
 
        defaultkey_radiobtn = gtk_radio_button_new_with_label
                (NULL, _("Use default GnuPG key"));
        gtk_widget_show (defaultkey_radiobtn);
-       gtk_box_pack_start (GTK_BOX (vbox3), defaultkey_radiobtn,
+       gtk_box_pack_start (GTK_BOX (vbox2), defaultkey_radiobtn,
                            FALSE, FALSE, 0);
        gtk_object_set_user_data (GTK_OBJECT (defaultkey_radiobtn),
                                  GINT_TO_POINTER (SIGN_KEY_DEFAULT));
@@ -1371,7 +1512,7 @@ static void prefs_account_privacy_create(void)
                (GTK_RADIO_BUTTON (defaultkey_radiobtn),
                 _("Select key by your email address"));
        gtk_widget_show (emailkey_radiobtn);
-       gtk_box_pack_start (GTK_BOX (vbox3), emailkey_radiobtn,
+       gtk_box_pack_start (GTK_BOX (vbox2), emailkey_radiobtn,
                            FALSE, FALSE, 0);
        gtk_object_set_user_data (GTK_OBJECT (emailkey_radiobtn),
                                  GINT_TO_POINTER (SIGN_KEY_BY_FROM));
@@ -1380,14 +1521,14 @@ static void prefs_account_privacy_create(void)
                (GTK_RADIO_BUTTON (defaultkey_radiobtn),
                 _("Specify key manually"));
        gtk_widget_show (customkey_radiobtn);
-       gtk_box_pack_start (GTK_BOX (vbox3), customkey_radiobtn,
+       gtk_box_pack_start (GTK_BOX (vbox2), customkey_radiobtn,
                            FALSE, FALSE, 0);
        gtk_object_set_user_data (GTK_OBJECT (customkey_radiobtn),
                                  GINT_TO_POINTER (SIGN_KEY_CUSTOM));
 
        hbox1 = gtk_hbox_new (FALSE, 8);
        gtk_widget_show (hbox1);
-       gtk_box_pack_start (GTK_BOX (vbox3), hbox1, FALSE, FALSE, 0);
+       gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, FALSE, 0);
 
        label = gtk_label_new ("");
        gtk_widget_show (label);
@@ -1405,105 +1546,201 @@ static void prefs_account_privacy_create(void)
 
        SET_TOGGLE_SENSITIVITY (customkey_radiobtn, customkey_entry);
 
-       privacy.checkbtn_default_encrypt = checkbtn_default_encrypt;
-       privacy.checkbtn_ascii_armored   = checkbtn_ascii_armored;
-       privacy.checkbtn_default_sign    = checkbtn_default_sign;
-       privacy.defaultkey_radiobtn = defaultkey_radiobtn;
-       privacy.emailkey_radiobtn = emailkey_radiobtn;
-       privacy.customkey_radiobtn = customkey_radiobtn;
-       privacy.customkey_entry = customkey_entry;
-}
-
-static void prefs_account_ascii_armored_warning(GtkWidget* widget,
-                                              gpointer unused)
-{
-       if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))
-               && gtk_notebook_get_current_page(GTK_NOTEBOOK(dialog.notebook))) {
-               alertpanel_message(_("Warning - Privacy/Plain ASCII armored"),
-                       _("Its not recommend to use the old style plain ASCII\n"
-                       "armored mode for encypted messages. It doesn't comply\n"
-                       "with the RFC 3156 - MIME security with OpenPGP."));
-       }
+       privacy.default_encrypt_chkbtn = default_encrypt_chkbtn;
+       privacy.default_sign_chkbtn    = default_sign_chkbtn;
+       privacy.ascii_armored_chkbtn   = ascii_armored_chkbtn;
+       privacy.defaultkey_radiobtn    = defaultkey_radiobtn;
+       privacy.emailkey_radiobtn      = emailkey_radiobtn;
+       privacy.customkey_radiobtn     = customkey_radiobtn;
+       privacy.customkey_entry        = customkey_entry;
 }
 #endif /* USE_GPGME */
 
 #if USE_SSL
+
+#define CREATE_RADIO_BUTTON(box, btn, btn_p, label, data)              \
+{                                                                      \
+       btn = gtk_radio_button_new_with_label_from_widget               \
+               (GTK_RADIO_BUTTON (btn_p), label);                      \
+       gtk_widget_show (btn);                                          \
+       gtk_box_pack_start (GTK_BOX (box), btn, FALSE, FALSE, 0);       \
+       gtk_object_set_user_data (GTK_OBJECT (btn),                     \
+                                 GINT_TO_POINTER (data));              \
+}
+
+#define CREATE_RADIO_BUTTONS(box,                                      \
+                            btn1, btn1_label, btn1_data,               \
+                            btn2, btn2_label, btn2_data,               \
+                            btn3, btn3_label, btn3_data)               \
+{                                                                      \
+       btn1 = gtk_radio_button_new_with_label(NULL, btn1_label);       \
+       gtk_widget_show (btn1);                                         \
+       gtk_box_pack_start (GTK_BOX (box), btn1, FALSE, FALSE, 0);      \
+       gtk_object_set_user_data (GTK_OBJECT (btn1),                    \
+                                 GINT_TO_POINTER (btn1_data));         \
+                                                                       \
+       CREATE_RADIO_BUTTON(box, btn2, btn1, btn2_label, btn2_data);    \
+       CREATE_RADIO_BUTTON(box, btn3, btn1, btn3_label, btn3_data);    \
+}
+
 static void prefs_account_ssl_create(void)
 {
        GtkWidget *vbox1;
 
-       GtkWidget *receive_frame;
+       GtkWidget *pop_frame;
        GtkWidget *vbox2;
-       GtkWidget *pop_chkbtn;
-       GtkWidget *imap_chkbtn;
+       GtkWidget *pop_nossl_radiobtn;
+       GtkWidget *pop_ssltunnel_radiobtn;
+       GtkWidget *pop_starttls_radiobtn;
 
-       GtkWidget *send_frame;
+       GtkWidget *imap_frame;
        GtkWidget *vbox3;
+       GtkWidget *imap_nossl_radiobtn;
+       GtkWidget *imap_ssltunnel_radiobtn;
+       GtkWidget *imap_starttls_radiobtn;
+
+       GtkWidget *nntp_frame;
+       GtkWidget *vbox4;
+       GtkWidget *nntp_nossl_radiobtn;
+       GtkWidget *nntp_ssltunnel_radiobtn;
+
+       GtkWidget *send_frame;
+       GtkWidget *vbox5;
        GtkWidget *smtp_nossl_radiobtn;
        GtkWidget *smtp_ssltunnel_radiobtn;
-       GtkWidget *smtp_sslstarttls_radiobtn;
+       GtkWidget *smtp_starttls_radiobtn;
 
        vbox1 = gtk_vbox_new (FALSE, VSPACING);
        gtk_widget_show (vbox1);
        gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1);
        gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER);
 
-       PACK_FRAME (vbox1, receive_frame, _("Receive"));
-
+       PACK_FRAME (vbox1, pop_frame, _("POP3"));
        vbox2 = gtk_vbox_new (FALSE, 0);
        gtk_widget_show (vbox2);
-       gtk_container_add (GTK_CONTAINER (receive_frame), vbox2);
+       gtk_container_add (GTK_CONTAINER (pop_frame), vbox2);
        gtk_container_set_border_width (GTK_CONTAINER (vbox2), 8);
 
-       PACK_CHECK_BUTTON (vbox2, pop_chkbtn,
-                          _("Use SSL for POP3 connection"));
-       PACK_CHECK_BUTTON (vbox2, imap_chkbtn,
-                          _("Use SSL for IMAP4 connection"));
-
-       PACK_FRAME (vbox1, send_frame, _("Send (SMTP)"));
-
+       CREATE_RADIO_BUTTONS(vbox2,
+                            pop_nossl_radiobtn,
+                            _("Don't use SSL"),
+                            SSL_NONE,
+                            pop_ssltunnel_radiobtn,
+                            _("Use SSL for POP3 connection"),
+                            SSL_TUNNEL,
+                            pop_starttls_radiobtn,
+                            _("Use STARTTLS command to start SSL session"),
+                            SSL_STARTTLS);
+
+       PACK_FRAME (vbox1, imap_frame, _("IMAP4"));
        vbox3 = gtk_vbox_new (FALSE, 0);
        gtk_widget_show (vbox3);
-       gtk_container_add (GTK_CONTAINER (send_frame), vbox3);
+       gtk_container_add (GTK_CONTAINER (imap_frame), vbox3);
        gtk_container_set_border_width (GTK_CONTAINER (vbox3), 8);
 
-       smtp_nossl_radiobtn =
-               gtk_radio_button_new_with_label(NULL, _("Don't use SSL"));
-       gtk_widget_show (smtp_nossl_radiobtn);
-       gtk_box_pack_start (GTK_BOX (vbox3), smtp_nossl_radiobtn,
-                           FALSE, FALSE, 0);
-       gtk_object_set_user_data (GTK_OBJECT (smtp_nossl_radiobtn),
-                                 GINT_TO_POINTER (SSL_SMTP_NONE));
-
-       smtp_ssltunnel_radiobtn = gtk_radio_button_new_with_label_from_widget
-               (GTK_RADIO_BUTTON (smtp_nossl_radiobtn),
-                _("Use SSL for SMTP connection"));
-       gtk_widget_show (smtp_ssltunnel_radiobtn);
-       gtk_box_pack_start (GTK_BOX (vbox3), smtp_ssltunnel_radiobtn,
+       CREATE_RADIO_BUTTONS(vbox3,
+                            imap_nossl_radiobtn,
+                            _("Don't use SSL"),
+                            SSL_NONE,
+                            imap_ssltunnel_radiobtn,
+                            _("Use SSL for IMAP4 connection"),
+                            SSL_TUNNEL,
+                            imap_starttls_radiobtn,
+                            _("Use STARTTLS command to start SSL session"),
+                            SSL_STARTTLS);
+
+       PACK_FRAME (vbox1, nntp_frame, _("NNTP"));
+       vbox4 = gtk_vbox_new (FALSE, 0);
+       gtk_widget_show (vbox4);
+       gtk_container_add (GTK_CONTAINER (nntp_frame), vbox4);
+       gtk_container_set_border_width (GTK_CONTAINER (vbox4), 8);
+
+       nntp_nossl_radiobtn =
+               gtk_radio_button_new_with_label (NULL, _("Don't use SSL"));
+       gtk_widget_show (nntp_nossl_radiobtn);
+       gtk_box_pack_start (GTK_BOX (vbox4), nntp_nossl_radiobtn,
                            FALSE, FALSE, 0);
-       gtk_object_set_user_data (GTK_OBJECT (smtp_ssltunnel_radiobtn),
-                                 GINT_TO_POINTER (SSL_SMTP_TUNNEL));
-
-       smtp_sslstarttls_radiobtn = gtk_radio_button_new_with_label_from_widget
-               (GTK_RADIO_BUTTON (smtp_nossl_radiobtn),
-                _("Use STARTTLS command to start SSL session"));
-       gtk_widget_show (smtp_sslstarttls_radiobtn);
-       gtk_box_pack_start (GTK_BOX (vbox3), smtp_sslstarttls_radiobtn,
-                           FALSE, FALSE, 0);
-       gtk_object_set_user_data (GTK_OBJECT (smtp_sslstarttls_radiobtn),
-                                 GINT_TO_POINTER (SSL_SMTP_STARTTLS));
+       gtk_object_set_user_data (GTK_OBJECT (nntp_nossl_radiobtn),
+                                 GINT_TO_POINTER (SSL_NONE));
 
-       ssl.receive_frame = receive_frame;
-       ssl.pop_chkbtn    = pop_chkbtn;
-       ssl.imap_chkbtn   = imap_chkbtn;
+       CREATE_RADIO_BUTTON(vbox4, nntp_ssltunnel_radiobtn, nntp_nossl_radiobtn,
+                           _("Use SSL for NNTP connection"), SSL_TUNNEL);
 
-       ssl.send_frame                = send_frame;
-       ssl.smtp_nossl_radiobtn       = smtp_nossl_radiobtn;
-       ssl.smtp_ssltunnel_radiobtn   = smtp_ssltunnel_radiobtn;
-       ssl.smtp_sslstarttls_radiobtn = smtp_sslstarttls_radiobtn;
+       PACK_FRAME (vbox1, send_frame, _("Send (SMTP)"));
+       vbox5 = gtk_vbox_new (FALSE, 0);
+       gtk_widget_show (vbox5);
+       gtk_container_add (GTK_CONTAINER (send_frame), vbox5);
+       gtk_container_set_border_width (GTK_CONTAINER (vbox5), 8);
+
+       CREATE_RADIO_BUTTONS(vbox5,
+                            smtp_nossl_radiobtn,
+                            _("Don't use SSL"),
+                            SSL_NONE,
+                            smtp_ssltunnel_radiobtn,
+                            _("Use SSL for SMTP connection"),
+                            SSL_TUNNEL,
+                            smtp_starttls_radiobtn,
+                            _("Use STARTTLS command to start SSL session"),
+                            SSL_STARTTLS);
+
+       ssl.pop_frame               = pop_frame;
+       ssl.pop_nossl_radiobtn      = pop_nossl_radiobtn;
+       ssl.pop_ssltunnel_radiobtn  = pop_ssltunnel_radiobtn;
+       ssl.pop_starttls_radiobtn   = pop_starttls_radiobtn;
+
+       ssl.imap_frame              = imap_frame;
+       ssl.imap_nossl_radiobtn     = imap_nossl_radiobtn;
+       ssl.imap_ssltunnel_radiobtn = imap_ssltunnel_radiobtn;
+       ssl.imap_starttls_radiobtn  = imap_starttls_radiobtn;
+
+       ssl.nntp_frame              = nntp_frame;
+       ssl.nntp_nossl_radiobtn     = nntp_nossl_radiobtn;
+       ssl.nntp_ssltunnel_radiobtn = nntp_ssltunnel_radiobtn;
+
+       ssl.send_frame              = send_frame;
+       ssl.smtp_nossl_radiobtn     = smtp_nossl_radiobtn;
+       ssl.smtp_ssltunnel_radiobtn = smtp_ssltunnel_radiobtn;
+       ssl.smtp_starttls_radiobtn  = smtp_starttls_radiobtn;
 }
+
+#undef CREATE_RADIO_BUTTONS
+#undef CREATE_RADIO_BUTTON
 #endif /* USE_SSL */
 
+static void crosspost_color_toggled(void)
+{
+       gboolean is_active;
+
+       is_active = gtk_toggle_button_get_active
+               (GTK_TOGGLE_BUTTON(advanced.crosspost_chkbtn));
+       gtk_widget_set_sensitive(advanced.crosspost_colormenu, is_active);
+}
+
+static void prefs_account_crosspost_set_data_from_colormenu(PrefParam *pparam)
+{
+       GtkWidget *menu;
+       GtkWidget *menuitem;
+
+       menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(advanced.crosspost_colormenu));
+       menuitem = gtk_menu_get_active(GTK_MENU(menu));
+       *((gint *)pparam->data) = GPOINTER_TO_INT
+               (gtk_object_get_data(GTK_OBJECT(menuitem), "color"));
+}
+
+static void prefs_account_crosspost_set_colormenu(PrefParam *pparam)
+{
+       gint colorlabel = *((gint *)pparam->data);
+       GtkOptionMenu *colormenu = GTK_OPTION_MENU(*pparam->widget);
+       GtkWidget *menu;
+       GtkWidget *menuitem;
+
+       gtk_option_menu_set_history(colormenu, colorlabel);
+       menu = gtk_option_menu_get_menu(colormenu);
+       menuitem = gtk_menu_get_active(GTK_MENU(menu));
+       gtk_menu_item_activate(GTK_MENU_ITEM(menuitem));
+}
+
+
 static void prefs_account_advanced_create(void)
 {
        GtkWidget *vbox1;
@@ -1524,6 +1761,21 @@ static void prefs_account_advanced_create(void)
        GtkWidget *entry_domain;
        GtkWidget *checkbtn_tunnelcmd;
        GtkWidget *entry_tunnelcmd;
+       GtkWidget *checkbtn_crosspost;
+       GtkWidget *colormenu_crosspost;
+       GtkWidget *menu;
+       GtkWidget *imap_frame;
+       GtkWidget *imapdir_label;
+       GtkWidget *imapdir_entry;
+       GtkWidget *folder_frame;
+       GtkWidget *vbox3;
+       GtkWidget *table;
+       GtkWidget *sent_folder_chkbtn;
+       GtkWidget *sent_folder_entry;
+       GtkWidget *draft_folder_chkbtn;
+       GtkWidget *draft_folder_entry;
+       GtkWidget *trash_folder_chkbtn;
+       GtkWidget *trash_folder_entry;
 
 #define PACK_HBOX(hbox) \
        { \
@@ -1589,9 +1841,93 @@ static void prefs_account_advanced_create(void)
        gtk_box_pack_start (GTK_BOX (hbox1), entry_tunnelcmd, TRUE, TRUE, 0);
        SET_TOGGLE_SENSITIVITY (checkbtn_tunnelcmd, entry_tunnelcmd);
 
+       PACK_HBOX (hbox1);
+       PACK_CHECK_BUTTON (hbox1, checkbtn_crosspost, 
+                          _("Mark cross-posted messages as read and color:"));
+       gtk_signal_connect (GTK_OBJECT (checkbtn_crosspost), "toggled",
+                                       GTK_SIGNAL_FUNC (crosspost_color_toggled),
+                                       NULL);
+
+       colormenu_crosspost = gtk_option_menu_new();
+       gtk_widget_show (colormenu_crosspost);
+       gtk_box_pack_start (GTK_BOX (hbox1), colormenu_crosspost, FALSE, FALSE, 0);
+
+       menu = colorlabel_create_color_menu();
+       gtk_option_menu_set_menu (GTK_OPTION_MENU(colormenu_crosspost), menu);
+       SET_TOGGLE_SENSITIVITY(checkbtn_crosspost, colormenu_crosspost);
+
+       PACK_FRAME (vbox1, imap_frame, _("IMAP4"));
+
+       vbox3 = gtk_vbox_new (FALSE, VSPACING_NARROW);
+       gtk_widget_show (vbox3);
+       gtk_container_add (GTK_CONTAINER (imap_frame), vbox3);
+       gtk_container_set_border_width (GTK_CONTAINER (vbox3), 8);
+
+       hbox1 = gtk_hbox_new (FALSE, 8);
+       gtk_widget_show (hbox1);
+       gtk_box_pack_start (GTK_BOX (vbox3), hbox1, FALSE, FALSE, 0);
+
+       imapdir_label = gtk_label_new (_("IMAP server directory"));
+       gtk_widget_show (imapdir_label);
+       gtk_box_pack_start (GTK_BOX (hbox1), imapdir_label, FALSE, FALSE, 0);
+
+       imapdir_entry = gtk_entry_new();
+       gtk_widget_show (imapdir_entry);
+       gtk_box_pack_start (GTK_BOX (hbox1), imapdir_entry, TRUE, TRUE, 0);
+
 #undef PACK_HBOX
 #undef PACK_PORT_ENTRY
 
+       /* special folder setting (maybe these options are redundant) */
+
+       PACK_FRAME (vbox1, folder_frame, _("Folder"));
+
+       vbox3 = gtk_vbox_new (FALSE, 0);
+       gtk_widget_show (vbox3);
+       gtk_container_add (GTK_CONTAINER (folder_frame), vbox3);
+       gtk_container_set_border_width (GTK_CONTAINER (vbox3), 8);
+
+       table = gtk_table_new (3, 3, FALSE);
+       gtk_widget_show (table);
+       gtk_container_add (GTK_CONTAINER (vbox3), table);
+       gtk_table_set_row_spacings (GTK_TABLE (table), VSPACING_NARROW_2);
+       gtk_table_set_col_spacings (GTK_TABLE (table), 4);
+
+#define SET_CHECK_BTN_AND_ENTRY(label, chkbtn, entry, n)               \
+{                                                                      \
+       GtkWidget *button;                                              \
+                                                                       \
+       chkbtn = gtk_check_button_new_with_label (label);               \
+       gtk_widget_show (chkbtn);                                       \
+       gtk_table_attach (GTK_TABLE (table), chkbtn,                    \
+                         0, 1, n, n + 1, GTK_FILL, 0, 0, 0);           \
+                                                                       \
+       entry = gtk_entry_new ();                                       \
+       gtk_widget_show (entry);                                        \
+       gtk_table_attach (GTK_TABLE (table), entry, 1, 2, n, n + 1,     \
+                         GTK_EXPAND | GTK_SHRINK | GTK_FILL,           \
+                         GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0);    \
+                                                                       \
+       button = gtk_button_new_with_label (_(" ... "));                \
+       gtk_widget_show (button);                                       \
+       gtk_table_attach (GTK_TABLE (table), button,                    \
+                         2, 3, n, n + 1, GTK_FILL, 0, 0, 0);           \
+       gtk_signal_connect                                              \
+               (GTK_OBJECT (button), "clicked",                        \
+                GTK_SIGNAL_FUNC (prefs_account_select_folder_cb),      \
+                entry);                                                \
+                                                                       \
+       SET_TOGGLE_SENSITIVITY (chkbtn, entry);                         \
+       SET_TOGGLE_SENSITIVITY (chkbtn, button);                        \
+}
+
+       SET_CHECK_BTN_AND_ENTRY(_("Put sent messages in"),
+                               sent_folder_chkbtn, sent_folder_entry, 0);
+       SET_CHECK_BTN_AND_ENTRY(_("Put draft messages in"),
+                               draft_folder_chkbtn, draft_folder_entry, 1);
+       SET_CHECK_BTN_AND_ENTRY(_("Put deleted messages in"),
+                               trash_folder_chkbtn, trash_folder_entry, 2);
+
        advanced.smtpport_chkbtn        = checkbtn_smtpport;
        advanced.smtpport_entry         = entry_smtpport;
        advanced.popport_hbox           = hbox_popport;
@@ -1607,6 +1943,18 @@ static void prefs_account_advanced_create(void)
        advanced.domain_entry           = entry_domain;
        advanced.tunnelcmd_chkbtn       = checkbtn_tunnelcmd;
        advanced.tunnelcmd_entry        = entry_tunnelcmd;
+       advanced.crosspost_chkbtn       = checkbtn_crosspost;
+       advanced.crosspost_colormenu    = colormenu_crosspost;
+
+       advanced.imap_frame             = imap_frame;
+       advanced.imapdir_entry          = imapdir_entry;
+
+       advanced.sent_folder_chkbtn  = sent_folder_chkbtn;
+       advanced.sent_folder_entry   = sent_folder_entry;
+       advanced.draft_folder_chkbtn = draft_folder_chkbtn;
+       advanced.draft_folder_entry  = draft_folder_entry;
+       advanced.trash_folder_chkbtn = trash_folder_chkbtn;
+       advanced.trash_folder_entry  = trash_folder_entry;
 }
 
 static gint prefs_account_deleted(GtkWidget *widget, GdkEventAny *event,
@@ -1640,6 +1988,10 @@ static gint prefs_account_apply(void)
        protocol = GPOINTER_TO_INT
                (gtk_object_get_user_data(GTK_OBJECT(menuitem)));
 
+       if (*gtk_entry_get_text(GTK_ENTRY(basic.acname_entry)) == '\0') {
+               alertpanel_error(_("Account name is not entered."));
+               return -1;
+       }
        if (*gtk_entry_get_text(GTK_ENTRY(basic.addr_entry)) == '\0') {
                alertpanel_error(_("Mail address is not entered."));
                return -1;
@@ -1692,17 +2044,19 @@ static void prefs_account_cancel(void)
        gtk_main_quit();
 }
 
-static void prefs_account_select_inbox_cb(void)
+static void prefs_account_select_folder_cb(GtkWidget *widget, gpointer data)
 {
        FolderItem *item;
-       gchar      *path;
+       gchar *id;
 
        item = foldersel_folder_sel(NULL, FOLDER_SEL_COPY, NULL);
-       if (item) {
-               path = folder_item_get_identifier(item);
-               gtk_entry_set_text(GTK_ENTRY(receive.inbox_entry), path);
-               g_free(path);
-       }       
+       if (item && item->path) {
+               id = folder_item_get_identifier(item);
+               if (id) {
+                       gtk_entry_set_text(GTK_ENTRY(data), id);
+                       g_free(id);
+               }
+       }
 }
 
 static void prefs_account_edit_custom_header(void)
@@ -1749,6 +2103,18 @@ static void prefs_account_enum_set_radiobtn(PrefParam *pparam)
        }
 }
 
+#endif /* USE_GPGME || USE_SSL */
+
+#if USE_GPGME
+static void prefs_account_ascii_armored_warning(GtkWidget *widget)
+{
+       if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)) &&
+           gtk_notebook_get_current_page(GTK_NOTEBOOK(dialog.notebook)) > 0)
+               alertpanel_warning
+                       (_("It's not recommended to use the old style ASCII-armored\n"
+                          "mode for encrypted messages. It doesn't comply with the\n"
+                          "RFC 3156 - MIME Security with OpenPGP."));
+}
 #endif /* USE_GPGME */
 
 static void prefs_account_protocol_set_data_from_optmenu(PrefParam *pparam)
@@ -1807,11 +2173,47 @@ static void prefs_account_protocol_set_optmenu(PrefParam *pparam)
        gtk_menu_item_activate(GTK_MENU_ITEM(menuitem));
 }
 
+static void prefs_account_smtp_auth_type_set_data_from_optmenu(PrefParam *pparam)
+{
+       GtkWidget *menu;
+       GtkWidget *menuitem;
+
+       menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(*pparam->widget));
+       menuitem = gtk_menu_get_active(GTK_MENU(menu));
+       *((RecvProtocol *)pparam->data) = GPOINTER_TO_INT
+               (gtk_object_get_user_data(GTK_OBJECT(menuitem)));
+}
+
+static void prefs_account_smtp_auth_type_set_optmenu(PrefParam *pparam)
+{
+       SMTPAuthType type = *((SMTPAuthType *)pparam->data);
+       GtkOptionMenu *optmenu = GTK_OPTION_MENU(*pparam->widget);
+       GtkWidget *menu;
+       GtkWidget *menuitem;
+
+       switch (type) {
+       case SMTPAUTH_LOGIN:
+               gtk_option_menu_set_history(optmenu, 1);
+               break;
+       case SMTPAUTH_CRAM_MD5:
+               gtk_option_menu_set_history(optmenu, 2);
+               break;
+       case SMTPAUTH_DIGEST_MD5:
+               gtk_option_menu_set_history(optmenu, 3);
+               break;
+       case 0:
+       default:
+               gtk_option_menu_set_history(optmenu, 0);
+       }
+
+       menu = gtk_option_menu_get_menu(optmenu);
+       menuitem = gtk_menu_get_active(GTK_MENU(menu));
+       gtk_menu_item_activate(GTK_MENU_ITEM(menuitem));
+}
+
 static void prefs_account_protocol_activated(GtkMenuItem *menuitem)
 {
        RecvProtocol protocol;
-       gboolean active;
-       gint auth;
 
        protocol = GPOINTER_TO_INT
                (gtk_object_get_user_data(GTK_OBJECT(menuitem)));
@@ -1861,17 +2263,26 @@ static void prefs_account_protocol_activated(GtkMenuItem *menuitem)
                prefs_account_nntpauth_toggled
                        (GTK_TOGGLE_BUTTON(basic.nntpauth_chkbtn), NULL);
                gtk_widget_set_sensitive(receive.pop3_frame, FALSE);
-               gtk_widget_set_sensitive(receive.imap_frame, FALSE);
                gtk_widget_set_sensitive(receive.recvatgetall_chkbtn, TRUE);
+
+               if (!tmp_ac_prefs.account_name) {
+                       gtk_toggle_button_set_active
+                               (GTK_TOGGLE_BUTTON(receive.recvatgetall_chkbtn),
+                                FALSE);
+               }
+
 #if USE_SSL
-               gtk_widget_set_sensitive(ssl.receive_frame, FALSE);
-               gtk_widget_set_sensitive(ssl.pop_chkbtn, FALSE);
-               gtk_widget_set_sensitive(ssl.imap_chkbtn, FALSE);
-               gtk_widget_set_sensitive(ssl.send_frame, FALSE);
+               gtk_widget_hide(ssl.pop_frame);
+               gtk_widget_hide(ssl.imap_frame);
+               gtk_widget_show(ssl.nntp_frame);
+               gtk_widget_hide(ssl.send_frame);
 #endif
                gtk_widget_hide(advanced.popport_hbox);
                gtk_widget_hide(advanced.imapport_hbox);
                gtk_widget_show(advanced.nntpport_hbox);
+               gtk_widget_show(advanced.crosspost_chkbtn);
+               gtk_widget_show(advanced.crosspost_colormenu);
+               gtk_widget_hide(advanced.imap_frame);
                break;
        case A_LOCAL:
                gtk_widget_hide(basic.nntpserv_label);
@@ -1913,20 +2324,28 @@ static void prefs_account_protocol_activated(GtkMenuItem *menuitem)
                gtk_widget_set_sensitive(basic.uid_entry,  TRUE);
                gtk_widget_set_sensitive(basic.pass_entry, TRUE);
                gtk_widget_set_sensitive(receive.pop3_frame, FALSE);
-               gtk_widget_set_sensitive(receive.imap_frame, FALSE);
                gtk_widget_set_sensitive(receive.recvatgetall_chkbtn, FALSE);
                prefs_account_mailcmd_toggled
                        (GTK_TOGGLE_BUTTON(basic.mailcmd_chkbtn), NULL);
 
+               if (!tmp_ac_prefs.account_name) {
+                       gtk_toggle_button_set_active
+                               (GTK_TOGGLE_BUTTON(receive.recvatgetall_chkbtn),
+                                TRUE);
+               }
+
 #if USE_SSL
-               gtk_widget_set_sensitive(ssl.receive_frame, FALSE);
-               gtk_widget_set_sensitive(ssl.pop_chkbtn, FALSE);
-               gtk_widget_set_sensitive(ssl.imap_chkbtn, FALSE);
-               gtk_widget_set_sensitive(ssl.send_frame, TRUE);
+               gtk_widget_hide(ssl.pop_frame);
+               gtk_widget_hide(ssl.imap_frame);
+               gtk_widget_hide(ssl.nntp_frame);
+               gtk_widget_show(ssl.send_frame);
 #endif
                gtk_widget_hide(advanced.popport_hbox);
                gtk_widget_hide(advanced.imapport_hbox);
                gtk_widget_hide(advanced.nntpport_hbox);
+               gtk_widget_hide(advanced.crosspost_chkbtn);
+               gtk_widget_hide(advanced.crosspost_colormenu);
+               gtk_widget_hide(advanced.imap_frame);
                break;
        case A_IMAP4:
                gtk_widget_hide(basic.nntpserv_label);
@@ -1970,20 +2389,28 @@ static void prefs_account_protocol_activated(GtkMenuItem *menuitem)
                gtk_widget_set_sensitive(basic.uid_entry,  TRUE);
                gtk_widget_set_sensitive(basic.pass_entry, TRUE);
                gtk_widget_set_sensitive(receive.pop3_frame, FALSE);
-               gtk_widget_set_sensitive(receive.imap_frame, TRUE);
                gtk_widget_set_sensitive(receive.recvatgetall_chkbtn, TRUE);
                gtk_widget_set_sensitive(basic.smtpserv_entry, TRUE);
                gtk_widget_set_sensitive(basic.smtpserv_label, TRUE);
 
+               if (!tmp_ac_prefs.account_name) {
+                       gtk_toggle_button_set_active
+                               (GTK_TOGGLE_BUTTON(receive.recvatgetall_chkbtn),
+                                FALSE);
+               }
+
 #if USE_SSL
-               gtk_widget_set_sensitive(ssl.receive_frame, TRUE);
-               gtk_widget_set_sensitive(ssl.pop_chkbtn, FALSE);
-               gtk_widget_set_sensitive(ssl.imap_chkbtn, TRUE);
-               gtk_widget_set_sensitive(ssl.send_frame, TRUE);
+               gtk_widget_hide(ssl.pop_frame);
+               gtk_widget_show(ssl.imap_frame);
+               gtk_widget_hide(ssl.nntp_frame);
+               gtk_widget_show(ssl.send_frame);
 #endif
                gtk_widget_hide(advanced.popport_hbox);
                gtk_widget_show(advanced.imapport_hbox);
                gtk_widget_hide(advanced.nntpport_hbox);
+               gtk_widget_hide(advanced.crosspost_chkbtn);
+               gtk_widget_hide(advanced.crosspost_colormenu);
+               gtk_widget_show(advanced.imap_frame);
                break;
        case A_POP3:
        default:
@@ -2028,20 +2455,28 @@ static void prefs_account_protocol_activated(GtkMenuItem *menuitem)
                gtk_widget_set_sensitive(basic.uid_entry,  TRUE);
                gtk_widget_set_sensitive(basic.pass_entry, TRUE);
                gtk_widget_set_sensitive(receive.pop3_frame, TRUE);
-               gtk_widget_set_sensitive(receive.imap_frame, FALSE);
                gtk_widget_set_sensitive(receive.recvatgetall_chkbtn, TRUE);
                gtk_widget_set_sensitive(basic.smtpserv_entry, TRUE);
                gtk_widget_set_sensitive(basic.smtpserv_label, TRUE);
 
+               if (!tmp_ac_prefs.account_name) {
+                       gtk_toggle_button_set_active
+                               (GTK_TOGGLE_BUTTON(receive.recvatgetall_chkbtn),
+                                TRUE);
+               }
+
 #if USE_SSL
-               gtk_widget_set_sensitive(ssl.receive_frame, TRUE);
-               gtk_widget_set_sensitive(ssl.pop_chkbtn, TRUE);
-               gtk_widget_set_sensitive(ssl.imap_chkbtn, FALSE);
-               gtk_widget_set_sensitive(ssl.send_frame, TRUE);
+               gtk_widget_show(ssl.pop_frame);
+               gtk_widget_hide(ssl.imap_frame);
+               gtk_widget_hide(ssl.nntp_frame);
+               gtk_widget_show(ssl.send_frame);
 #endif
                gtk_widget_show(advanced.popport_hbox);
                gtk_widget_hide(advanced.imapport_hbox);
                gtk_widget_hide(advanced.nntpport_hbox);
+               gtk_widget_hide(advanced.crosspost_chkbtn);
+               gtk_widget_hide(advanced.crosspost_colormenu);
+               gtk_widget_hide(advanced.imap_frame);
                break;
        }
 
@@ -2076,19 +2511,3 @@ static void prefs_account_mailcmd_toggled(GtkToggleButton *button,
        gtk_widget_set_sensitive(basic.uid_entry,  !use_mailcmd);
        gtk_widget_set_sensitive(basic.pass_entry, !use_mailcmd);
 }
-
-static void prefs_account_smtp_userid_cb(GtkEditable *editable,
-                                        gpointer smtp_passwd)
-{
-       gchar *buf;
-       gboolean use_smtp_userid;
-       
-       buf = gtk_editable_get_chars(editable, 0, -1);
-       if(buf[0] == '\0') {
-               use_smtp_userid = FALSE;
-       } else {
-               use_smtp_userid = TRUE;
-       }
-       gtk_widget_set_sensitive(GTK_WIDGET(smtp_passwd), use_smtp_userid);
-       g_free(buf);
-}