sync with sylpheed 0.4.67cvs5
authorAlfons Hoogervorst <alfons@proteus.demon.nl>
Sun, 13 May 2001 13:03:37 +0000 (13:03 +0000)
committerAlfons Hoogervorst <alfons@proteus.demon.nl>
Sun, 13 May 2001 13:03:37 +0000 (13:03 +0000)
17 files changed:
ChangeLog
ChangeLog.claws
ChangeLog.jp
TODO
TODO.jp
configure.in
src/Makefile.am
src/about.c
src/compose.c
src/customheader.c
src/customheader.h
src/defs.h
src/filesel.c
src/prefs_account.c
src/prefs_account.h
src/prefs_customheader.c [moved from src/prefs_headers.c with 87% similarity]
src/prefs_customheader.h [moved from src/prefs_headers.h with 76% similarity]

index 1724714dcedfd5069a814b5c2a178415210e1aca..0af6415d905941994a425f2a5d5a513540b920a7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2001-05-13
+
+       * merged the custom header stuff from claws branch:
+       * src/customheader.[ch]
+         src/prefs_customheader.[ch]: new.
+       * src/customheader.c: custom_header_read_str(): use strtol() instead
+         of atoi() and check errors.
+         custom_header_find(): new function.
+       * src/compose.c: IS_IN_CUSTOM_HEADER(): new macro.
+         compose_write_headers(): made it replace headers with user-defined
+         headers except for some automatically generated headers.
+
 2001-05-11
 
        * src/inc.c: connection_check_cb(): fixed a bug that caused
 2001-05-11
 
        * src/inc.c: connection_check_cb(): fixed a bug that caused
index a48af26a5a31bc0f7126a360986ab1473f694fc0..1402d8999ba86ddd2458efde313bb07050da91e5 100644 (file)
@@ -1,3 +1,9 @@
+2001-03-13 [alfons]
+
+       0.4.67claws3
+       
+       * sync with sylpheed 0.4.67cvs5
+
 2001-05-13 [paul]
 
         * added Alfons' font selection patch
 2001-05-13 [paul]
 
         * added Alfons' font selection patch
index 9fc15ad2eaddf8e8503afe113efb853ca2e5251e..863af4fee63f97422d6c3de9ea3838f871d6c123 100644 (file)
@@ -1,3 +1,14 @@
+2001-05-13
+
+       * claws ¥Ö¥é¥ó¥Á¤«¤é¥«¥¹¥¿¥à¥Ø¥Ã¥À´ØÏ¢¤ò¥Þ¡¼¥¸:
+       * src/customheader.[ch]
+         src/prefs_customheader.[ch]: ¿·µ¬¡£
+       * src/customheader.c: custom_header_read_str(): atoi() ¤ÎÂå¤ï¤ê¤Ë
+         strtol() ¤ò»ÈÍѤ·¡¢¥¨¥é¡¼¤ò¥Á¥§¥Ã¥¯¤¹¤ë¤è¤¦¤Ë¤·¤¿¡£
+       * src/compose.c: IS_IN_CUSTOM_HEADER(): ¿·µ¬¥Þ¥¯¥í¡£
+         compose_write_headers(): ¥Ø¥Ã¥À¤ò¥æ¡¼¥¶ÄêµÁ¤Î¥Ø¥Ã¥À¤ÇÃÖ´¹¤¹¤ë
+         ¤è¤¦¤Ë¤·¤¿(¤¤¤¯¤Ä¤«¤Î¼«Æ°Åª¤ËÀ¸À®¤µ¤ì¤ë¥Ø¥Ã¥À¤ò½ü¤¯)¡£
+
 2001-05-11
 
        * src/inc.c: connection_check_cb(): Àܳ¤¬³ÎΩ¤·¤Ê¤«¤Ã¤¿¤È¤­¤Ë
 2001-05-11
 
        * src/inc.c: connection_check_cb(): Àܳ¤¬³ÎΩ¤·¤Ê¤«¤Ã¤¿¤È¤­¤Ë
diff --git a/TODO b/TODO
index 5f9e25c310cbbfc9545266535d64e6178ead94a4..0c5226ac5f02a767b43b5700ff9ddc96d73b0a8b 100644 (file)
--- a/TODO
+++ b/TODO
@@ -7,8 +7,6 @@ o POP before SMTP
 o list view of newsgroups and subscription of groups from there
 o full-text search of messages (plain, or hooking up with Namazu)
 o original icons and logos
 o list view of newsgroups and subscription of groups from there
 o full-text search of messages (plain, or hooking up with Namazu)
 o original icons and logos
-o designate the displayed headers
-o user-defined headers
 o template function
 o speed-up of filtering
 o regular expression support at filtering
 o template function
 o speed-up of filtering
 o regular expression support at filtering
@@ -64,3 +62,5 @@ Implemented features
 * completion of mail address
 * prohibition of multiple execution (with Unix domain socket)
 * periodical check of newly arrived mails
 * completion of mail address
 * prohibition of multiple execution (with Unix domain socket)
 * periodical check of newly arrived mails
+* designate the displayed headers
+* user-defined headers
diff --git a/TODO.jp b/TODO.jp
index f762646bb71ba6ae757b885bdf400dd9d113c071..61abf0332eab0eaa42800b6ac94d5ea04418d36d 100644 (file)
--- a/TODO.jp
+++ b/TODO.jp
@@ -7,8 +7,6 @@ o POP before SMTP
 o ¥Ë¥å¡¼¥¹¥°¥ë¡¼¥×¤Î¥ê¥¹¥Èɽ¼¨¤È¤½¤³¤«¤é¤Î¹ØÆÉ¥°¥ë¡¼¥×ÄɲÃ
 o ¥á¥Ã¥»¡¼¥¸¤ÎÁ´Ê¸¸¡º÷ (¥Ù¥¿¡¢ Namazu ¤È¤ÎÏ¢·È)
 o ¥ª¥ê¥¸¥Ê¥ë¤Î¥¢¥¤¥³¥ó¤È¥í¥´
 o ¥Ë¥å¡¼¥¹¥°¥ë¡¼¥×¤Î¥ê¥¹¥Èɽ¼¨¤È¤½¤³¤«¤é¤Î¹ØÆÉ¥°¥ë¡¼¥×ÄɲÃ
 o ¥á¥Ã¥»¡¼¥¸¤ÎÁ´Ê¸¸¡º÷ (¥Ù¥¿¡¢ Namazu ¤È¤ÎÏ¢·È)
 o ¥ª¥ê¥¸¥Ê¥ë¤Î¥¢¥¤¥³¥ó¤È¥í¥´
-o É½¼¨¤µ¤ì¤ë¥Ø¥Ã¥À¤Î»ØÄê
-o ¥æ¡¼¥¶ÄêµÁ¤Î¥Ø¥Ã¥À
 o ¥Æ¥ó¥×¥ì¡¼¥Èµ¡Ç½
 o ¿¶¤êʬ¤±½èÍý¤Î¹â®²½
 o ¿¶¤êʬ¤±¤ÇÀµµ¬É½¸½¤ËÂбþ¤¹¤ë
 o ¥Æ¥ó¥×¥ì¡¼¥Èµ¡Ç½
 o ¿¶¤êʬ¤±½èÍý¤Î¹â®²½
 o ¿¶¤êʬ¤±¤ÇÀµµ¬É½¸½¤ËÂбþ¤¹¤ë
@@ -65,3 +63,5 @@ o 
 * ¥á¡¼¥ë¥¢¥É¥ì¥¹¤ÎÊä´°
 * Æó½Åµ¯Æ°Ëɻߠ(with Unix domain socket)
 * ¿·Ãå¥á¡¼¥ë¤ÎÄê´üŪ¥Á¥§¥Ã¥¯
 * ¥á¡¼¥ë¥¢¥É¥ì¥¹¤ÎÊä´°
 * Æó½Åµ¯Æ°Ëɻߠ(with Unix domain socket)
 * ¿·Ãå¥á¡¼¥ë¤ÎÄê´üŪ¥Á¥§¥Ã¥¯
