talons

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

commit c8409a47933b566ff93f2805e91980efd7df1c7d
parent d68093c4e5f2777fe13b5d2b6228586900b71dbb
Author: Andrej Kacian <ticho@claws-mail.org>
Date:   Fri,  7 Mar 2014 23:24:39 +0100

When autoselecting account for a new message, handle quoted recipient names better. Patch by Christoph Ruegge, bug #3100.

Diffstat:
Msrc/account.c | 27++++++++++++++-------------
1 file changed, 14 insertions(+), 13 deletions(-)

diff --git a/src/account.c b/src/account.c @@ -1391,23 +1391,24 @@ PrefsAccount *account_get_reply_account(MsgInfo *msginfo, gboolean reply_autosel int fieldno = 0; for (field = msginfo->to; fieldno++ < 2; field = msginfo->cc) { if (!account && field) { - gchar *to = NULL; - if (!strchr(field, ',')) { - Xstrdup_a(to, field, return NULL); - extract_address(to); - account = account_find_from_address(to, FALSE); - } else { - gchar **split = g_strsplit(field, ",", -1); - int i = -1; + gchar *f = g_strdup(field); + if (f) { + gchar *cur = f; + gchar *next = NULL; + gchar *to = NULL; do { - i++; - if (!split[i]) - break; - Xstrdup_a(to, split[i], return NULL); + next = strchr_with_skip_quote(cur, '"', ','); + if (next) + (*next) = 0; + Xstrdup_a(to, cur, return NULL); extract_address(to); account = account_find_from_address(to, FALSE); + if (next) + cur = next + 1; + else + break; } while (!account); - g_strfreev(split); + g_free(f); } } }