sync with sylpheed 0.6.5cvs20
authorPaul Mangan <paul@claws-mail.org>
Mon, 3 Dec 2001 10:06:10 +0000 (10:06 +0000)
committerPaul Mangan <paul@claws-mail.org>
Mon, 3 Dec 2001 10:06:10 +0000 (10:06 +0000)
ChangeLog
ChangeLog.claws
ChangeLog.jp
configure.in
src/compose.c
src/html.c
src/prefs_common.c
src/prefs_template.c
src/quote_fmt_lex.l
src/quote_fmt_parse.y

index d138938..d539299 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2001-12-03
+
+       * src/compose.c: fixed a bug that empty body was refused.
+       * src/prefs_template.c: fixed a bug that didn't set To: entry
+         correctly. Display error dialog if format is illegal.
+       * src/prefs_common.c
+         src/quote_fmt_lex.l
+         src/quote_fmt_parse.y: changed parenthesis "( )" to curly braces
+         "{ }" to prevent confusion on using parenthesis.
+       * src/html.c: html_get_parenthesis(): ignore CSS / script stuff.
+
 2001-11-29
 
        * src/prefs_template.c: added colon to the header labels.
index bbce7cc..776a56f 100644 (file)
@@ -1,3 +1,8 @@
+2001-12-03 [paul]      0.6.5claws47
+
+       * sync with sylpheed 0.6.5cvs20
+               see ChangeLog entry 2001-12-03
+
 2001-12-01 [paul]
 
        * more sync with sylpheed 0.6.5cvs19
index 8315871..92fed63 100644 (file)
@@ -1,3 +1,14 @@
+2001-12-03
+
+       * src/compose.c: ¶õ¤ÎËÜʸ¤¬µñÈݤµ¤ì¤ë¥Ð¥°¤ò½¤Àµ¡£
+       * src/prefs_template.c: To: ¥¨¥ó¥È¥ê¤òÀµ¤·¤¯¥»¥Ã¥È¤·¤Ê¤¤¥Ð¥°¤ò½¤Àµ¡£
+         ¥Õ¥©¡¼¥Þ¥Ã¥È¤¬ÉÔÀµ¤Ê¤é¥¨¥é¡¼¥À¥¤¥¢¥í¥°¤òɽ¼¨¡£
+       * src/prefs_common.c
+         src/quote_fmt_lex.l
+         src/quote_fmt_parse.y: ´Ý³ç¸Ì¤ò»È¤Ã¤¿¤È¤­¤Îº®Íð¤òÈò¤±¤ë¤¿¤á¡¢
+         ´Ý³ç¸Ì¡Ö( )¡×¤òÃæ³ç¸Ì¡Ö{ }¡×¤ËÊѹ¹¡£
+       * src/html.c: html_get_parenthesis(): CSS / script ¤ò̵»ë¡£
+
 2001-11-29
 
        * src/prefs_template.c: ¥Ø¥Ã¥À¤Î¥é¥Ù¥ë¤Ë¥³¥í¥ó¤òÄɲá£
index 2bfcb69..f02ef39 100644 (file)
@@ -8,7 +8,7 @@ MINOR_VERSION=6
 MICRO_VERSION=5
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws46
+EXTRA_VERSION=claws47
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl
index 7a220bb..76cfb86 100644 (file)
@@ -1512,15 +1512,18 @@ static gchar *compose_quote_fmt(Compose *compose, MsgInfo *msginfo,
                        Xstrdup_a(quote_str, buf, return NULL)
        }
 
-       quote_fmt_init(msginfo, quote_str);
-       quote_fmt_scan_string(fmt);
-       quote_fmt_parse();
+       if (fmt && *fmt != '\0') {
+               quote_fmt_init(msginfo, quote_str);
+               quote_fmt_scan_string(fmt);
+               quote_fmt_parse();
 
-       buf = quote_fmt_get_buffer();
-       if (buf == NULL) {
-               alertpanel_error(_("Message reply/forward format error."));
-               return NULL;
-       }
+               buf = quote_fmt_get_buffer();
+               if (buf == NULL) {
+                       alertpanel_error(_("Message reply/forward format error."));
+                       return NULL;
+               }
+       } else
+               buf = "";
 
        gtk_stext_freeze(text);
        gtk_stext_set_point(text, 0);
index b02ed9f..fec2ea1 100644 (file)
@@ -674,7 +674,7 @@ static void html_get_parenthesis(HTMLParser *parser, gchar *buf, gint len)
        buf[0] = '\0';
        g_return_if_fail(*parser->bufp == '<');
 
