From c53a336be2122ee410d754a2945afd8461184528 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Mon, 30 Sep 2002 14:04:42 +0000 Subject: let the caller set the "From" account too (by name or address). * Evolution-Composer.idl (setHeaders): let the caller set the "From" account too (by name or address). * evolution-composer.c (impl_Composer_set_headers): Update for that. svn path=/trunk/; revision=18260 --- composer/ChangeLog | 8 ++++++++ composer/Evolution-Composer.idl | 11 ++++++++--- composer/evolution-composer.c | 19 ++++++++++++++++++- 3 files changed, 34 insertions(+), 4 deletions(-) diff --git a/composer/ChangeLog b/composer/ChangeLog index afb4e44054..ff09113d6b 100644 --- a/composer/ChangeLog +++ b/composer/ChangeLog @@ -1,3 +1,11 @@ +2002-09-27 Dan Winship + + * Evolution-Composer.idl (setHeaders): let the caller set the + "From" account too (by name or address). + + * evolution-composer.c (impl_Composer_set_headers): Update for + that. + 2002-09-27 Jeffrey Stedfast * e-msg-composer.c (build_message): Don't reuse the part that diff --git a/composer/Evolution-Composer.idl b/composer/Evolution-Composer.idl index 5163197220..5dc62a3317 100644 --- a/composer/Evolution-Composer.idl +++ b/composer/Evolution-Composer.idl @@ -29,6 +29,7 @@ module Evolution { /** * setHeaders: + * @from: the "From" account or address * @to: the "To" recipients * @cc: the "CC" recipients * @bcc: the "Bcc" recipients @@ -36,10 +37,14 @@ module Evolution { * * Sets the composer headers. Any of @to, @cc, and * @bcc may be an empty list, and @subject may be an - * empty string. + * empty string. If @from is empty or invalid, the + * default account will be used. Otherwise is + * specifies an account name or email address to send + * from. **/ - void setHeaders (in RecipientList to, in RecipientList cc, - in RecipientList bcc, in string subject); + void setHeaders (in string from, in RecipientList to, + in RecipientList cc, in RecipientList bcc, + in string subject); /** * setMultipartType: diff --git a/composer/evolution-composer.c b/composer/evolution-composer.c index 8f96f98962..f7131ae6ae 100644 --- a/composer/evolution-composer.c +++ b/composer/evolution-composer.c @@ -74,6 +74,7 @@ corba_recipientlist_to_destv (const GNOME_Evolution_Composer_RecipientList *cl) static void impl_Composer_set_headers (PortableServer_Servant servant, + const CORBA_char *from, const GNOME_Evolution_Composer_RecipientList *to, const GNOME_Evolution_Composer_RecipientList *cc, const GNOME_Evolution_Composer_RecipientList *bcc, @@ -83,15 +84,31 @@ impl_Composer_set_headers (PortableServer_Servant servant, BonoboObject *bonobo_object; EvolutionComposer *composer; EDestination **tov, **ccv, **bccv; + const MailConfigAccount *account; + const GSList *accounts; bonobo_object = bonobo_object_from_servant (servant); composer = EVOLUTION_COMPOSER (bonobo_object); + account = mail_config_get_account_by_name (from); + if (!account) { + accounts = mail_config_get_accounts (); + while (accounts) { + account = accounts->data; + if (!g_strcasecmp (account->id->address, from)) + break; + accounts = accounts->next; + } + if (!accounts) + account = mail_config_get_default_account (); + } + tov = corba_recipientlist_to_destv (to); ccv = corba_recipientlist_to_destv (cc); bccv = corba_recipientlist_to_destv (bcc); - e_msg_composer_set_headers (composer->composer, NULL, tov, ccv, bccv, subject); + e_msg_composer_set_headers (composer->composer, account->name, + tov, ccv, bccv, subject); e_destination_freev (tov); e_destination_freev (ccv); -- cgit v1.2.3