+* É½¼¨¤µ¤ì¤ë¥Ø¥Ã¥À¤Î»ØÄê
+* ¥æ¡¼¥¶ÄêµÁ¤Î¥Ø¥Ã¥À
index bf153ae95a3c2b617e47fc2db17be300cf60947c..ee6e4d8aae85bb0847f53cfaf4156f08f49bc3eb 100644 (file)
@@ -8,7 +8,7 @@ MINOR_VERSION=4
 MICRO_VERSION=67
 INTERFACE_AGE=67
 BINARY_AGE=67
 MICRO_VERSION=67
 INTERFACE_AGE=67
 BINARY_AGE=67
-EXTRA_VERSION=claws2
+EXTRA_VERSION=claws3
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl
index b8c8be1d4f345c0d40d913e2b55694eb207c883c..6757ee7ee200605c8e5bf21cf234633676c2f928 100644 (file)
@@ -26,8 +26,10 @@ sylpheed_SOURCES = \
        prefs_filter.c prefs_filter.h \
        prefs_account.c prefs_account.h \
        prefs_display_header.c prefs_display_header.h \
        prefs_filter.c prefs_filter.h \
        prefs_account.c prefs_account.h \
        prefs_display_header.c prefs_display_header.h \
+       prefs_customheader.c prefs_customheader.h \
        account.c account.h \
        displayheader.c displayheader.h \
        account.c account.h \
        displayheader.c displayheader.h \
+       customheader.c customheader.h \
        addressbook.c addressbook.h \
        filesel.c filesel.h \
        foldersel.c foldersel.h \
        addressbook.c addressbook.h \
        filesel.c filesel.h \
        foldersel.c foldersel.h \
@@ -77,8 +79,6 @@ sylpheed_SOURCES = \
        addr_compl.c addr_compl.h \
        gtkstext.c gtkstext.h \
        grouplist_dialog.c grouplist_dialog.h \
        addr_compl.c addr_compl.h \
        gtkstext.c gtkstext.h \
        grouplist_dialog.c grouplist_dialog.h \
-       customheader.c customheader.h \
-       prefs_headers.c prefs_headers.h \
        scoring.c scoring.h \
        prefs_folder_item.c prefs_folder_item.h \
        matcher.c matcher.h \
        scoring.c scoring.h \
        prefs_folder_item.c prefs_folder_item.h \
        matcher.c matcher.h \
index 60c3888459670e97e97e5720217615830b32535a..79608d1851059fd0a202d34c42fca6afdf5a45a4 100644 (file)
@@ -79,10 +79,10 @@ static void about_create(void)
        GdkColormap *cmap;
        GdkColor uri_color[2] = {{0, 0, 0, 0xffff}, {0, 0xffff, 0, 0}};
        gboolean success[2];
        GdkColormap *cmap;
        GdkColor uri_color[2] = {{0, 0, 0, 0xffff}, {0, 0xffff, 0, 0}};
        gboolean success[2];
-       
+
 #if HAVE_SYS_UTSNAME_H
        struct utsname utsbuf;
 #if HAVE_SYS_UTSNAME_H
        struct utsname utsbuf;
-#endif 
+#endif
        gchar buf[1024];
        gint i;
 
        gchar buf[1024];
        gint i;
 
@@ -91,7 +91,6 @@ static void about_create(void)
        gtk_container_set_border_width(GTK_CONTAINER(window), 8);
        gtk_widget_set_usize(window, 518, 358);
        gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
        gtk_container_set_border_width(GTK_CONTAINER(window), 8);
        gtk_widget_set_usize(window, 518, 358);
        gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
-       /* gtk_window_set_policy(GTK_WINDOW(window), FALSE, FALSE, FALSE); */
        gtk_signal_connect(GTK_OBJECT(window), "delete_event",
                           GTK_SIGNAL_FUNC(gtk_widget_hide_on_delete), NULL);
        gtk_signal_connect(GTK_OBJECT(window), "key_press_event",
        gtk_signal_connect(GTK_OBJECT(window), "delete_event",
                           GTK_SIGNAL_FUNC(gtk_widget_hide_on_delete), NULL);
        gtk_signal_connect(GTK_OBJECT(window), "key_press_event",
@@ -107,7 +106,7 @@ static void about_create(void)
 
        label = gtk_label_new("version "VERSION);
        gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
 
        label = gtk_label_new("version "VERSION);
        gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
-       
+
 #if HAVE_SYS_UTSNAME_H
        uname(&utsbuf);
        g_snprintf(buf, sizeof(buf),
 #if HAVE_SYS_UTSNAME_H
        uname(&utsbuf);
        g_snprintf(buf, sizeof(buf),
index 9b766796ad564d7a1ff95d13bed8aac74d390b06..c7b8fc619901e128db49d0f0681076374e18fa09 100644 (file)
@@ -79,6 +79,7 @@
 #include "menu.h"
 #include "send.h"
 #include "news.h"
 #include "menu.h"
 #include "send.h"
 #include "news.h"
+#include "customheader.h"
 #include "prefs_common.h"
 #include "prefs_account.h"
 #include "account.h"
 #include "prefs_common.h"
 #include "prefs_account.h"
 #include "account.h"
@@ -97,7 +98,6 @@
 #include "gtkshruler.h"
 #include "folder.h"
 #include "addr_compl.h"
 #include "gtkshruler.h"
 #include "folder.h"
 #include "addr_compl.h"
-#include "customheader.h"
 
 #if USE_GPGME
 #  include "rfc2015.h"
 
 #if USE_GPGME
 #  include "rfc2015.h"
@@ -592,6 +592,8 @@ void compose_forward(MsgInfo *msginfo, gboolean as_attach)
                gtk_widget_grab_focus(compose->newsgroups_entry);
 }
 
                gtk_widget_grab_focus(compose->newsgroups_entry);
 }
 
+#undef INSERT_FW_HEADER
+
 void compose_reedit(MsgInfo *msginfo)
 {
        Compose *compose;
 void compose_reedit(MsgInfo *msginfo)
 {
        Compose *compose;
@@ -1168,6 +1170,8 @@ static void compose_reedit_set_entry(Compose *compose, MsgInfo *msginfo)
        }
 }
 
        }
 }
 
+#undef SET_ENTRY
+
 static void compose_insert_sig(Compose *compose)
 {
        gchar *sigfile;
 static void compose_insert_sig(Compose *compose)
 {
        gchar *sigfile;
@@ -1862,20 +1866,9 @@ static void compose_write_attach(Compose *compose, FILE *fp)
        fprintf(fp, "\n--%s--\n", compose->boundary);
 }
 
        fprintf(fp, "\n--%s--\n", compose->boundary);
 }
 
