streamline init of type & name in imap_parse_store()

This commit is contained in:
Oswald Buddenhagen 2020-10-05 13:15:28 +02:00
parent 09341c10c5
commit a9ce7be962

View File

@ -3333,19 +3333,21 @@ imap_parse_store( conffile_t *cfg, store_conf_t **storep )
if (!strcasecmp( "IMAPAccount", cfg->cmd )) { if (!strcasecmp( "IMAPAccount", cfg->cmd )) {
server = nfcalloc( sizeof(*server) ); server = nfcalloc( sizeof(*server) );
server->name = nfstrdup( cfg->val ); name = server->name = nfstrdup( cfg->val );
*serverapp = server; *serverapp = server;
serverapp = &server->next; serverapp = &server->next;
store = NULL; store = NULL;
*storep = NULL; *storep = NULL;
type = "IMAP account";
} else if (!strcasecmp( "IMAPStore", cfg->cmd )) { } else if (!strcasecmp( "IMAPStore", cfg->cmd )) {
store = nfcalloc( sizeof(*store) ); store = nfcalloc( sizeof(*store) );
store->gen.driver = &imap_driver; store->gen.driver = &imap_driver;
store->gen.name = nfstrdup( cfg->val ); name = store->gen.name = nfstrdup( cfg->val );
store->use_namespace = 1; store->use_namespace = 1;
*storep = &store->gen; *storep = &store->gen;
memset( &sserver, 0, sizeof(sserver) ); memset( &sserver, 0, sizeof(sserver) );
server = &sserver; server = &sserver;
type = "IMAP store";
} else } else
return 0; return 0;
@ -3539,10 +3541,6 @@ imap_parse_store( conffile_t *cfg, store_conf_t **storep )
} }
acc_opt = 1; acc_opt = 1;
} }
if (store)
type = "IMAP store", name = store->gen.name;
else
type = "IMAP account", name = server->name;
if (!store || !store->server) { if (!store || !store->server) {
if (!server->sconf.tunnel && !server->sconf.host) { if (!server->sconf.tunnel && !server->sconf.host) {
error( "%s '%s' has neither Tunnel nor Host\n", type, name ); error( "%s '%s' has neither Tunnel nor Host\n", type, name );