talons

Fork of Claws Mail https://www.claws-mail
Log | Files | Refs | README | LICENSE

commit c313ec9aa7098fbc7645c432086ac81a64a5dee4
parent 4dd26ecd7748e2844ed30d436660d05a861ce6cb
Author: Ricardo Mones <mones@claws-mail.org>
Date:   Tue,  9 Oct 2012 23:58:43 +0000

2012-10-09 [mones]	3.8.1cvs86

	* doc/man/claws-mail.1
	* src/compose.c
	* src/common/utils.c
		New extra headers feature for adding user-defined
		extra headers to the combobox in the compose window
		Headers are stablished in 'extraheaderrc', one per
		line with a final colon

Diffstat:
MChangeLog | 112+++++++++++++++++++++++++++++++++++++++++++------------------------------------
MPATCHSETS | 1+
Mconfigure.ac | 2+-
Mdoc/man/claws-mail.1 | 3+++
Msrc/common/utils.c | 4++++
Msrc/compose.c | 53+++++++++++++++++++++++++++++++++++++++++++++++++++++
6 files changed, 123 insertions(+), 52 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -1,3 +1,13 @@ +2012-10-09 [mones] 3.8.1cvs86 + + * doc/man/claws-mail.1 + * src/compose.c + * src/common/utils.c + New extra headers feature for adding user-defined + extra headers to the combobox in the compose window + Headers are stablished in 'extraheaderrc', one per + line with a final colon + 2012-10-06 [mones] 3.8.1cvs85 * po/POTFILES.in @@ -113,8 +123,8 @@ 2012-09-22 [mir] 3.8.1cvs72 * src/advsearch.c - Fix for not searching in folders marked 'no_select' - patch provide by colin. + Fix for not searching in folders marked 'no_select' + patch provided by Colin. 2012-09-22 [mones] 3.8.1cvs71 @@ -244,53 +254,53 @@ 2012-09-16 [mones] 3.8.1cvs60 - * src/action.c - Removed dup calls with ignored result - * src/addr_compl.c - Removed unused var is_group and simplified logic around it - * src/addrharvest.c - * src/matcher.c - * src/procmsg.c - * src/etpan/etpan-thread-manager.c - Use unused var r to verify result and emit messages on error - * src/compose.c - Move color variable into conditional usage blocks - Remove assigned but not used vars: lock, titles, count - * src/edittags.c - Remove assigned but not used var actions - * src/folderview.c - Remove assigned but not used vars: from_parent, src_node - * src/imap_gtk.c - * src/mh_gtk.c - Remove malloc-ed but not used var: old_path - * src/news.c - Comment unused vars from commented block: tofetch, fetched - * src/prefs_account.c - Remove assigned but not used var: privacy_enabled - * src/prefs_actions.c - * src/prefs_customheader.c - Remove assigned but not used var: store - * src/prefs_filtering.c - Remove assigned but not used var: n_rows - * src/prefs_template.c - Remove assigned but not used vars: model, list_store - * src/prefs_toolbar.c - Remove assigned but not used var: win_titles - * src/printing.c - Remove assigned but not used vars: orientation, line, baseline, - off_chars - * src/etpan/imap-thread.c - Remove assigned but not used var: value, r - Refactor to check correct memory allocation - * src/etpan/nntp-thread.c - Remove assigned but not used var: value - * src/gtk/gtkaspell.c - Remove assigned but not used vars: textbuf, exist - Remove unused function: find_gtkaspeller - * src/gtk/gtkcmctree.c - Remove unused function: gtk_cmctree_get_offset - * src/gtk/gtkshruler.c - Remove assigned but not used vars: ruler, priv + * src/action.c + Removed dup calls with ignored result + * src/addr_compl.c + Removed unused var is_group and simplified logic around it + * src/addrharvest.c + * src/matcher.c + * src/procmsg.c + * src/etpan/etpan-thread-manager.c + Use unused var r to verify result and emit messages on error + * src/compose.c + Move color variable into conditional usage blocks + Remove assigned but not used vars: lock, titles, count + * src/edittags.c + Remove assigned but not used var actions + * src/folderview.c + Remove assigned but not used vars: from_parent, src_node + * src/imap_gtk.c + * src/mh_gtk.c + Remove malloc-ed but not used var: old_path + * src/news.c + Comment unused vars from commented block: tofetch, fetched + * src/prefs_account.c + Remove assigned but not used var: privacy_enabled + * src/prefs_actions.c + * src/prefs_customheader.c + Remove assigned but not used var: store + * src/prefs_filtering.c + Remove assigned but not used var: n_rows + * src/prefs_template.c + Remove assigned but not used vars: model, list_store + * src/prefs_toolbar.c + Remove assigned but not used var: win_titles + * src/printing.c + Remove assigned but not used vars: orientation, line, baseline, + off_chars + * src/etpan/imap-thread.c + Remove assigned but not used var: value, r + Refactor to check correct memory allocation + * src/etpan/nntp-thread.c + Remove assigned but not used var: value + * src/gtk/gtkaspell.c + Remove assigned but not used vars: textbuf, exist + Remove unused function: find_gtkaspeller + * src/gtk/gtkcmctree.c + Remove unused function: gtk_cmctree_get_offset + * src/gtk/gtkshruler.c + Remove assigned but not used vars: ruler, priv 2012-09-14 [mones] 3.8.1cvs59 @@ -326,8 +336,8 @@ 2012-09-12 [mones] 3.8.1cvs54 * src/prefs_other.c - Fix 1975 'preference mutt key bindings do not take effect' - (and the other invalid paths too) + Fix bug #1975 'preference mutt key bindings do not take + effect' (and the other invalid paths too) 2012-09-12 [colin] 3.8.1cvs53 diff --git a/PATCHSETS b/PATCHSETS @@ -4460,3 +4460,4 @@ ( cvs diff -u -r 1.1.2.5 -r 1.1.2.6 src/advsearch.c; ) > 3.8.1cvs83.patchset ( cvs diff -u -r 1.179.2.266 -r 1.179.2.267 src/imap.c; ) > 3.8.1cvs84.patchset ( cvs diff -u -r 1.53.2.38 -r 1.53.2.39 po/POTFILES.in; cvs diff -u -r 1.274.2.353 -r 1.274.2.354 src/mainwindow.c; cvs diff -u -r 1.9.2.59 -r 1.9.2.60 src/common/defs.h; cvs diff -u -r 1.5.2.47 -r 1.5.2.48 src/gtk/menu.c; cvs diff -u -r 1.4.2.27 -r 1.4.2.28 src/gtk/menu.h; ) > 3.8.1cvs85.patchset +( cvs diff -u -r 1.396.2.3641 -r 1.396.2.3642 ChangeLog; cvs diff -u -r 1.1.2.10 -r 1.1.2.11 doc/man/claws-mail.1; cvs diff -u -r 1.382.2.613 -r 1.382.2.614 src/compose.c; cvs diff -u -r 1.36.2.201 -r 1.36.2.202 src/common/utils.c; ) > 3.8.1cvs86.patchset diff --git a/configure.ac b/configure.ac @@ -12,7 +12,7 @@ MINOR_VERSION=8 MICRO_VERSION=1 INTERFACE_AGE=0 BINARY_AGE=0 -EXTRA_VERSION=85 +EXTRA_VERSION=86 EXTRA_RELEASE= EXTRA_GTK2_VERSION= diff --git a/doc/man/claws-mail.1 b/doc/man/claws-mail.1 @@ -202,6 +202,9 @@ Configuration for custom headers for sending mail .TP $HOME/.claws\-mail/dispheaderrc Configuration for custom display of headers in message view +.TP +$HOME/.claws\-mail/extraheaderrc +Editable extra headers to be added to compose window combobox .TP $HOME/.claws\-mail/folderitemrc All folders' attributes diff --git a/src/common/utils.c b/src/common/utils.c @@ -258,10 +258,14 @@ void list_free_strings(GList *list) void slist_free_strings(GSList *list) { +#if GLIB_CHECK_VERSION(2,28,0) + g_slist_free_full(list, (GDestroyNotify)g_free); +#else while (list != NULL) { g_free(list->data); list = list->next; } +#endif } static void hash_free_strings_func(gpointer key, gpointer value, gpointer data) diff --git a/src/compose.c b/src/compose.c @@ -183,6 +183,7 @@ typedef enum { #define MAX_REFERENCES_LEN 999 static GList *compose_list = NULL; +static GSList *extra_headers = NULL; static Compose *compose_generic_new (PrefsAccount *account, const gchar *to, @@ -6597,6 +6598,54 @@ static void compose_entry_popup_extend(GtkEntry *entry, GtkMenu *menu, gpointer gtk_widget_show(menuitem); } +void compose_add_extra_header(gchar *header, GtkListStore *model) +{ + GtkTreeIter iter; + if (strcmp(header, "")) { + COMBOBOX_ADD(model, header, COMPOSE_TO); + } +} + +void compose_add_extra_header_entries(GtkListStore *model) +{ + FILE *exh; + gchar *exhrc; + gchar buf[BUFFSIZE]; + gint lastc; + + if (extra_headers == NULL) { + exhrc = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, "extraheaderrc", NULL); + if ((exh = g_fopen(exhrc, "rb")) == NULL) { + debug_print("extra headers file not found\n"); + goto extra_headers_done; + } + while (fgets(buf, BUFFSIZE, exh) != NULL) { + lastc = strlen(buf) - 1; /* remove trailing \n */ + buf[lastc] = (buf[lastc] == '\n')? '\0': buf[lastc]; + --lastc; + if (lastc > 0 && buf[0] != '#' && buf[lastc] == ':') { + buf[lastc] = '\0'; /* remove trailing : for comparison */ + if (custom_header_is_allowed(buf)) { + buf[lastc] = ':'; + extra_headers = g_slist_prepend(extra_headers, g_strdup(buf)); + } + else + g_message("disallowed extra header line: %s\n", buf); + } + else { + if (buf[0] != '#') + g_message("invalid extra header line: %s\n", buf); + } + } + fclose(exh); +extra_headers_done: + g_free(exhrc); + extra_headers = g_slist_prepend(extra_headers, g_strdup("")); /* end of list */ + extra_headers = g_slist_reverse(extra_headers); + } + g_slist_foreach(extra_headers, (GFunc)compose_add_extra_header, (gpointer)model); +} + static void compose_create_header_entry(Compose *compose) { gchar *headers[] = {"To:", "Cc:", "Bcc:", "Newsgroups:", "Reply-To:", "Followup-To:", NULL}; @@ -6632,6 +6681,7 @@ static void compose_create_header_entry(Compose *compose) COMPOSE_REPLYTO); COMBOBOX_ADD(model, prefs_common_translated_header_name("Followup-To:"), COMPOSE_FOLLOWUPTO); + compose_add_extra_header_entries(model); gtk_combo_box_set_active(GTK_COMBO_BOX(combo), 0); g_signal_connect(G_OBJECT(gtk_bin_get_child(GTK_BIN(combo))), "grab_focus", @@ -8492,6 +8542,9 @@ static void compose_destroy(Compose *compose) slist_free_strings(compose->header_list); g_slist_free(compose->header_list); + slist_free_strings(extra_headers); + extra_headers = NULL; + compose->header_list = compose->newsgroup_list = compose->to_list = NULL; g_hash_table_destroy(compose->email_hashtable);