-static gint is_in_custom_headers(Compose *compose, gchar * header)
-{
-       GSList * cur;
-
-       if (compose->account->add_customhdr) {
-               for (cur = compose->account->customhdr_list;
-                    cur != NULL; cur = cur->next) {
-                       CustomHeader * ch = (CustomHeader *) cur->data;
-                       if (strcasecmp(ch->name, header) == 0)
-                               return 1;
-               }
-       }
-       return 0;
-}
+#define IS_IN_CUSTOM_HEADER(header) \
+       (compose->account->add_customhdr && \
+        custom_header_find(compose->account->customhdr_list, header) != NULL)
 
 static gint compose_write_headers(Compose *compose, FILE *fp,
                                  const gchar *charset, EncodingType encoding,
 
 static gint compose_write_headers(Compose *compose, FILE *fp,
                                  const gchar *charset, EncodingType encoding,
@@ -1884,7 +1877,6 @@ static gint compose_write_headers(Compose *compose, FILE *fp,
        gchar buf[BUFFSIZE];
        gchar *str;
        /* struct utsname utsbuf; */
        gchar buf[BUFFSIZE];
        gchar *str;
        /* struct utsname utsbuf; */
-       GSList * cur;
 
        g_return_val_if_fail(fp != NULL, -1);
        g_return_val_if_fail(charset != NULL, -1);
 
        g_return_val_if_fail(fp != NULL, -1);
        g_return_val_if_fail(charset != NULL, -1);
@@ -1892,24 +1884,23 @@ static gint compose_write_headers(Compose *compose, FILE *fp,
        g_return_val_if_fail(compose->account->address != NULL, -1);
 
        /* Date */
        g_return_val_if_fail(compose->account->address != NULL, -1);
 
        /* Date */
-       if (!is_in_custom_headers(compose, "Date")) {
-               if (compose->account->add_date) {
-                       get_rfc822_date(buf, sizeof(buf));
-                       fprintf(fp, "Date: %s\n", buf);
-               }
+       if (compose->account->add_date) {
+               get_rfc822_date(buf, sizeof(buf));
+               fprintf(fp, "Date: %s\n", buf);
        }
        }
-
+       
        /* From */
        /* From */
-       if (!is_in_custom_headers(compose, "From")) {
+       if (!IS_IN_CUSTOM_HEADER("From")) {
                if (compose->account->name && *compose->account->name) {
                        compose_convert_header
                                (buf, sizeof(buf), compose->account->name,
                                 strlen("From: "));
                if (compose->account->name && *compose->account->name) {
                        compose_convert_header
                                (buf, sizeof(buf), compose->account->name,
                                 strlen("From: "));
-                       fprintf(fp, "From: %s <%s>\n", buf, compose->account->address);
+                       fprintf(fp, "From: %s <%s>\n",
+                               buf, compose->account->address);
                } else
                        fprintf(fp, "From: %s\n", compose->account->address);
        }
                } else
                        fprintf(fp, "From: %s\n", compose->account->address);
        }
-
+       
        slist_free_strings(compose->to_list);
        g_slist_free(compose->to_list);
        compose->to_list = NULL;
        slist_free_strings(compose->to_list);
        g_slist_free(compose->to_list);
        compose->to_list = NULL;
@@ -1923,15 +1914,16 @@ static gint compose_write_headers(Compose *compose, FILE *fp,
                        if (*str != '\0') {
                                compose->to_list = address_list_append
                                        (compose->to_list, str);
                        if (*str != '\0') {
                                compose->to_list = address_list_append
                                        (compose->to_list, str);
-                               compose_convert_header(buf, sizeof(buf), str,
-                                                      strlen("To: "));
-                               if (!is_in_custom_headers(compose, "To")) {
+                               if (!IS_IN_CUSTOM_HEADER("To")) {
+                                       compose_convert_header
+                                               (buf, sizeof(buf), str,
+                                                strlen("To: "));
                                        fprintf(fp, "To: %s\n", buf);
                                }
                        }
                }
        }
                                        fprintf(fp, "To: %s\n", buf);
                                }
                        }
                }
        }
-
+       
        slist_free_strings(compose->newsgroup_list);
        g_slist_free(compose->newsgroup_list);
        compose->newsgroup_list = NULL;
        slist_free_strings(compose->newsgroup_list);
        g_slist_free(compose->newsgroup_list);
        compose->newsgroup_list = NULL;
@@ -1946,9 +1938,9 @@ static gint compose_write_headers(Compose *compose, FILE *fp,
                        compose->newsgroup_list =
                                newsgroup_list_append(compose->newsgroup_list,
                                                      str);
                        compose->newsgroup_list =
                                newsgroup_list_append(compose->newsgroup_list,
                                                      str);
-                       compose_convert_header(buf, sizeof(buf), str,
-                                              strlen("Newsgroups: "));
-                       if (!is_in_custom_headers(compose, "Newsgroups")) {
+                       if (!IS_IN_CUSTOM_HEADER("Newsgroups")) {
+                               compose_convert_header(buf, sizeof(buf), str,
+                                                      strlen("Newsgroups: "));
                                fprintf(fp, "Newsgroups: %s\n", buf);
                        }
                }
                                fprintf(fp, "Newsgroups: %s\n", buf);
                        }
                }
@@ -1966,15 +1958,16 @@ static gint compose_write_headers(Compose *compose, FILE *fp,
                        if (*str != '\0') {
                                compose->to_list = address_list_append
                                        (compose->to_list, str);
                        if (*str != '\0') {
                                compose->to_list = address_list_append
                                        (compose->to_list, str);
-                               compose_convert_header(buf, sizeof(buf), str,
-                                                      strlen("Cc: "));
-                               if (!is_in_custom_headers(compose, "Cc")) {
+                               if (!IS_IN_CUSTOM_HEADER("Cc")) {
+                                       compose_convert_header
+                                               (buf, sizeof(buf), str,
+                                                strlen("Cc: "));
                                        fprintf(fp, "Cc: %s\n", buf);
                                }
                        }
                }
        }
                                        fprintf(fp, "Cc: %s\n", buf);
                                }
                        }
                }
        }
-
+       
        /* Bcc */
        if (compose->use_bcc) {
                str = gtk_entry_get_text(GTK_ENTRY(compose->bcc_entry));
        /* Bcc */
        if (compose->use_bcc) {
                str = gtk_entry_get_text(GTK_ENTRY(compose->bcc_entry));
@@ -1988,162 +1981,142 @@ static gint compose_write_headers(Compose *compose, FILE *fp,
                                        compose_convert_header
                                                (buf, sizeof(buf), str,
                                                 strlen("Bcc: "));
                                        compose_convert_header
                                                (buf, sizeof(buf), str,
                                                 strlen("Bcc: "));
-                                       if (!is_in_custom_headers(compose,
-                                                                 "Bcc")) {
-                                               fprintf(fp, "Bcc: %s\n", buf);
-                                       }
+                                       fprintf(fp, "Bcc: %s\n", buf);
                                }
                        }
                }
        }
 
        /* Subject */
                                }
                        }
                }
        }
 
        /* Subject */
-       if (!is_in_custom_headers(compose, "Subject")) {
-               str = gtk_entry_get_text(GTK_ENTRY(compose->subject_entry));
+       str = gtk_entry_get_text(GTK_ENTRY(compose->subject_entry));
+       if (*str != '\0' && !IS_IN_CUSTOM_HEADER("Subject")) {
+               Xstrdup_a(str, str, return -1);
+               g_strstrip(str);
                if (*str != '\0') {
                if (*str != '\0') {
-                       Xstrdup_a(str, str, return -1);
-                       g_strstrip(str);
-                       if (*str != '\0') {
-                               compose_convert_header(buf, sizeof(buf), str,
-                                                      strlen("Subject: "));
-                               fprintf(fp, "Subject: %s\n", buf);
-                       }
+                       compose_convert_header(buf, sizeof(buf), str,
+                                              strlen("Subject: "));
+                       fprintf(fp, "Subject: %s\n", buf);
                }
        }
 
        /* Message-ID */
                }
        }
 
        /* Message-ID */
-       if (!is_in_custom_headers(compose, "Message-Id")) {
-               if (compose->account->gen_msgid) {
-                       compose_generate_msgid(compose, buf, sizeof(buf));
-                       fprintf(fp, "Message-Id: <%s>\n", buf);
-                       compose->msgid = g_strdup(buf);
-               }
+       if (compose->account->gen_msgid) {
+               compose_generate_msgid(compose, buf, sizeof(buf));
+               fprintf(fp, "Message-Id: <%s>\n", buf);
+               compose->msgid = g_strdup(buf);
        }
 
        /* In-Reply-To */
        }
 
        /* In-Reply-To */
-       if (!is_in_custom_headers(compose, "In-Reply-To")) {
-               if (compose->inreplyto && compose->to_list)
-                       fprintf(fp, "In-Reply-To: <%s>\n", compose->inreplyto);
-       }
+       if (compose->inreplyto && compose->to_list)
+               fprintf(fp, "In-Reply-To: <%s>\n", compose->inreplyto);
 
        /* References */
 
        /* References */
-       if (!is_in_custom_headers(compose, "References")) {
-               if (compose->references)
-                       fprintf(fp, "References: %s\n", compose->references);
-       }
+       if (compose->references)
+               fprintf(fp, "References: %s\n", compose->references);
 
        /* Followup-To */
 
        /* Followup-To */
-       if (!is_in_custom_headers(compose, "Followup-To")) {
-               if (compose->use_followupto) {
-                       str = gtk_entry_get_text(GTK_ENTRY(compose->followup_entry));
+       if (compose->use_followupto && !IS_IN_CUSTOM_HEADER("Followup-To")) {
+               str = gtk_entry_get_text(GTK_ENTRY(compose->followup_entry));
+               if (*str != '\0') {
+                       Xstrdup_a(str, str, return -1);
+                       g_strstrip(str);
+                       remove_space(str);
                        if (*str != '\0') {
                        if (*str != '\0') {
-                               Xstrdup_a(str, str, return -1);
-                               g_strstrip(str);
-                               remove_space(str);
-                               if (*str != '\0') {
-                                       compose_convert_header(buf, sizeof(buf), str,
-                                                              strlen("Followup-To: "));
-                                       fprintf(fp, "Followup-To: %s\n", buf);
-                               }
+                               compose_convert_header(buf, sizeof(buf), str,
+                                                      strlen("Followup-To: "));
+                               fprintf(fp, "Followup-To: %s\n", buf);
                        }
                }
        }
 
        /* Reply-To */
                        }
                }
        }
 
        /* Reply-To */
