Have the proper configuration loaded when initializing accounts
This commit is contained in:
parent
498db27d58
commit
c8da8bc79c
|
@ -134,7 +134,9 @@ Account * account_new(Mailer * mailer, char const * type, char const * title,
|
|||
account->plugin = plugin_new(LIBDIR, PACKAGE, "account", type);
|
||||
account->definition = (account->plugin != NULL)
|
||||
? plugin_lookup(account->plugin, "account_plugin") : NULL;
|
||||
/* check for errors */
|
||||
if(account->type == NULL || account->plugin == NULL
|
||||
|| (title != NULL && account->title == NULL)
|
||||
|| account->definition == NULL
|
||||
|| account->definition->init == NULL
|
||||
|| account->definition->destroy == NULL
|
||||
|
@ -258,9 +260,9 @@ int account_config_load(Account * account, Config * config)
|
|||
long l;
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "DEBUG: account_config_load(%p)\n", (void*)config);
|
||||
fprintf(stderr, "DEBUG: %s(%p)\n", __func__, (void *)config);
|
||||
#endif
|
||||
if(p == NULL)
|
||||
if(p == NULL || account->title == NULL)
|
||||
return 0;
|
||||
for(; p->name != NULL; p++)
|
||||
{
|
||||
|
@ -305,6 +307,8 @@ int account_config_save(Account * account, Config * config)
|
|||
#ifdef DEBUG
|
||||
fprintf(stderr, "DEBUG: account_config_save(%p)\n", (void *)config);
|
||||
#endif
|
||||
if(account->title == NULL)
|
||||
return 0;
|
||||
if(config_set(config, account->title, "type", account->type) != 0)
|
||||
return 1;
|
||||
if(p == NULL)
|
||||
|
|
|
@ -3083,12 +3083,12 @@ static int _mailer_config_load_account(Mailer * mailer, char const * name)
|
|||
if((account = account_new(mailer, type, name, mailer->fo_store))
|
||||
== NULL)
|
||||
return -mailer_error(mailer, error_get(), 1);
|
||||
if(mailer_account_add(mailer, account) != 0)
|
||||
if(account_config_load(account, mailer->config) != 0
|
||||
|| mailer_account_add(mailer, account) != 0)
|
||||
{
|
||||
account_delete(account);
|
||||
return -1;
|
||||
}
|
||||
account_config_load(account, mailer->config);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user