[Commits] [SCM] claws branch, master, updated. 3.10.1-152-g8c7418e
claws at claws-mail.org
claws at claws-mail.org
Wed Sep 3 12:49:25 CEST 2014
The branch, master has been updated
via 8c7418e621902913b0f1ecfce19eecc8557de6a3 (commit)
from bbf4c48e9e1357e752f4edc4841d8eeced6931ee (commit)
Summary of changes:
src/common/template.c | 8 +++++++-
src/common/template.h | 3 ++-
src/compose.c | 18 ++++++++++++++++++
src/prefs_template.c | 27 +++++++++++++++++++++++++--
4 files changed, 52 insertions(+), 4 deletions(-)
- Log -----------------------------------------------------------------
commit 8c7418e621902913b0f1ecfce19eecc8557de6a3
Author: Paul <paul at claws-mail.org>
Date: Wed Sep 3 11:49:17 2014 +0100
add Reply-To to template config
diff --git a/src/common/template.c b/src/common/template.c
index b49b7d9..683f263 100644
--- a/src/common/template.c
+++ b/src/common/template.c
@@ -51,7 +51,8 @@ static Template *template_load(gchar *filename)
tmpl->from = NULL;
tmpl->to = NULL;
tmpl->cc = NULL;
- tmpl->bcc = NULL;
+ tmpl->bcc = NULL;
+ tmpl->replyto = NULL;
tmpl->value = NULL;
while (fgets(buf, sizeof(buf), fp) != NULL) {
@@ -67,6 +68,8 @@ static Template *template_load(gchar *filename)
tmpl->cc = g_strdup(g_strstrip(buf + 3));
else if (!g_ascii_strncasecmp(buf, "Bcc:", 4))
tmpl->bcc = g_strdup(g_strstrip(buf + 4));
+ else if (!g_ascii_strncasecmp(buf, "Reply-To:", 9))
+ tmpl->replyto = g_strdup(g_strstrip(buf + 9));
else if (!g_ascii_strncasecmp(buf, "Subject:", 8))
tmpl->subject = g_strdup(g_strstrip(buf + 8));
}
@@ -101,6 +104,7 @@ void template_free(Template *tmpl)
g_free(tmpl->to);
g_free(tmpl->cc);
g_free(tmpl->bcc);
+ g_free(tmpl->replyto);
g_free(tmpl->value);
g_free(tmpl);
}
@@ -269,6 +273,8 @@ static void template_write_config(GSList *tmpl_list)
TRY(fprintf(fp, "Cc: %s\n", tmpl->cc) > 0);
if (tmpl->bcc && *tmpl->bcc != '\0')
TRY(fprintf(fp, "Bcc: %s\n", tmpl->bcc) > 0);
+ if (tmpl->replyto && *tmpl->replyto != '\0')
+ TRY(fprintf(fp, "Reply-To: %s\n", tmpl->replyto) > 0);
TRY(fputs("\n", fp) != EOF);
diff --git a/src/common/template.h b/src/common/template.h
index c74e4cf..2a37806 100644
--- a/src/common/template.h
+++ b/src/common/template.h
@@ -32,7 +32,8 @@ struct _Template {
gchar *from;
gchar *to;
gchar *cc;
- gchar *bcc;
+ gchar *bcc;
+ gchar *replyto;
gchar *value;
};
diff --git a/src/compose.c b/src/compose.c
index d41d221..c3ea943 100644
--- a/src/compose.c
+++ b/src/compose.c
@@ -8659,6 +8659,24 @@ static void compose_template_apply_fields(Compose *compose, Template *tmpl)
}
}
+ if (tmpl->replyto && *tmpl->replyto != '\0') {
+#ifdef USE_ENCHANT
+ quote_fmt_init(msginfo, NULL, NULL, FALSE, compose->account, FALSE,
+ compose->gtkaspell);
+#else
+ quote_fmt_init(msginfo, NULL, NULL, FALSE, compose->account, FALSE);
+#endif
+ quote_fmt_scan_string(tmpl->replyto);
+ quote_fmt_parse();
+
+ buf = quote_fmt_get_buffer();
+ if (buf == NULL) {
+ alertpanel_error(_("Template Reply-To format error."));
+ } else {
+ compose_entry_append(compose, buf, COMPOSE_REPLYTO, PREF_TEMPLATE);
+ }
+ }
+
/* process the subject */
if (tmpl->subject && *tmpl->subject != '\0') {
#ifdef USE_ENCHANT
diff --git a/src/prefs_template.c b/src/prefs_template.c
index 68173cb..bafd768 100644
--- a/src/prefs_template.c
+++ b/src/prefs_template.c
@@ -62,6 +62,7 @@ static struct Templates {
GtkWidget *entry_to;
GtkWidget *entry_cc;
GtkWidget *entry_bcc;
+ GtkWidget *entry_replyto;
GtkWidget *text_value;
} templates;
@@ -82,6 +83,7 @@ static struct
{"To", &templates.entry_to, TRUE, NULL},
{"Cc", &templates.entry_cc, TRUE, NULL},
{"Bcc", &templates.entry_bcc, TRUE, NULL},
+ {"Reply-To", &templates.entry_replyto, TRUE, NULL},
{"Subject", &templates.entry_subject, FALSE, NULL},
{NULL, NULL, FALSE, NULL}
};
@@ -158,7 +160,7 @@ static void prefs_template_window_create(void)
GtkWidget *scrolled_window;
GtkWidget *vpaned;
GtkWidget *vbox1;
- GtkWidget *table; /* including : entry_[name|from|to|cc|bcc|subject] */
+ GtkWidget *table; /* including : entry_[name|from|to|cc|bcc|replyto|subject] */
GtkWidget *scroll2;
GtkWidget *text_value;
GtkWidget *vbox2;
@@ -451,6 +453,7 @@ static void prefs_template_reset_dialog(void)
gtk_entry_set_text(GTK_ENTRY(templates.entry_to), "");
gtk_entry_set_text(GTK_ENTRY(templates.entry_cc), "");
gtk_entry_set_text(GTK_ENTRY(templates.entry_bcc), "");
+ gtk_entry_set_text(GTK_ENTRY(templates.entry_replyto), "");
gtk_entry_set_text(GTK_ENTRY(templates.entry_subject), "");
buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(templates.text_value));
@@ -657,6 +660,9 @@ static GSList *prefs_template_get_list(void)
ntmpl->bcc = tmpl->bcc && *(tmpl->bcc)
? g_strdup(tmpl->bcc)
: NULL;
+ ntmpl->replyto = tmpl->replyto && *(tmpl->replyto)
+ ? g_strdup(tmpl->replyto)
+ : NULL;
ntmpl->value = tmpl->value && *(tmpl->value)
? g_strdup(tmpl->value)
: NULL;
@@ -734,7 +740,8 @@ static gboolean prefs_template_list_view_set_row(gint row)
gchar *from;
gchar *to;
gchar *cc;
- gchar *bcc;
+ gchar *bcc;
+ gchar *replyto;
gchar *value;
GtkTextBuffer *buffer;
GtkTextIter start, end;
@@ -770,6 +777,8 @@ static gboolean prefs_template_list_view_set_row(gint row)
0, -1);
bcc = gtk_editable_get_chars(GTK_EDITABLE(templates.entry_bcc),
0, -1);
+ replyto = gtk_editable_get_chars(GTK_EDITABLE(templates.entry_replyto),
+ 0, -1);
subject = gtk_editable_get_chars(GTK_EDITABLE(templates.entry_subject),
0, -1);
@@ -789,6 +798,10 @@ static gboolean prefs_template_list_view_set_row(gint row)
g_free(bcc);
bcc = NULL;
}
+ if (replyto && *replyto == '\0') {
+ g_free(replyto);
+ replyto = NULL;
+ }
if (subject && *subject == '\0') {
g_free(subject);
subject = NULL;
@@ -818,6 +831,12 @@ static gboolean prefs_template_list_view_set_row(gint row)
g_free(value);
return FALSE;
}
+ if (!prefs_template_string_is_valid(replyto, NULL, TRUE, TRUE)) {
+ alertpanel_error(_("The \"Replyt-To\" field of the template contains an invalid email address."));
+ g_free(replyto);
+ g_free(value);
+ return FALSE;
+ }
if (!prefs_template_string_is_valid(subject, NULL, TRUE, FALSE)) {
alertpanel_error(_("The \"Subject\" field of the template is invalid."));
g_free(subject);
@@ -833,6 +852,7 @@ static gboolean prefs_template_list_view_set_row(gint row)
tmpl->to = to;
tmpl->cc = cc;
tmpl->bcc = bcc;
+ tmpl->replyto = replyto;
tmpl->value = value;
prefs_template_list_view_insert_template(templates.list_view,
@@ -1252,6 +1272,7 @@ static void prefs_template_select_row(GtkTreeView *list_view, GtkTreePath *path)
tmpl_def.to = "";
tmpl_def.cc = "";
tmpl_def.bcc = "";
+ tmpl_def.replyto = "";
tmpl_def.value = "";
gtk_tree_model_get(model, &titer, TEMPL_DATA, &tmpl, -1);
@@ -1267,6 +1288,8 @@ static void prefs_template_select_row(GtkTreeView *list_view, GtkTreePath *path)
tmpl->cc ? tmpl->cc : "");
gtk_entry_set_text(GTK_ENTRY(templates.entry_bcc),
tmpl->bcc ? tmpl->bcc : "");
+ gtk_entry_set_text(GTK_ENTRY(templates.entry_replyto),
+ tmpl->replyto ? tmpl->replyto : "");
gtk_entry_set_text(GTK_ENTRY(templates.entry_subject),
tmpl->subject ? tmpl->subject : "");
-----------------------------------------------------------------------
hooks/post-receive
--
Claws Mail
More information about the Commits
mailing list