-       if (!is_in_custom_headers(compose, "Reply-To")) {
-               if (compose->use_replyto) {
-                       str = gtk_entry_get_text(GTK_ENTRY(compose->reply_entry));
+       if (compose->use_replyto && !IS_IN_CUSTOM_HEADER("Reply-To")) {
+               str = gtk_entry_get_text(GTK_ENTRY(compose->reply_entry));
+               if (*str != '\0') {
+                       Xstrdup_a(str, str, return -1);
+                       g_strstrip(str);
                        if (*str != '\0') {
                        if (*str != '\0') {
-                               Xstrdup_a(str, str, return -1);
-                               g_strstrip(str);
-                               if (*str != '\0') {
-                                       compose_convert_header(buf, sizeof(buf), str,
-                                                              strlen("Reply-To: "));
-                                       fprintf(fp, "Reply-To: %s\n", buf);
-                               }
+                               compose_convert_header(buf, sizeof(buf), str,
+                                                      strlen("Reply-To: "));
+                               fprintf(fp, "Reply-To: %s\n", buf);
                        }
                }
        }
 
        /* Program version and system info */
        /* uname(&utsbuf); */
                        }
                }
        }
 
        /* Program version and system info */
        /* uname(&utsbuf); */
-       if (!is_in_custom_headers(compose, "X-Mailer")) {
-               str = gtk_entry_get_text(GTK_ENTRY(compose->to_entry));
-               if (*str != '\0') {
-                       fprintf(fp, "X-Mailer: %s (GTK+ %d.%d.%d; %s)\n",
-                               prog_version,
-                               gtk_major_version, gtk_minor_version, gtk_micro_version,
-                               HOST_ALIAS);
+       str = gtk_entry_get_text(GTK_ENTRY(compose->to_entry));
+       if (*str != '\0' && !IS_IN_CUSTOM_HEADER("X-Mailer")) {
+               fprintf(fp, "X-Mailer: %s (GTK+ %d.%d.%d; %s)\n",
+                       prog_version,
+                       gtk_major_version, gtk_minor_version, gtk_micro_version,
+                       HOST_ALIAS);
                        /* utsbuf.sysname, utsbuf.release, utsbuf.machine); */
                        /* utsbuf.sysname, utsbuf.release, utsbuf.machine); */
-               }
        }
        }
-
-       if (!is_in_custom_headers(compose, "X-Newsreader")) {
-               str = gtk_entry_get_text(GTK_ENTRY(compose->newsgroups_entry));
-               if (*str != '\0') {
+       str = gtk_entry_get_text(GTK_ENTRY(compose->newsgroups_entry));
+       if (*str != '\0' && !IS_IN_CUSTOM_HEADER("X-Newsreader")) {
                fprintf(fp, "X-Newsreader: %s (GTK+ %d.%d.%d; %s)\n",
                        prog_version,
                        gtk_major_version, gtk_minor_version, gtk_micro_version,
                        HOST_ALIAS);
                        /* utsbuf.sysname, utsbuf.release, utsbuf.machine); */
                fprintf(fp, "X-Newsreader: %s (GTK+ %d.%d.%d; %s)\n",
                        prog_version,
                        gtk_major_version, gtk_minor_version, gtk_micro_version,
                        HOST_ALIAS);
                        /* utsbuf.sysname, utsbuf.release, utsbuf.machine); */
-               }
        }
 
        /* Organization */
        }
 
        /* Organization */
-       if (!is_in_custom_headers(compose, "Organization")) {
-               if (compose->account->organization) {
-                       compose_convert_header(buf, sizeof(buf),
-                                              compose->account->organization,
-                                              strlen("Organization: "));
-                       fprintf(fp, "Organization: %s\n", buf);
-               }
+       if (compose->account->organization &&
+           !IS_IN_CUSTOM_HEADER("Organization")) {
+               compose_convert_header(buf, sizeof(buf),
+                                      compose->account->organization,
+                                      strlen("Organization: "));
+               fprintf(fp, "Organization: %s\n", buf);
        }
 
        /* MIME */
        }
 
        /* MIME */
-       if (!is_in_custom_headers(compose, "Mime-Version")) {
-               fprintf(fp, "Mime-Version: 1.0\n");
-       }
-
-       /* Request Return Receipt */
-       if (!is_in_custom_headers(compose, "Disposition-Notification-To")) {
-               if (compose->return_receipt) {
-                       if (compose->account->name
-                           && *compose->account->name) {
-                               compose_convert_header(buf, sizeof(buf), compose->account->name, strlen("Disposition-Notification-To: "));
-                               fprintf(fp, "Disposition-Notification-To: %s <%s>\n", buf, compose->account->address);
-                       } else
-                               fprintf(fp, "Disposition-Notification-To: %s\n", compose->account->address);
-               }
-       }
-
+       fprintf(fp, "Mime-Version: 1.0\n");
        if (compose->use_attach) {
                get_rfc822_date(buf, sizeof(buf));
                subst_char(buf, ' ', '_');
                subst_char(buf, ',', '_');
                compose->boundary = g_strdup_printf("Multipart_%s_%08x",
                                                    buf, (guint)compose);
        if (compose->use_attach) {
                get_rfc822_date(buf, sizeof(buf));
                subst_char(buf, ' ', '_');
                subst_char(buf, ',', '_');
                compose->boundary = g_strdup_printf("Multipart_%s_%08x",
                                                    buf, (guint)compose);
-               if (!is_in_custom_headers(compose, "Content-Type")) {
-                       fprintf(fp,
-                               "Content-Type: multipart/mixed;\n"
-                               " boundary=\"%s\"\n", compose->boundary);
-               }
+               fprintf(fp,
+                       "Content-Type: multipart/mixed;\n"
+                       " boundary=\"%s\"\n", compose->boundary);
        } else {
        } else {
-               if (!is_in_custom_headers(compose, "Content-Type")) {
-                       fprintf(fp, "Content-Type: text/plain; charset=%s\n", charset);
-               }
-               if (!is_in_custom_headers(compose,
-                                         "Content-Transfer-Encoding")) {
-                       fprintf(fp, "Content-Transfer-Encoding: %s\n",
-                               procmime_get_encoding_str(encoding));
-               }
+               fprintf(fp, "Content-Type: text/plain; charset=%s\n", charset);
+               fprintf(fp, "Content-Transfer-Encoding: %s\n",
+                       procmime_get_encoding_str(encoding));
        }
 
        }
 
-       /* Custom Headers */
+       /* custom headers */
        if (compose->account->add_customhdr) {
        if (compose->account->add_customhdr) {
+               GSList *cur;
+
                for (cur = compose->account->customhdr_list; cur != NULL;
                     cur = cur->next) {
                for (cur = compose->account->customhdr_list; cur != NULL;
                     cur = cur->next) {
-                       CustomHeader * ch = (CustomHeader *) cur->data;
-                       fprintf(fp, "%s: %s\n", ch->name, ch->value);
+                       CustomHeader *chdr = (CustomHeader *)cur->data;
+
+                       if (strcasecmp(chdr->name, "Date") != 0 &&
+                           strcasecmp(chdr->name, "Message-Id") != 0 &&
+                           strcasecmp(chdr->name, "In-Reply-To") != 0 &&
+                           strcasecmp(chdr->name, "References") != 0 &&
+                           strcasecmp(chdr->name, "Mime-Version") != 0 &&
+                           strcasecmp(chdr->name, "Content-Type") != 0 &&
+                           strcasecmp(chdr->name, "Content-Transfer-Encoding") != 0)
+                               fprintf(fp, "%s: %s\n",
+                                       chdr->name, chdr->value);
+               }
+       }
+
+       /* Request Return Receipt */
+       if (!IS_IN_CUSTOM_HEADER("Disposition-Notification-To")) {
+               if (compose->return_receipt) {
+                       if (compose->account->name
+                           && *compose->account->name) {
+                               compose_convert_header(buf, sizeof(buf), compose->account->name, strlen("Disposition-Notification-To: "));
+                               fprintf(fp, "Disposition-Notification-To: %s <%s>\n", buf, compose->account->address);
+                       } else
+                               fprintf(fp, "Disposition-Notification-To: %s\n", compose->account->address);
                }
        }
 
                }
        }
 
