2008-03-06 [wwp] 3.3.1cvs13

* src/folder_item_prefs.c
	* src/prefs_template.c
	* src/prefs_template.h
	* src/quote_fmt.c
	* src/common/template.c
		Complete 3.3.1cvs12, thanks to Colin.
This commit is contained in:
Tristan Chabredier 2008-03-06 13:57:49 +00:00
parent 91f0b5d0d1
commit 011da9d2ed
8 changed files with 54 additions and 22 deletions

View file

@ -1,3 +1,12 @@
2008-03-06 [wwp] 3.3.1cvs13
* src/folder_item_prefs.c
* src/prefs_template.c
* src/prefs_template.h
* src/quote_fmt.c
* src/common/template.c
Complete 3.3.1cvs12, thanks to Colin.
2008-03-06 [wwp] 3.3.1cvs12
* src/compose.c

View file

@ -3247,3 +3247,4 @@
( cvs diff -u -r 1.87.2.55 -r 1.87.2.56 src/folder.h; cvs diff -u -r 1.207.2.197 -r 1.207.2.198 src/folderview.c; cvs diff -u -r 1.395.2.355 -r 1.395.2.356 src/summaryview.c; cvs diff -u -r 1.68.2.42 -r 1.68.2.43 src/summaryview.h; ) > 3.3.1cvs10.patchset
( cvs diff -u -r 1.395.2.356 -r 1.395.2.357 src/summaryview.c; cvs diff -u -r 1.68.2.43 -r 1.68.2.44 src/summaryview.h; ) > 3.3.1cvs11.patchset
( cvs diff -u -r 1.382.2.441 -r 1.382.2.442 src/compose.c; cvs diff -u -r 1.2.2.28 -r 1.2.2.29 src/folder_item_prefs.c; cvs diff -u -r 1.2.2.16 -r 1.2.2.17 src/folder_item_prefs.h; cvs diff -u -r 1.105.2.126 -r 1.105.2.127 src/prefs_account.c; cvs diff -u -r 1.52.2.59 -r 1.52.2.60 src/prefs_folder_item.c; cvs diff -u -r 1.1.2.27 -r 1.1.2.28 src/prefs_quote.c; cvs diff -u -r 1.12.2.58 -r 1.12.2.59 src/prefs_template.c; cvs diff -u -r 1.8.2.29 -r 1.8.2.30 src/quote_fmt.c; cvs diff -u -r 1.5.12.16 -r 1.5.12.17 src/quote_fmt.h; cvs diff -u -r 1.2.4.25 -r 1.2.4.26 src/common/template.c; cvs diff -u -r 1.1.4.9 -r 1.1.4.10 src/common/template.h; ) > 3.3.1cvs12.patchset
( cvs diff -u -r 1.2.2.29 -r 1.2.2.30 src/folder_item_prefs.c; cvs diff -u -r 1.12.2.59 -r 1.12.2.60 src/prefs_template.c; cvs diff -u -r 1.1.16.8 -r 1.1.16.9 src/prefs_template.h; cvs diff -u -r 1.8.2.30 -r 1.8.2.31 src/quote_fmt.c; cvs diff -u -r 1.2.4.26 -r 1.2.4.27 src/common/template.c; ) > 3.3.1cvs13.patchset

View file

@ -11,7 +11,7 @@ MINOR_VERSION=3
MICRO_VERSION=1
INTERFACE_AGE=0
BINARY_AGE=0
EXTRA_VERSION=12
EXTRA_VERSION=13
EXTRA_RELEASE=
EXTRA_GTK2_VERSION=

View file

@ -95,6 +95,7 @@ void template_free(Template *tmpl)
g_free(tmpl->load_filename);
g_free(tmpl->name);
g_free(tmpl->subject);
g_free(tmpl->from);
g_free(tmpl->to);
g_free(tmpl->cc);
g_free(tmpl->bcc);

View file

