diff options
author | Milan Crha <mcrha@redhat.com> | 2011-08-12 19:20:43 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@gnome-db.org> | 2011-09-14 20:08:48 +0800 |
commit | aa4440a9590572533c7deb59290cc30c51ec4e62 (patch) | |
tree | 2d4521b001d6ed7ed0c3a84000c8a7d14c3a3e1a /composer/e-msg-composer.c | |
parent | 14a6723fa1cc47cf141a33784cd68e696cc528cc (diff) | |
download | gsoc2013-evolution-aa4440a9590572533c7deb59290cc30c51ec4e62.tar.gz gsoc2013-evolution-aa4440a9590572533c7deb59290cc30c51ec4e62.tar.zst gsoc2013-evolution-aa4440a9590572533c7deb59290cc30c51ec4e62.zip |
Bug #656290 - "Always carbon-copy (cc) to:" option not honored
Diffstat (limited to 'composer/e-msg-composer.c')
-rw-r--r-- | composer/e-msg-composer.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c index 6ba256d143..5b799309a6 100644 --- a/composer/e-msg-composer.c +++ b/composer/e-msg-composer.c @@ -3933,6 +3933,52 @@ add_recipients (GList *list, const gchar *recips) return list; } +static gboolean +list_contains_addr (const GList *lst, EDestination *dest) +{ + g_return_val_if_fail (dest != NULL, FALSE); + + while (lst) { + if (e_destination_equal (dest, lst->data)) + return TRUE; + + lst = lst->next; + } + + return FALSE; +} + +static void +merge_cc_bcc (EDestination **addrv, GList **merge_into, const GList *to, const GList *cc, const GList *bcc) +{ + gint ii; + + for (ii = 0; addrv && addrv[ii]; ii++) { + if (!list_contains_addr (to, addrv[ii]) && + !list_contains_addr (cc, addrv[ii]) && + !list_contains_addr (bcc, addrv[ii])) + *merge_into = g_list_append (*merge_into, g_object_ref (addrv[ii])); + } +} + +static void +merge_always_cc_and_bcc (EComposerHeaderTable *table, const GList *to, GList **cc, GList **bcc) +{ + EDestination **addrv; + + g_return_if_fail (table != NULL); + g_return_if_fail (cc != NULL); + g_return_if_fail (bcc != NULL); + + addrv = e_composer_header_table_get_destinations_cc (table); + merge_cc_bcc (addrv, cc, to, *cc, *bcc); + e_destination_freev (addrv); + + addrv = e_composer_header_table_get_destinations_bcc (table); + merge_cc_bcc (addrv, bcc, to, *cc, *bcc); + e_destination_freev (addrv); +} + static void handle_mailto (EMsgComposer *composer, const gchar *mailto) { @@ -4057,6 +4103,8 @@ handle_mailto (EMsgComposer *composer, const gchar *mailto) g_free (buf); + merge_always_cc_and_bcc (table, to, &cc, &bcc); + tov = destination_list_to_vector (to); ccv = destination_list_to_vector (cc); bccv = destination_list_to_vector (bcc); |