add option 'Generate X-Newsreader header' for NNTP accounts and complete the 'Generat...
authorPaul <paul@claws-mail.org>
Mon, 3 Feb 2014 13:16:00 +0000 (13:16 +0000)
committerPaul <paul@claws-mail.org>
Mon, 3 Feb 2014 13:16:00 +0000 (13:16 +0000)
src/account.c
src/compose.c
src/prefs_account.c
src/prefs_account.h

index 2d70e6d..a5053e4 100644 (file)
@@ -948,6 +948,7 @@ static void account_clone(GtkWidget *widget, gpointer data)
        /* send */
        ACP_FASSIGN(gen_msgid);
        ACP_FASSIGN(gen_xmailer);
+       ACP_FASSIGN(gen_xnewsreader);
        ACP_FASSIGN(add_customhdr);
        ACP_FASSIGN(use_smtp_auth);
        ACP_FASSIGN(smtp_auth_type);
index 69bfac6..b5a5ad8 100644 (file)
@@ -6450,7 +6450,8 @@ static gchar *compose_get_header(Compose *compose)
                        gtk_major_version, gtk_minor_version, gtk_micro_version,
                        TARGET_ALIAS);
        }
-       if (g_slist_length(compose->newsgroup_list) && !IS_IN_CUSTOM_HEADER("X-Newsreader")) {
+       if (compose->account->gen_xnewsreader &&
+           g_slist_length(compose->newsgroup_list) && !IS_IN_CUSTOM_HEADER("X-Newsreader")) {
                g_string_append_printf(header, "X-Newsreader: %s (GTK+ %d.%d.%d; %s)\n",
                        prog_version,
                        gtk_major_version, gtk_minor_version, gtk_micro_version,
index 43295c0..c5f8ab9 100644 (file)
@@ -168,6 +168,7 @@ typedef struct SendPage
 
        GtkWidget *msgid_checkbtn;
        GtkWidget *xmailer_checkbtn;
+       GtkWidget *xnewsreader_checkbtn;
        GtkWidget *customhdr_checkbtn;
        GtkWidget *msgid_with_addr_checkbtn;
        GtkWidget *smtp_auth_checkbtn;
@@ -514,6 +515,10 @@ static PrefParam send_param[] = {
         &send_page.xmailer_checkbtn,
         prefs_set_data_from_toggle, prefs_set_toggle},
 
+       {"generate_xnewsreader", "TRUE", &tmp_ac_prefs.gen_xnewsreader, P_BOOL,
+        &send_page.xnewsreader_checkbtn,
+        prefs_set_data_from_toggle, prefs_set_toggle},
+
        {"add_custom_header", "FALSE", &tmp_ac_prefs.add_customhdr, P_BOOL,
         &send_page.customhdr_checkbtn,
         prefs_set_data_from_toggle, prefs_set_toggle},
@@ -1666,6 +1671,7 @@ static void send_create_widget_func(PrefsPage * _page,
        GtkWidget *frame;
        GtkWidget *msgid_checkbtn;
        GtkWidget *xmailer_checkbtn;
+       GtkWidget *xnewsreader_checkbtn;
        GtkWidget *hbox;
        GtkWidget *customhdr_checkbtn;
        GtkWidget *customhdr_edit_btn;
@@ -1700,6 +1706,9 @@ static void send_create_widget_func(PrefsPage * _page,
        PACK_CHECK_BUTTON (vbox2, xmailer_checkbtn,
                           _("Generate X-Mailer header"));
 
+       PACK_CHECK_BUTTON (vbox2, xnewsreader_checkbtn,
+                          _("Generate X-Newsreader header"));
+
        hbox = gtk_hbox_new (FALSE, 12);
        gtk_widget_show (hbox);
        gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0);
@@ -1845,6 +1854,7 @@ static void send_create_widget_func(PrefsPage * _page,
        
        page->msgid_checkbtn     = msgid_checkbtn;
        page->xmailer_checkbtn   = xmailer_checkbtn;
+       page->xnewsreader_checkbtn   = xnewsreader_checkbtn;
        page->customhdr_checkbtn = customhdr_checkbtn;
        page->msgid_with_addr_checkbtn  = checkbtn_msgid_with_addr;
 
@@ -3947,8 +3957,13 @@ static void prefs_account_protocol_set_optmenu(PrefParam *pparam)
                        gtk_widget_hide(send_page.msgid_checkbtn);
                } else
                        gtk_widget_show(send_page.msgid_checkbtn);
-
-               gtk_widget_show(send_page.xmailer_checkbtn);
+               if (protocol == A_NNTP) {
+                       gtk_widget_hide(send_page.xmailer_checkbtn);
+                       gtk_widget_show(send_page.xnewsreader_checkbtn);
+               } else {
+                       gtk_widget_show(send_page.xmailer_checkbtn);
+                       gtk_widget_hide(send_page.xnewsreader_checkbtn);                        
+               }
        }
 }
 
@@ -4097,7 +4112,8 @@ static void prefs_account_protocol_changed(GtkComboBox *combobox, gpointer data)
                gtk_widget_hide(protocol_optmenu->no_imap_warn_label);
 #endif
                gtk_widget_show(send_page.msgid_checkbtn);
-               gtk_widget_show(send_page.xmailer_checkbtn);
+               gtk_widget_hide(send_page.xmailer_checkbtn);
+               gtk_widget_show(send_page.xnewsreader_checkbtn);
                gtk_widget_show(basic_page.nntpserv_label);
                gtk_widget_show(basic_page.nntpserv_entry);
                gtk_table_set_row_spacing (GTK_TABLE (basic_page.serv_table),
@@ -4198,6 +4214,7 @@ static void prefs_account_protocol_changed(GtkComboBox *combobox, gpointer data)
        case A_LOCAL:
                gtk_widget_show(send_page.msgid_checkbtn);
                gtk_widget_show(send_page.xmailer_checkbtn);
+               gtk_widget_hide(send_page.xnewsreader_checkbtn);
                gtk_widget_hide(protocol_optmenu->no_imap_warn_icon);
                gtk_widget_hide(protocol_optmenu->no_imap_warn_label);
                gtk_widget_hide(basic_page.nntpserv_label);
@@ -4304,6 +4321,7 @@ static void prefs_account_protocol_changed(GtkComboBox *combobox, gpointer data)
                                TRUE);
                gtk_widget_hide(send_page.msgid_checkbtn);
                gtk_widget_show(send_page.xmailer_checkbtn);
+               gtk_widget_hide(send_page.xnewsreader_checkbtn);
                gtk_widget_hide(basic_page.nntpserv_label);
                gtk_widget_hide(basic_page.nntpserv_entry);
                gtk_table_set_row_spacing (GTK_TABLE (basic_page.serv_table),
@@ -4403,6 +4421,7 @@ static void prefs_account_protocol_changed(GtkComboBox *combobox, gpointer data)
        case A_NONE:
                gtk_widget_show(send_page.msgid_checkbtn);
                gtk_widget_show(send_page.xmailer_checkbtn);
+               gtk_widget_hide(send_page.xnewsreader_checkbtn);
                gtk_widget_hide(protocol_optmenu->no_imap_warn_icon);
                gtk_widget_hide(protocol_optmenu->no_imap_warn_label);
                gtk_widget_hide(basic_page.nntpserv_label);
@@ -4500,6 +4519,7 @@ static void prefs_account_protocol_changed(GtkComboBox *combobox, gpointer data)
        default:
                gtk_widget_show(send_page.msgid_checkbtn);
                gtk_widget_show(send_page.xmailer_checkbtn);
+               gtk_widget_hide(send_page.xnewsreader_checkbtn);
                gtk_widget_hide(protocol_optmenu->no_imap_warn_icon);
                gtk_widget_hide(protocol_optmenu->no_imap_warn_label);
                gtk_widget_hide(basic_page.nntpserv_label);
index 40b9301..6bc27a9 100644 (file)
@@ -110,6 +110,7 @@ struct _PrefsAccount
        /* Send */
        gboolean gen_msgid;
        gboolean gen_xmailer;
+       gboolean gen_xnewsreader;
        gboolean add_customhdr;
        gboolean use_smtp_auth;
        SMTPAuthType smtp_auth_type;