@@ -2153,6 +2126,8 @@ static gint compose_write_headers(Compose *compose, FILE *fp,
        return 0;
 }
 
        return 0;
 }
 
+#undef IS_IN_CUSTOM_HEADER
+
 static void compose_convert_header(gchar *dest, gint len, gchar *src,
                                   gint header_len)
 {
 static void compose_convert_header(gchar *dest, gint len, gchar *src,
                                   gint header_len)
 {
@@ -2674,6 +2649,12 @@ static Compose *compose_create(PrefsAccount *account)
                        (GTK_CHECK_MENU_ITEM(menuitem), TRUE);
                gtk_widget_set_sensitive(menuitem, FALSE);
        }
                        (GTK_CHECK_MENU_ITEM(menuitem), TRUE);
                gtk_widget_set_sensitive(menuitem, FALSE);
        }
+       if (account->set_autocc && account->auto_cc) {
+               gtk_entry_set_text(GTK_ENTRY(cc_entry), account->auto_cc);
+               menuitem = gtk_item_factory_get_item(ifactory, "/Message/Cc");
+               gtk_check_menu_item_set_active
+                       (GTK_CHECK_MENU_ITEM(menuitem), TRUE);
+       }
        if (account->set_autobcc) {
                menuitem = gtk_item_factory_get_item(ifactory, "/Message/Bcc");
                gtk_check_menu_item_set_active
        if (account->set_autobcc) {
                menuitem = gtk_item_factory_get_item(ifactory, "/Message/Bcc");
                gtk_check_menu_item_set_active
@@ -2848,6 +2829,8 @@ static void compose_toolbar_create(Compose *compose, GtkWidget *container)
        gtk_widget_show_all(toolbar);
 }
 
        gtk_widget_show_all(toolbar);
 }
 
+#undef CREATE_TOOLBAR_ICON
+
 static GtkWidget *compose_account_option_menu_create(Compose *compose)
 {
        GList *accounts;
 static GtkWidget *compose_account_option_menu_create(Compose *compose)
 {
        GList *accounts;
@@ -3178,6 +3161,8 @@ static void compose_attach_property_create(gboolean *cancelled)
        attach_prop.cancel_btn       = cancel_btn;
 }
 
        attach_prop.cancel_btn       = cancel_btn;
 }
 
+#undef SET_LABEL_AND_ENTRY
+
 static void attach_property_ok(GtkWidget *widget, gboolean *cancelled)
 {
        *cancelled = FALSE;
 static void attach_property_ok(GtkWidget *widget, gboolean *cancelled)
 {
        *cancelled = FALSE;
index d585efa9067ceedfaabcf5e24f59a040b01958bd..add563a2c8b7ab28610dc7e97b75f749219150bc 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999,2000 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2001 Hiroyuki Yamamoto
  *
  * 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
  *
  * 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
@@ -23,7 +23,6 @@
 
 #include <glib.h>
 #include <string.h>
 
 #include <glib.h>
 #include <string.h>
-#include <strings.h>
 #include <stdlib.h>
 
 #include "intl.h"
 #include <stdlib.h>
 
 #include "intl.h"
 #include "utils.h"
 
 
 #include "utils.h"
 
 
-gchar * custom_header_get_str(CustomHeader *ch)
+gchar *custom_header_get_str(CustomHeader *ch)
 {
 {
-       return g_strdup_printf
-               ("%i:%s: %s", ch->account_id, ch->name, ch->value);
+       return g_strdup_printf("%i:%s: %s",
+                              ch->account_id, ch->name, ch->value);
 }
 }
-CustomHeader * custom_header_read_str(gchar * buf)
+
+CustomHeader *custom_header_read_str(const gchar *buf)
 {
 {
-       CustomHeader * ch;
-       gchar * account_id_str;
-       gchar * name;
-       gchar * value;
-       gchar * tmp;
-       Xalloca(tmp, strlen(buf) + 1, return NULL);
-       strcpy(tmp, buf);
+       CustomHeader *ch;
+       gchar *account_id_str;
+       gint id;
+       gchar *name;
+       gchar *value;
+       gchar *tmp;
+
+       Xstrdup_a(tmp, buf, return NULL);
+       g_strstrip(tmp);
 
        account_id_str = tmp;
 
 
        account_id_str = tmp;
 
-       name = strchr(account_id_str, ':');
-       if (!name)
-               return NULL;
-       else
-               *name++ = '\0';
+       name = strchr(account_id_str, ':');
+       if (!name)
+               return NULL;
+       else {
+               gchar *endp;
+
+               *name++ = '\0';
+               id = strtol(account_id_str, &endp, 10);
+               if (*endp != '\0') return NULL;
+       }
+
+       while (*name == ' ') name++;
 
 
-       while (*name == ' ')
-               name ++;
-       
-       ch = g_new0(CustomHeader, 1);
+       ch = g_new0(CustomHeader, 1);
+       ch->account_id = id;
 
 
-       ch->account_id = atoi(account_id_str);
-       if (ch->account_id == 0) {
+       value = strchr(name, ':');
+       if (!value) {
                g_free(ch);
                return NULL;
                g_free(ch);
                return NULL;
+       } else
+               *value++ = '\0';
+
+       ch->name = *name ? g_strdup(name) : NULL;
+       while (*value == ' ') value++;
+       ch->value = *value ? g_strdup(value) : NULL;
+
+       return ch;
+}
+
+CustomHeader *custom_header_find(GSList *header_list, const gchar *header)
+{
+       GSList *cur;
+       CustomHeader *chdr;
+
+       for (cur = header_list; cur != NULL; cur = cur->next) {
+               chdr = (CustomHeader *)cur->data;
+               if (!strcasecmp(chdr->name, header))
+                       return chdr;
        }
 
        }
 
-       value = strchr(name, ':');
-       if (!value)
-               {
-                       g_free(ch);
-                       return NULL;
-               }
-       else
-               *value++ = '\0';
-       ch->name = *name ? g_strdup(name) : NULL;
-       while (*value == ' ')
-               value ++;
-
-       ch->value = *value ? g_strdup(value) : NULL;
-
-       return ch;
+       return NULL;
 }
 }
+
 void custom_header_free(CustomHeader *ch)
 {
 void custom_header_free(CustomHeader *ch)
 {
-       if (!ch) return;
+       if (!ch) return;
+
        if (ch->name)
                g_free(ch->name);
        if (ch->value)
                g_free(ch->value);
        if (ch->name)
                g_free(ch->name);
        if (ch->value)
                g_free(ch->value);
-       g_free(ch);
+
+       g_free(ch);
 }
 }
index 938502a2321ef1d4722762af9b0af8d43881ec1e..8554ea7fd52273106c3a5e5036a536ed01179354 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999,2000 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2001 Hiroyuki Yamamoto
  *
  * 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
  *
  * 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
 #ifndef __CUSTOMHEADER_H__
 #define __CUSTOMHEADER_H__
 
 #ifndef __CUSTOMHEADER_H__
 #define __CUSTOMHEADER_H__
 
+#include <glib.h>
+
 struct _CustomHeader
 {
 struct _CustomHeader
 {
-       int account_id;
+       gint account_id;
        gchar *name;
        gchar *value;
 };
 
        gchar *name;
        gchar *value;
 };
 
-typedef struct _CustomHeader CustomHeader;
+typedef struct _CustomHeader   CustomHeader;
 
 
-gchar * custom_header_get_str(CustomHeader *ch);
-CustomHeader * custom_header_read_str(gchar * buf);
-void custom_header_free(CustomHeader *ch);
+gchar *custom_header_get_str           (CustomHeader   *ch);
+CustomHeader *custom_header_read_str   (const gchar    *buf);
+CustomHeader *custom_header_find       (GSList         *header_list,
+                                        const gchar    *header);
+void custom_header_free                        (CustomHeader   *ch);
 
 #endif /* __CUSTOMHEADER_H__ */
 
 #endif /* __CUSTOMHEADER_H__ */
index 0ed4845525f2fc9af69cb32dc90ac615964321c5..44a1c0a97a60b739fad66361f7cb4e101c8e4833 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999,2000 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2001 Hiroyuki Yamamoto
  *
  * 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
  *
  * 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
@@ -46,7 +46,7 @@
 #define COMMON_RC              "sylpheedrc"
 #define ACCOUNT_RC             "accountrc"
 #define FILTER_RC              "filterrc"
 #define COMMON_RC              "sylpheedrc"
 #define ACCOUNT_RC             "accountrc"
 #define FILTER_RC              "filterrc"
-#define HEADERS_RC             "headersrc"
+#define CUSTOM_HEADER_RC       "customheaderrc"
 #define DISPLAY_HEADER_RC      "dispheaderrc"
 #define FOLDERITEM_RC           "folderitemrc"
 #define SCORING_RC              "scoringrc"
 #define DISPLAY_HEADER_RC      "dispheaderrc"
 #define FOLDERITEM_RC           "folderitemrc"
 #define SCORING_RC              "scoringrc"
 #define FOLDER_SPACING                 4
 #define COLOR_DIM                      35000
 
 #define FOLDER_SPACING                 4
 #define COLOR_DIM                      35000
 
-#if 0
-#define NORMAL_FONT    "-*-helvetica-medium-r-normal--12-*," \
-                       "-*-*-medium-r-normal--12-*-*-*-*-*-*-*,*"
-#define BOLD_FONT      "-*-helvetica-bold-r-normal--12-*," \
-                       "-*-*-bold-r-normal--12-*-*-*-*-*-*-*,*"
-#define SMALL_FONT     "-*-helvetica-medium-r-normal--10-*," \
-                       "-*-*-medium-r-normal--10-*-*-*-*-*-*-*,*"
-#else
 #define NORMAL_FONT prefs_common.normalfont
 #define BOLD_FONT   prefs_common.boldfont
 #define SMALL_FONT     prefs_common.smallfont
 #define NORMAL_FONT prefs_common.normalfont
 #define BOLD_FONT   prefs_common.boldfont
 #define SMALL_FONT     prefs_common.smallfont
-#endif
 
 #endif /* __DEFS_H__ */
 
 #endif /* __DEFS_H__ */
index 1dd1500a06821007f1c42bc7fb0b9f752687e0bc..4c61bc0424e45c54fa272ee7ca970d4e711d6cbf 100644 (file)
@@ -99,8 +99,7 @@ static void filesel_create(const gchar *title)
                 "clicked", GTK_SIGNAL_FUNC(filesel_cancel_cb),
                 NULL);
        gtk_signal_connect(GTK_OBJECT(filesel), "delete_event",
                 "clicked", GTK_SIGNAL_FUNC(filesel_cancel_cb),
                 NULL);
        gtk_signal_connect(GTK_OBJECT(filesel), "delete_event",
-                          GTK_SIGNAL_FUNC(delete_event),
-                          NULL);
+                          GTK_SIGNAL_FUNC(delete_event), NULL);
        gtk_signal_connect(GTK_OBJECT(filesel), "key_press_event",
                           GTK_SIGNAL_FUNC(key_pressed), NULL);
        gtk_signal_connect(GTK_OBJECT(filesel), "focus_in_event",
        gtk_signal_connect(GTK_OBJECT(filesel), "key_press_event",
                           GTK_SIGNAL_FUNC(key_pressed), NULL);
        gtk_signal_connect(GTK_OBJECT(filesel), "focus_in_event",
index 9522fa03d3ffde33e855168167b4b011a830f959..648baf69ead61358b0a1983f2ab5f154794f0bcd 100644 (file)
@@ -36,6 +36,7 @@
 #include "main.h"
 #include "prefs.h"
 #include "prefs_account.h"
 #include "main.h"
 #include "prefs.h"
 #include "prefs_account.h"
+#include "prefs_customheader.h"
 #include "account.h"
 #include "mainwindow.h"
 #include "manage_window.h"
 #include "account.h"
 #include "mainwindow.h"
 #include "manage_window.h"
@@ -44,7 +45,6 @@
 #include "gtkutils.h"
 #include "utils.h"
 #include "alertpanel.h"
 #include "gtkutils.h"
 #include "utils.h"
 #include "alertpanel.h"
-#include "prefs_headers.h"
 
 static gboolean cancelled;
 
 
 static gboolean cancelled;
 
@@ -315,6 +315,8 @@ static void prefs_account_privacy_create    (void);
 #endif /* USE_GPGME */
 static void prefs_account_advanced_create      (void);
 
 #endif /* USE_GPGME */
 static void prefs_account_advanced_create      (void);
 
+static void prefs_account_edit_custom_header   (void);
+
 static gint prefs_account_deleted              (GtkWidget      *widget,
                                                 GdkEventAny    *event,
                                                 gpointer        data);
 static gint prefs_account_deleted              (GtkWidget      *widget,
                                                 GdkEventAny    *event,
                                                 gpointer        data);
@@ -325,7 +327,6 @@ static void prefs_account_ok                        (void);
 static gint prefs_account_apply                        (void);
 static void prefs_account_cancel               (void);
 
 static gint prefs_account_apply                        (void);
 static void prefs_account_cancel               (void);
 
-static void prefs_account_customhdr_edit       (void);
 
 #define VSPACING               12
 #define VSPACING_NARROW                4
 
 #define VSPACING               12
 #define VSPACING_NARROW                4
@@ -945,8 +946,6 @@ static void prefs_account_send_create(void)
        gtk_widget_show (hbox);
        gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0);
 
        gtk_widget_show (hbox);
        gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0);
 