@ -183,13 +183,15 @@ static FolderItemPrefs *folder_item_prefs_clear(FolderItemPrefs *prefs)
prefs->compose_with_format = FALSE;
prefs->compose_subject_format = NULL;
prefs->compose_body_format = NULL;
prefs->compose_override_from_format = NULL;
prefs->reply_with_format = FALSE;
prefs->reply_quotemark = NULL;
prefs->reply_body_format = NULL;
prefs->reply_override_from_format = NULL;
prefs->forward_with_format = FALSE;
prefs->forward_quotemark = NULL;
prefs->forward_body_format = NULL;
prefs->forward_override_from_format = NULL;
return prefs;
}
@ -208,10 +210,13 @@ void folder_item_prefs_free(FolderItemPrefs * prefs)
g_free(prefs->default_reply_to);
g_free(prefs->compose_subject_format);
g_free(prefs->compose_body_format);
g_free(prefs->compose_override_from_format);
g_free(prefs->reply_quotemark);
g_free(prefs->reply_body_format);
g_free(prefs->reply_override_from_format);
g_free(prefs->forward_quotemark);
g_free(prefs->forward_body_format);
g_free(prefs->forward_override_from_format);
g_free(prefs);
}
@ -265,12 +270,15 @@ void folder_item_prefs_copy_prefs(FolderItem * src, FolderItem * dest)
tmp_prefs.compose_with_format = src->prefs->compose_with_format;
tmp_prefs.compose_subject_format = g_strdup(src->prefs->compose_subject_format);
tmp_prefs.compose_body_format = g_strdup(src->prefs->compose_body_format);
tmp_prefs.compose_override_from_format = g_strdup(src->prefs->compose_override_from_format);
tmp_prefs.reply_with_format = src->prefs->reply_with_format;
tmp_prefs.reply_quotemark = g_strdup(src->prefs->reply_quotemark);
tmp_prefs.reply_body_format = g_strdup(src->prefs->reply_body_format);
tmp_prefs.reply_override_from_format = g_strdup(src->prefs->reply_override_from_format);
tmp_prefs.forward_with_format = src->prefs->forward_with_format;
tmp_prefs.forward_quotemark = g_strdup(src->prefs->forward_quotemark);
tmp_prefs.forward_body_format = g_strdup(src->prefs->forward_body_format);
tmp_prefs.forward_override_from_format = g_strdup(src->prefs->forward_override_from_format);
*dest->prefs = tmp_prefs;
folder_item_prefs_save_config(dest);

View file

