diff options
author | Milan Crha <mcrha@redhat.com> | 2011-08-12 19:20:43 +0800 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2011-08-12 19:20:43 +0800 |
commit | ceb9b91bd91096e2dab1cd2c77de21943d0e30d8 (patch) | |
tree | 49989d918034edc5a42d3e4be66e71e29e1aac3c /composer | |
parent | b7cfbb7d677010cd7948d14563b8e88c7da0d9b3 (diff) | |
download | gsoc2013-evolution-ceb9b91bd91096e2dab1cd2c77de21943d0e30d8.tar gsoc2013-evolution-ceb9b91bd91096e2dab1cd2c77de21943d0e30d8.tar.gz gsoc2013-evolution-ceb9b91bd91096e2dab1cd2c77de21943d0e30d8.tar.bz2 gsoc2013-evolution-ceb9b91bd91096e2dab1cd2c77de21943d0e30d8.tar.lz gsoc2013-evolution-ceb9b91bd91096e2dab1cd2c77de21943d0e30d8.tar.xz gsoc2013-evolution-ceb9b91bd91096e2dab1cd2c77de21943d0e30d8.tar.zst gsoc2013-evolution-ceb9b91bd91096e2dab1cd2c77de21943d0e30d8.zip |
Bug #656290 - "Always carbon-copy (cc) to:" option not honored
Diffstat (limited to 'composer')
-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); |