-       /* gtk_widget_set_sensitive(hbox, FALSE); */
-
        PACK_CHECK_BUTTON (hbox, customhdr_chkbtn,
                           _("Add user-defined header"));
 
        PACK_CHECK_BUTTON (hbox, customhdr_chkbtn,
                           _("Add user-defined header"));
 
@@ -954,6 +953,9 @@ static void prefs_account_send_create(void)
        gtk_widget_show (customhdr_edit_btn);
        gtk_box_pack_start (GTK_BOX (hbox), customhdr_edit_btn,
                            FALSE, FALSE, 0);
        gtk_widget_show (customhdr_edit_btn);
        gtk_box_pack_start (GTK_BOX (hbox), customhdr_edit_btn,
                            FALSE, FALSE, 0);
+       gtk_signal_connect (GTK_OBJECT (customhdr_edit_btn), "clicked",
+                           GTK_SIGNAL_FUNC (prefs_account_edit_custom_header),
+                           NULL);
 
        SET_TOGGLE_SENSITIVITY (customhdr_chkbtn, customhdr_edit_btn);
 
 
        SET_TOGGLE_SENSITIVITY (customhdr_chkbtn, customhdr_edit_btn);
 
@@ -1018,10 +1020,6 @@ static void prefs_account_send_create(void)
                _("Authenticate with POP3 before sending"));
        gtk_widget_set_sensitive(pop_bfr_smtp_chkbtn, FALSE);
 
                _("Authenticate with POP3 before sending"));
        gtk_widget_set_sensitive(pop_bfr_smtp_chkbtn, FALSE);
 
-       gtk_signal_connect(GTK_OBJECT(customhdr_edit_btn), "clicked",
-                          GTK_SIGNAL_FUNC(prefs_account_customhdr_edit),
-                          NULL);
-
        send.date_chkbtn      = date_chkbtn;
        send.msgid_chkbtn     = msgid_chkbtn;
        send.customhdr_chkbtn = customhdr_chkbtn;
        send.date_chkbtn      = date_chkbtn;
        send.msgid_chkbtn     = msgid_chkbtn;
        send.customhdr_chkbtn = customhdr_chkbtn;
@@ -1291,7 +1289,7 @@ static void prefs_account_cancel(void)
        gtk_main_quit();
 }
 
        gtk_main_quit();
 }
 
-static void prefs_account_customhdr_edit(void)
+static void prefs_account_edit_custom_header(void)
 {
        prefs_headers_open(&tmp_ac_prefs);
 }
 {
        prefs_headers_open(&tmp_ac_prefs);
 }
index cae6f8dbb00d4e5548869477788cd6aef22c15fd..f6b44fa30a86c8e5125c61e6d792ab75dbf3c44a 100644 (file)
@@ -37,7 +37,6 @@ typedef enum {
        A_IMAP4,
        A_NNTP,
        A_LOCAL,
        A_IMAP4,
        A_NNTP,
        A_LOCAL,
-       //      A_LOCAL_CMD
 } RecvProtocol;
 
 #if USE_GPGME
 } RecvProtocol;
 
 #if USE_GPGME