@ -615,17 +615,19 @@ static GSList *prefs_template_get_list(void)
return tmpl_list;
}
gboolean prefs_template_string_is_valid(gchar *string, gint *line, gboolean escaped_string)
gboolean prefs_template_string_is_valid(gchar *string, gint *line, gboolean escaped_string, gboolean email)
{
gboolean result = TRUE;
if (string && *string != '\0') {
gchar *parsed_buf;
MsgInfo dummyinfo;
PrefsAccount *account = account_get_default();
memset(&dummyinfo, 0, sizeof(MsgInfo));
#ifdef USE_ASPELL
quote_fmt_init(&dummyinfo, NULL, NULL, TRUE, NULL, escaped_string, NULL);
quote_fmt_init(&dummyinfo, NULL, NULL, TRUE, account, escaped_string, NULL);
#else
quote_fmt_init(&dummyinfo, NULL, NULL, TRUE, NULL, escaped_string);
quote_fmt_init(&dummyinfo, NULL, NULL, TRUE, account, escaped_string);
#endif
quote_fmt_scan_string(string);
quote_fmt_parse();
@ -635,9 +637,19 @@ gboolean prefs_template_string_is_valid(gchar *string, gint *line, gboolean esca
*line = quote_fmt_get_line();
return FALSE;
}
if (email) {
const gchar *start = strrchr(parsed_buf, '<');
const gchar *end = strrchr(parsed_buf, '>');
const gchar *at = strrchr(parsed_buf, '@');
const gchar *space = strrchr(parsed_buf, ' ');
if (!at)
result = FALSE;
if (at && space && (!start || !end || end < start || start < space))
result = FALSE;
}
quote_fmt_reset_vartable();
}
return TRUE;
return result;
}
static gboolean prefs_template_list_view_set_row(gint row)
@ -667,7 +679,7 @@ static gboolean prefs_template_list_view_set_row(gint row)
g_free(value);
value = NULL;
}
if (!prefs_template_string_is_valid(value, &line, FALSE)) {
if (!prefs_template_string_is_valid(value, &line, FALSE, FALSE)) {
alertpanel_error(_("Template body format error at line %d."), line);
g_free(value);
return FALSE;
@ -712,31 +724,31 @@ static gboolean prefs_template_list_view_set_row(gint row)
subject = NULL;
}
if (!prefs_template_string_is_valid(to, NULL, FALSE)) {
if (!prefs_template_string_is_valid(from, NULL, FALSE, TRUE)) {
alertpanel_error(_("Template From format error."));
g_free(from);
g_free(value);
return FALSE;
}
if (!prefs_template_string_is_valid(to, NULL, FALSE)) {
if (!prefs_template_string_is_valid(to, NULL, FALSE, TRUE)) {
alertpanel_error(_("Template To format error."));
g_free(to);
g_free(value);
return FALSE;
}
if (!prefs_template_string_is_valid(cc, NULL, FALSE)) {
if (!prefs_template_string_is_valid(cc, NULL, FALSE, TRUE)) {
alertpanel_error(_("Template Cc format error."));
g_free(cc);
g_free(value);
return FALSE;
}
if (!prefs_template_string_is_valid(bcc, NULL, FALSE)) {
if (!prefs_template_string_is_valid(bcc, NULL, FALSE, TRUE)) {
alertpanel_error(_("Template Bcc format error."));
g_free(bcc);
g_free(value);
return FALSE;
}
if (!prefs_template_string_is_valid(subject, NULL, FALSE)) {
if (!prefs_template_string_is_valid(subject, NULL, FALSE, FALSE)) {
alertpanel_error(_("Template subject format error."));
g_free(subject);
g_free(value);

View file

@ -22,6 +22,7 @@
#define __PREFS_TEMPLATES_H__
void prefs_template_open(void);
gboolean prefs_template_string_is_valid(gchar *string, gint *line, gboolean escaped_string);
gboolean prefs_template_string_is_valid(gchar *string, gint *line,
gboolean escaped_string, gboolean email);
#endif /* __PREFS_TEMPLATES_H__ */

View file

@ -499,13 +499,13 @@ void quotefmt_check_new_msg_formats(gboolean use_format,
if (use_format) {
gint line;
if (override_from_fmt && !prefs_template_string_is_valid(override_from_fmt, NULL, FALSE))
if (override_from_fmt && !prefs_template_string_is_valid(override_from_fmt, NULL, FALSE, TRUE))
alertpanel_error(_("New message From format error."));
if (!prefs_template_string_is_valid(subject_fmt, NULL, FALSE))
if (!prefs_template_string_is_valid(subject_fmt, NULL, FALSE, FALSE))
alertpanel_error(_("New message subject format error."));
if (!prefs_template_string_is_valid(body_fmt, &line, TRUE)) {
if (!prefs_template_string_is_valid(body_fmt, &line, TRUE, FALSE)) {
alertpanel_error(_("New message body format error at line %d."), line);
}
}
@ -519,13 +519,13 @@ void quotefmt_check_reply_formats(gboolean use_format,
if (use_format) {
gint line;
if (!prefs_template_string_is_valid(quotation_mark, NULL, FALSE))
if (!prefs_template_string_is_valid(quotation_mark, NULL, FALSE, FALSE))
alertpanel_error(_("Message reply quotation mark format error."));
if (override_from_fmt && !prefs_template_string_is_valid(override_from_fmt, NULL, FALSE))
if (override_from_fmt && !prefs_template_string_is_valid(override_from_fmt, NULL, FALSE, TRUE))
alertpanel_error(_("Message reply From format error."));
if (!prefs_template_string_is_valid(body_fmt, &line, TRUE)) {
if (!prefs_template_string_is_valid(body_fmt, &line, TRUE, FALSE)) {
alertpanel_error(_("Message reply format error at line %d."), line);
}
}
@ -539,13 +539,13 @@ void quotefmt_check_forward_formats(gboolean use_format,
if (use_format) {
gint line;
if (!prefs_template_string_is_valid(quotation_mark, NULL, FALSE))
if (!prefs_template_string_is_valid(quotation_mark, NULL, FALSE, FALSE))
alertpanel_error(_("Message forward quotation mark format error."));
if (override_from_fmt && !prefs_template_string_is_valid(override_from_fmt, NULL, FALSE))
if (override_from_fmt && !prefs_template_string_is_valid(override_from_fmt, NULL, FALSE, TRUE))
alertpanel_error(_("Message forward From format error."));
if (!prefs_template_string_is_valid(body_fmt, &line, TRUE)) {
if (!prefs_template_string_is_valid(body_fmt, &line, TRUE, FALSE)) {
alertpanel_error(_("Message forward format error at line %d."), line);
}
}