From 7b02bff8210ca98f1d3ff0720091b512602571e8 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Fri, 12 Jan 2001 21:15:36 +0000 Subject: Get the account by using the new e_msg_composer_get_preferred_account() 2001-01-12 Jeffrey Stedfast * mail-callbacks.c (composer_send_cb): Get the account by using the new e_msg_composer_get_preferred_account() function. Also check to make sure everything is configured (in case they deleted their accounts while composing mail?). * mail-config.c (mail_config_get_account_by_address): New convenience function. svn path=/trunk/; revision=7459 --- mail/mail-config.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'mail/mail-config.c') diff --git a/mail/mail-config.c b/mail/mail-config.c index c5ba93f4a1..6ba5f1b51e 100644 --- a/mail/mail-config.c +++ b/mail/mail-config.c @@ -542,7 +542,26 @@ mail_config_get_account_by_name (const char *account_name) l = config->accounts; while (l) { account = l->data; - if (!strcmp (account->name, account_name)) + if (account && !strcmp (account->name, account_name)) + return account; + + l = l->next; + } + + return NULL; +} + +const MailConfigAccount * +mail_config_get_account_by_address (const char *address) +{ + /* FIXME: this should really use a hash? */ + const MailConfigAccount *account; + GSList *l; + + l = config->accounts; + while (l) { + account = l->data; + if (account && account->id && !g_strcasecmp (account->id->address, address)) return account; l = l->next; -- cgit v1.2.3