similarity index 87%
rename from src/prefs_headers.c
rename to src/prefs_customheader.c
index aa4d42f619737db8e63b38d1455a0fb716515939..fcea198db72b35730429d0b104163d12c2b91175 100644 (file)
 #include "intl.h"
 #include "main.h"
 #include "prefs.h"
 #include "intl.h"
 #include "main.h"
 #include "prefs.h"
-#include "prefs_headers.h"
+#include "prefs_customheader.h"
 #include "prefs_common.h"
 #include "prefs_account.h"
 #include "mainwindow.h"
 #include "foldersel.h"
 #include "manage_window.h"
 #include "customheader.h"
 #include "prefs_common.h"
 #include "prefs_account.h"
 #include "mainwindow.h"
 #include "foldersel.h"
 #include "manage_window.h"
 #include "customheader.h"
+#include "folder.h"
 #include "utils.h"
 #include "gtkutils.h"
 #include "alertpanel.h"
 #include "utils.h"
 #include "gtkutils.h"
 #include "alertpanel.h"
-#include "folder.h"
 
 static struct Headers {
        GtkWidget *window;
 
 
 static struct Headers {
        GtkWidget *window;
 
-       /*
-       GtkWidget *close_btn;
-       */
        GtkWidget *ok_btn;
        GtkWidget *cancel_btn;
 
        GtkWidget *ok_btn;
        GtkWidget *cancel_btn;
 
@@ -61,34 +58,26 @@ static struct Headers {
        GtkWidget *headers_clist;
 } headers;
 
        GtkWidget *headers_clist;
 } headers;
 
-/*
-   parameter name, default value, pointer to the prefs variable, data type,
-   pointer to the widget pointer,
-   pointer to the function for data setting,
-   pointer to the function for widget setting
- */
-
 #define VSPACING               12
 #define VSPACING_NARROW                4
 #define DEFAULT_ENTRY_WIDTH    80
 #define PREFSBUFSIZE           1024
 
 /* widget creating functions */
 #define VSPACING               12
 #define VSPACING_NARROW                4
 #define DEFAULT_ENTRY_WIDTH    80
 #define PREFSBUFSIZE           1024
 
 /* widget creating functions */
-static void prefs_headers_create               (void);
+static void prefs_headers_create       (void);
 
 
-static void prefs_headers_set_dialog   (PrefsAccount * ac);
-static void prefs_headers_set_list     (PrefsAccount * ac);
-static gint prefs_headers_clist_set_row        (PrefsAccount * ac,
-                                        gint    row);
+static void prefs_headers_set_dialog   (PrefsAccount *ac);
+static void prefs_headers_set_list     (PrefsAccount *ac);
+static gint prefs_headers_clist_set_row        (PrefsAccount *ac,
+                                        gint          row);
 
 /* callback functions */
 
 /* callback functions */
-static void prefs_headers_select_dest_cb       (void);
 static void prefs_headers_register_cb  (void);
 static void prefs_headers_substitute_cb        (void);
 static void prefs_headers_delete_cb    (void);
 static void prefs_headers_up           (void);
 static void prefs_headers_down         (void);
 static void prefs_headers_register_cb  (void);
 static void prefs_headers_substitute_cb        (void);
 static void prefs_headers_delete_cb    (void);
 static void prefs_headers_up           (void);
 static void prefs_headers_down         (void);
-static void prefs_headers_select               (GtkCList       *clist,
+static void prefs_headers_select       (GtkCList       *clist,
                                         gint            row,
                                         gint            column,
                                         GdkEvent       *event);
                                         gint            row,
                                         gint            column,
                                         GdkEvent       *event);
@@ -96,26 +85,21 @@ static void prefs_headers_select            (GtkCList       *clist,
 static void prefs_headers_key_pressed  (GtkWidget      *widget,
                                         GdkEventKey    *event,
                                         gpointer        data);
 static void prefs_headers_key_pressed  (GtkWidget      *widget,
                                         GdkEventKey    *event,
                                         gpointer        data);
-/*
-static void prefs_headers_close                (GtkButton      *button);
-*/
 static void prefs_headers_ok           (GtkButton      *button);
 static void prefs_headers_cancel       (GtkButton      *button);
 static void prefs_headers_ok           (GtkButton      *button);
 static void prefs_headers_cancel       (GtkButton      *button);
-static gint prefs_headers_deleted(GtkWidget *widget, GdkEventAny *event,
-                                 gpointer data);
+static gint prefs_headers_deleted      (GtkWidget      *widget,
+                                        GdkEventAny    *event,
+                                        gpointer        data);
 
 
-static PrefsAccount * cur_ac = NULL;
+static PrefsAccount *cur_ac = NULL;
 
 
-void prefs_headers_open(PrefsAccount * ac)
+void prefs_headers_open(PrefsAccount *ac)
 {
        if (!headers.window) {
                prefs_headers_create();
        }
 
        manage_window_set_transient(GTK_WINDOW(headers.window));
 {
        if (!headers.window) {
                prefs_headers_create();
        }
 
        manage_window_set_transient(GTK_WINDOW(headers.window));
-       /*
-       gtk_widget_grab_focus(headers.close_btn);
-       */
        gtk_widget_grab_focus(headers.ok_btn);
 
        prefs_headers_set_dialog(ac);
        gtk_widget_grab_focus(headers.ok_btn);
 
        prefs_headers_set_dialog(ac);
@@ -130,7 +114,6 @@ static void prefs_headers_create(void)
        GtkWidget *window;
        GtkWidget *vbox;
 
        GtkWidget *window;
        GtkWidget *vbox;
 
-       /*      GtkWidget *close_btn; */
        GtkWidget *ok_btn;
        GtkWidget *cancel_btn;
 
        GtkWidget *ok_btn;
        GtkWidget *cancel_btn;
 
@@ -175,15 +158,8 @@ static void prefs_headers_create(void)
 
        gtkut_button_set_create(&confirm_area, &ok_btn, _("OK"),
                                &cancel_btn, _("Cancel"), NULL, NULL);
 
        gtkut_button_set_create(&confirm_area, &ok_btn, _("OK"),
                                &cancel_btn, _("Cancel"), NULL, NULL);
-       /*
-       gtkut_button_set_create (&confirm_area, &close_btn, _("Close"),
-                                NULL, NULL, NULL, NULL);
-       */
        gtk_widget_show (confirm_area);
        gtk_box_pack_end (GTK_BOX(vbox), confirm_area, FALSE, FALSE, 0);
        gtk_widget_show (confirm_area);
        gtk_box_pack_end (GTK_BOX(vbox), confirm_area, FALSE, FALSE, 0);
-       /*
-       gtk_widget_grab_default (close_btn);
-       */
        gtk_widget_grab_default (ok_btn);
 
        gtk_window_set_title (GTK_WINDOW(window),
        gtk_widget_grab_default (ok_btn);
 
        gtk_window_set_title (GTK_WINDOW(window),
@@ -321,21 +297,20 @@ static void prefs_headers_create(void)
        gtk_signal_connect (GTK_OBJECT (down_btn), "clicked",
                            GTK_SIGNAL_FUNC (prefs_headers_down), NULL);
 
        gtk_signal_connect (GTK_OBJECT (down_btn), "clicked",
                            GTK_SIGNAL_FUNC (prefs_headers_down), NULL);
 
-
        gtk_widget_show_all(window);
 
        gtk_widget_show_all(window);
 
-       headers.window    = window;
-       /*      headers.close_btn = close_btn; */
-       headers.ok_btn = ok_btn;
+       headers.window     = window;
+       headers.ok_btn     = ok_btn;
        headers.cancel_btn = cancel_btn;
 
        headers.hdr_combo  = hdr_combo;
        headers.hdr_entry  = GTK_COMBO (hdr_combo)->entry;
        headers.key_entry  = key_entry;
        headers.cancel_btn = cancel_btn;
 
        headers.hdr_combo  = hdr_combo;
        headers.hdr_entry  = GTK_COMBO (hdr_combo)->entry;
        headers.key_entry  = key_entry;
+
        headers.headers_clist   = headers_clist;
 }
 
        headers.headers_clist   = headers_clist;
 }
 
-void prefs_headers_read_config(PrefsAccount * ac)
+void prefs_headers_read_config(PrefsAccount *ac)
 {
        gchar *rcpath;
        FILE *fp;
 {
        gchar *rcpath;
        FILE *fp;
@@ -344,7 +319,8 @@ void prefs_headers_read_config(PrefsAccount * ac)
 
        debug_print(_("Reading headers configuration...\n"));
 
 
        debug_print(_("Reading headers configuration...\n"));
 
-       rcpath = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, HEADERS_RC, NULL);
+       rcpath = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S,
+                            CUSTOM_HEADER_RC, NULL);
        if ((fp = fopen(rcpath, "r")) == NULL) {
                if (ENOENT != errno) FILE_OP_ERROR(rcpath, "fopen");
                g_free(rcpath);
        if ((fp = fopen(rcpath, "r")) == NULL) {
                if (ENOENT != errno) FILE_OP_ERROR(rcpath, "fopen");
                g_free(rcpath);
@@ -353,29 +329,29 @@ void prefs_headers_read_config(PrefsAccount * ac)
        }
        g_free(rcpath);
 
        }
        g_free(rcpath);
 
-       /* remove all previous headers list */
-       while (ac->customhdr_list != NULL) {
-               ch = (CustomHeader *)ac->customhdr_list->data;
-               custom_header_free(ch);
-               ac->customhdr_list = g_slist_remove(ac->customhdr_list, ch);
-       }
-       while (fgets(buf, sizeof(buf), fp) != NULL) {
-               g_strchomp(buf);
-               ch = custom_header_read_str(buf);
-               if (ch) {
-                       if (ch->account_id == ac->account_id)
+       /* remove all previous headers list */
+       while (ac->customhdr_list != NULL) {
+               ch = (CustomHeader *)ac->customhdr_list->data;
+               custom_header_free(ch);
+               ac->customhdr_list = g_slist_remove(ac->customhdr_list, ch);
+       }
+
+       while (fgets(buf, sizeof(buf), fp) != NULL) {
+               g_strchomp(buf);
+               ch = custom_header_read_str(buf);
+               if (ch) {
+                       if (ch->account_id == ac->account_id) {
                                ac->customhdr_list =
                                        g_slist_append(ac->customhdr_list, ch);
                                ac->customhdr_list =
                                        g_slist_append(ac->customhdr_list, ch);
-                       else
+                       else
                                custom_header_free(ch);
                                custom_header_free(ch);
-               }
-       }
-       fclose(fp);
+               }
+       }
+
+       fclose(fp);
 }
 
 }
 
-void prefs_headers_write_config(PrefsAccount * ac)
+void prefs_headers_write_config(PrefsAccount *ac)
 {
        gchar *rcpath;
        PrefFile *pfile;
 {
        gchar *rcpath;
        PrefFile *pfile;
@@ -388,12 +364,12 @@ void prefs_headers_write_config(PrefsAccount * ac)
 
        debug_print(_("Writing headers configuration...\n"));
 
 
        debug_print(_("Writing headers configuration...\n"));
 
-       rcpath = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, HEADERS_RC, NULL);
+       rcpath = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S,
+                            CUSTOM_HEADER_RC, NULL);
 
        if ((fp = fopen(rcpath, "r")) == NULL) {
                if (ENOENT != errno) FILE_OP_ERROR(rcpath, "fopen");
 
        if ((fp = fopen(rcpath, "r")) == NULL) {
                if (ENOENT != errno) FILE_OP_ERROR(rcpath, "fopen");
-       }
-       else {
+       } else {
                all_hdrs = NULL;
 
                while (fgets(buf, sizeof(buf), fp) != NULL) {
                all_hdrs = NULL;
 
                while (fgets(buf, sizeof(buf), fp) != NULL) {
@@ -463,7 +439,7 @@ void prefs_headers_write_config(PrefsAccount * ac)
        }
 }
 
        }
 }
 
-static void prefs_headers_set_dialog(PrefsAccount * ac)
+static void prefs_headers_set_dialog(PrefsAccount *ac)
 {
        GtkCList *clist = GTK_CLIST(headers.headers_clist);
        GSList *cur;
 {
        GtkCList *clist = GTK_CLIST(headers.headers_clist);
        GSList *cur;
@@ -490,7 +466,7 @@ static void prefs_headers_set_dialog(PrefsAccount * ac)
        gtk_clist_thaw(clist);
 }
 
        gtk_clist_thaw(clist);
 }
 
-static void prefs_headers_set_list(PrefsAccount * ac)
+static void prefs_headers_set_list(PrefsAccount *ac)
 {
        gint row = 1;
        CustomHeader *ch;
 {
        gint row = 1;
        CustomHeader *ch;
@@ -506,10 +482,7 @@ static void prefs_headers_set_list(PrefsAccount * ac)
        }
 }
 
        }
 }
 
-#define GET_ENTRY(entry) \
-       entry_text = gtk_entry_get_text(GTK_ENTRY(entry))
-
-static gint prefs_headers_clist_set_row(PrefsAccount * ac, gint row)
+static gint prefs_headers_clist_set_row(PrefsAccount *ac, gint row)
 {
        GtkCList *clist = GTK_CLIST(headers.headers_clist);
        CustomHeader *ch;
 {
        GtkCList *clist = GTK_CLIST(headers.headers_clist);
        CustomHeader *ch;
@@ -518,7 +491,7 @@ static gint prefs_headers_clist_set_row(PrefsAccount * ac, gint row)
 
        g_return_val_if_fail(row != 0, -1);
 
 
        g_return_val_if_fail(row != 0, -1);
 
-       GET_ENTRY(headers.hdr_entry);
+       entry_text = gtk_entry_get_text(GTK_ENTRY(headers.hdr_entry));
        if (entry_text[0] == '\0') {
                alertpanel_error(_("Header name is not set."));
                return -1;
        if (entry_text[0] == '\0') {
                alertpanel_error(_("Header name is not set."));
                return -1;
@@ -530,7 +503,7 @@ static gint prefs_headers_clist_set_row(PrefsAccount * ac, gint row)
 
        ch->name = g_strdup(entry_text);
 
 
        ch->name = g_strdup(entry_text);
 
-       GET_ENTRY(headers.key_entry);
+       entry_text = gtk_entry_get_text(GTK_ENTRY(headers.key_entry));
        if (entry_text[0] != '\0')
                ch->value = g_strdup(entry_text);
 
        if (entry_text[0] != '\0')
                ch->value = g_strdup(entry_text);
 
@@ -644,6 +617,8 @@ static void prefs_headers_select(GtkCList *clist, gint row, gint column,
        ENTRY_SET_TEXT(headers.key_entry, ch->value);
 }
 
        ENTRY_SET_TEXT(headers.key_entry, ch->value);
 }
 
+#undef ENTRY_SET_TEXT
+
 static void prefs_headers_key_pressed(GtkWidget *widget, GdkEventKey *event,
                                     gpointer data)
 {
 static void prefs_headers_key_pressed(GtkWidget *widget, GdkEventKey *event,
                                     gpointer data)
 {
@@ -659,9 +634,6 @@ static void prefs_headers_ok(GtkButton *button)
 
 static void prefs_headers_cancel(GtkButton *button)
 {
 
 static void prefs_headers_cancel(GtkButton *button)
 {
-       /*
-       prefs_headers_write_config(cur_ac); 
-       */
        prefs_headers_read_config(cur_ac); 
        gtk_widget_hide(headers.window);
 }
        prefs_headers_read_config(cur_ac); 
        gtk_widget_hide(headers.window);
 }
similarity index 76%
rename from src/prefs_headers.h
rename to src/prefs_customheader.h
index 89a82c3b085fa5ddf16dab74bfa21c5674f738d8..e81d7d9f38795cb5d873485ad1784361214a7e72 100644 (file)
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
-#ifndef __PREFS_HEADERS_H__
-#define __PREFS_HEADERS_H__
+#ifndef __PREFS_CUSTOMHEADER_H__
+#define __PREFS_CUSTOMHEADER_H__
 
 
-void prefs_headers_read_config (PrefsAccount * ac);
-void prefs_headers_write_config        (PrefsAccount * ac);
-void prefs_headers_open         (PrefsAccount * ac);
+void prefs_headers_read_config (PrefsAccount *ac);
+void prefs_headers_write_config        (PrefsAccount *ac);
+void prefs_headers_open                (PrefsAccount *ac);
 
 
-#endif /* __PREFS_HEADERS_H__ */
+#endif /* __PREFS_CUSTOMHEADER_H__ */