-       /* ignore comments */
+       /* ignore comment / CSS / script stuff */
        if (!strncmp(parser->bufp, "<!--", 4)) {
                parser->bufp += 4;
                while ((p = strstr(parser->bufp, "-->")) == NULL)
@@ -682,38 +682,18 @@ static void html_get_parenthesis(HTMLParser *parser, gchar *buf, gint len)
                parser->bufp = p + 3;
                return;
        }
-       /* because html is not strict regarding case and double-quoting of
-          tags we have to check for both */
-       /* ignore css stuff */
-       if (!g_strncasecmp(parser->bufp, "<STYLE type=text/css>", 21)) {
-               parser->bufp += 21;
-               while ((p = strcasestr(parser->bufp, "</STYLE>")) == NULL)
+       if (!g_strncasecmp(parser->bufp, "<style", 6)) {
+               parser->bufp += 6;
+               while ((p = strcasestr(parser->bufp, "</style>")) == NULL)
                        if (html_read_line(parser) == HTML_EOF) return;
                parser->bufp = p + 8;
                return;
        }
-       /* ignore css stuff with double quotes*/
-       if (!g_strncasecmp(parser->bufp, "<STYLE type=\"text/css\">", 23)) {
-               parser->bufp += 23;
-               while ((p = strcasestr(parser->bufp, "</STYLE>")) == NULL)
+       if (!g_strncasecmp(parser->bufp, "<script", 7)) {
+               parser->bufp += 7;
+               while ((p = strcasestr(parser->bufp, "</script>")) == NULL)
                        if (html_read_line(parser) == HTML_EOF) return;
-               parser->bufp = p + 8;
-               return;
-       }
-       /* ignore javascipt stuff */
-       if (!g_strncasecmp(parser->bufp, "<SCRIPT language=javascript>", 28)) {
-               parser->bufp += 28;
-               while ((p = strcasestr(parser->bufp, "</SCRIPT>")) == NULL)
-                       if (html_read_line(parser) == HTML_EOF) return;
-               parser->bufp = p + 8;
-               return;
-       }
-       /* ignore javascipt stuff with double-quotes */
-       if (!g_strncasecmp(parser->bufp, "<SCRIPT language=\"javascript\">", 30)) {
-               parser->bufp += 30;
-               while ((p = strcasestr(parser->bufp, "</SCRIPT>")) == NULL)
-                       if (html_read_line(parser) == HTML_EOF) return;
-               parser->bufp = p + 8;
+               parser->bufp = p + 9;
                return;
        }
 
index 93678b5..63df944 100644 (file)
@@ -377,13 +377,13 @@ static PrefParam param[] = {
         &prefs_common.quotefmt, P_STRING, &quote.text_quotefmt,
         prefs_set_data_from_text, prefs_set_text},
 
-       {"fw_quote_mark", "> ", &prefs_common.fw_quotemark, P_STRING,
+       {"forward_quote_mark", "> ", &prefs_common.fw_quotemark, P_STRING,
         &quote.entry_fw_quotemark,
         prefs_set_data_from_entry, prefs_set_entry},
-       {"fw_quote_format",
+       {"forward_quote_format",
         "\\n\\nBegin forwarded message:\\n\\n"
-        "?d(Date: %d\\n)?f(From: %f\\n)?t(To: %t\\n)?c(Cc: %c\\n)"
-        "?n(Newsgroups: %n\\n)?s(Subject: %s\\n)\\n\\n%M",
+        "?d{Date: %d\\n}?f{From: %f\\n}?t{To: %t\\n}?c{Cc: %c\\n}"
+        "?n{Newsgroups: %n\\n}?s{Subject: %s\\n}\\n\\n%M",
         &prefs_common.fw_quotefmt, P_STRING, &quote.text_fw_quotefmt,
         prefs_set_data_from_text, prefs_set_text},
 
@@ -3140,7 +3140,7 @@ static void prefs_quote_description_create(void)
        PACK_LABEL();
 
        label = gtk_label_new
-               ("?x(expr)");   /* condition */
+               ("?x{expr}");   /* condition */
        PACK_LABEL();
 
        label = gtk_label_new
@@ -3154,8 +3154,8 @@ static void prefs_quote_description_create(void)
        label = gtk_label_new
                ("\\\\\n"       /* literal backslash */
                 "\\?\n"        /* literal question mark */
-                "\\(\n"        /* literal opening parenthesis */
-                "\\)");        /* literal closing parenthesis */
+                "\\{\n"        /* literal opening curly brace */
+                "\\}");        /* literal closing curly brace */
        PACK_LABEL();
 
        vbox2 = gtk_vbox_new(FALSE, 8);
@@ -3190,8 +3190,8 @@ static void prefs_quote_description_create(void)
        label = gtk_label_new
                (_("Literal backslash\n"
                   "Literal question mark\n"
-                  "Literal opening parenthesis\n"
-                  "Literal closing parenthesis"));
+                  "Literal opening curly brace\n"
+                  "Literal closing curly brace"));
        PACK_LABEL();
 
 #undef PACK_LABEL
index b4a1d74..6250aae 100644 (file)
@@ -23,6 +23,7 @@
 #include <glib.h>
 #include <gtk/gtk.h>
 #include <gdk/gdkkeysyms.h>
+#include <string.h>
 #include <dirent.h>
 #include <sys/stat.h>
 
@@ -36,6 +37,7 @@
 #include "manage_window.h"
 #include "prefs_common.h"
 #include "compose.h"
+#include "quote_fmt.h"
 
 static struct Templates {
        GtkWidget *window;
@@ -83,20 +85,18 @@ void prefs_template_open(void)
        gtk_widget_show(templates.window);
 }
 
-#define ADD_ENTRY(vbox, entry, str) \
+#define ADD_ENTRY(entry, str, row) \
 { \
-       hbox1 = gtk_hbox_new(FALSE, 8); \
-       gtk_widget_show(hbox1); \
-       gtk_box_pack_start(GTK_BOX(vbox), hbox1, FALSE, FALSE, 0); \
-       gtk_container_set_border_width(GTK_CONTAINER(hbox1), 2); \
- \
        label1 = gtk_label_new(str); \
        gtk_widget_show(label1); \
-       gtk_box_pack_start(GTK_BOX(hbox1), label1, FALSE, FALSE, 0); \
+       gtk_table_attach(GTK_TABLE(table), label1, 0, 1, row, (row + 1), \
+                        GTK_FILL, 0, 0, 0); \
+       gtk_misc_set_alignment(GTK_MISC(label1), 1, 0.5); \
  \
        entry = gtk_entry_new(); \
        gtk_widget_show(entry); \
-       gtk_box_pack_start(GTK_BOX(hbox1), entry, TRUE, TRUE, 0); \
+       gtk_table_attach(GTK_TABLE(table), entry, 1, 2, row, (row + 1), \
+                        GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0, 0); \
 }
 
 static void prefs_template_window_create(void)
@@ -108,9 +108,9 @@ static void prefs_template_window_create(void)
        GtkWidget       *hbox1;
        GtkWidget         *label1;
        GtkWidget         *entry_name;
-       GtkWidget         *vbox_hdr;
-       GtkWidget           *entry_to;
-       GtkWidget           *entry_subject;
+       GtkWidget       *table;
+       GtkWidget         *entry_to;
+       GtkWidget         *entry_subject;
        GtkWidget       *scroll2;
        GtkWidget         *text_value;
        GtkWidget     *vbox2;
@@ -147,15 +147,28 @@ static void prefs_template_window_create(void)
        gtk_container_set_border_width(GTK_CONTAINER(vbox1), 8);
        gtk_paned_pack1(GTK_PANED(vpaned), vbox1, FALSE, FALSE);
 
-       ADD_ENTRY(vbox1, entry_name, _("Template name"));
+       hbox1 = gtk_hbox_new(FALSE, 8);
+       gtk_widget_show(hbox1);
+       gtk_box_pack_start(GTK_BOX(vbox1), hbox1, FALSE, FALSE, 0);
+       gtk_container_set_border_width(GTK_CONTAINER(hbox1), 2);
+
+       label1 = gtk_label_new(_("Template name"));
+       gtk_widget_show(label1);
+       gtk_box_pack_start(GTK_BOX(hbox1), label1, FALSE, FALSE, 0);
+
+       entry_name = gtk_entry_new();
+       gtk_widget_show(entry_name);
+       gtk_box_pack_start(GTK_BOX(hbox1), entry_name, TRUE, TRUE, 0);
 
-       /* vbox to handle headers */
-       vbox_hdr = gtk_vbox_new(FALSE, 2);
-       gtk_widget_show(vbox_hdr);
-       gtk_box_pack_start(GTK_BOX(vbox1), vbox_hdr, FALSE, FALSE, 0);
+       /* table for headers */
+       table = gtk_table_new(2, 2, FALSE);
+       gtk_widget_show(table);
+       gtk_box_pack_start(GTK_BOX(vbox1), table, FALSE, FALSE, 0);
+       gtk_table_set_row_spacings(GTK_TABLE(table), 4);
+       gtk_table_set_col_spacings(GTK_TABLE(table), 4);
 
-       ADD_ENTRY(vbox_hdr, entry_to, _("To:"));
-       ADD_ENTRY(vbox_hdr, entry_subject, _("Subject:"));
+       ADD_ENTRY(entry_to, _("To:"), 0);
+       ADD_ENTRY(entry_subject, _("Subject:"), 1);
 
 #undef ADD_ENTRY
 
@@ -359,12 +372,15 @@ static void prefs_template_select_cb(GtkCList *clist, gint row, gint column,
 
        tmpl_def.name = _("Template");
        tmpl_def.subject = "";
+       tmpl_def.to = "";
        tmpl_def.value = "";
 
        if (!(tmpl = gtk_clist_get_row_data(clist, row)))
                tmpl = &tmpl_def;
 
        gtk_entry_set_text(GTK_ENTRY(templates.entry_name), tmpl->name);
+       gtk_entry_set_text(GTK_ENTRY(templates.entry_to),
+                          tmpl->to ? tmpl->to : "");
        gtk_entry_set_text(GTK_ENTRY(templates.entry_subject),
                           tmpl->subject ? tmpl->subject : "");
        
@@ -406,14 +422,31 @@ static gint prefs_template_clist_set_row(gint row)
 
        g_return_val_if_fail(row != 0, -1);
 
+       value = gtk_editable_get_chars(GTK_EDITABLE(templates.text_value),
+                                      0, -1);
+
+       if (value && *value != '\0') {
+               gchar *parsed_buf;
+               MsgInfo dummyinfo;
+
+               memset(&dummyinfo, 0, sizeof(MsgInfo));
+               quote_fmt_init(&dummyinfo, NULL);
+               quote_fmt_scan_string(value);
+               quote_fmt_parse();
+               parsed_buf = quote_fmt_get_buffer();
+               if (!parsed_buf) {
+                       alertpanel_error(_("Template format error."));
+                       g_free(value);
+                       return -1;
+               }
+       }
+
        name = gtk_editable_get_chars(GTK_EDITABLE(templates.entry_name),
                                      0, -1);
        subject = gtk_editable_get_chars(GTK_EDITABLE(templates.entry_subject),
                                      0, -1);
        to = gtk_editable_get_chars(GTK_EDITABLE(templates.entry_to),
                                    0, -1);
-       value = gtk_editable_get_chars(GTK_EDITABLE(templates.text_value),
-                                      0, -1);
 
        tmpl = g_new(Template, 1);
        tmpl->name = name;
index 63b8b46..7f904c1 100644 (file)
@@ -28,8 +28,8 @@
 "\\t"|"\t" /* tab */ return SHOW_TAB;
 "\\n"|"\n" /* return */ return SHOW_EOL;
 "\\?" /* ? */ return SHOW_QUESTION_MARK;
-"\\(" return SHOW_OPARENT;
-"\\)" return SHOW_CPARENT;
+"\\{" return SHOW_OPARENT;
+"\\}" return SHOW_CPARENT;
 "?d" /* query date */ return QUERY_DATE;
 "?f" /* query from */ return QUERY_FROM;
 "?N"|"?F"|"?I" /* query from name */ return QUERY_FULLNAME;
@@ -39,8 +39,8 @@
 "?n" /* query newsgroups */ return QUERY_NEWSGROUPS;
 "?i" /* query message-id */ return QUERY_MESSAGEID;
 "?r" /* query references */ return QUERY_REFERENCES;
-"(" return OPARENT;
-")" return CPARENT;
+"{" return OPARENT;
+"}" return CPARENT;
 . { yylval.chr = yytext[0]; return CHARACTER; }
 
 %%
index 55a25ba..42122f9 100644 (file)
@@ -107,7 +107,7 @@ void quote_fmt_init(MsgInfo *info, gchar *my_quote_str)
 
 void quote_fmterror(char *str)
 {
-       g_warning(_("Error %s\n"), str);
+       g_warning(_("Error: %s\n"), str);
        error = 1;
 }
 
@@ -357,11 +357,11 @@ special:
        }
        | SHOW_OPARENT
        {
-               INSERT("(");
+               INSERT("{");
        }
        | SHOW_CPARENT
        {
-               INSERT(")");
+               INSERT("}");
        };
 
 query: