return client;
}
+int client_create_finish(struct client *client, const char **error_r)
+{
+ if (mail_namespaces_init(client->user, error_r) < 0)
+ return -1;
+ return 0;
+}
+
void client_command_cancel(struct client_command_context **_cmd)
{
struct client_command_context *cmd = *_cmd;
struct mail_storage_service_user *service_user,
const struct imap_settings *set,
const struct smtp_submit_settings *smtp_set);
+/* Finish creating the client. Returns 0 if ok, -1 if there's an error. */
+int client_create_finish(struct client *client, const char **error_r);
void client_destroy(struct client *client, const char *reason) ATTR_NULL(2);
/* Disconnect client connection */
}
client->imap_client_created = TRUE;
- if (mail_namespaces_init(imap_client->user, &error) < 0) {
- i_error("imap-master(%s): mail_namespaces_init() failed: %s",
- input.username, error);
+ if (client_create_finish(imap_client, &error) < 0) {
+ i_error("imap-master(%s): %s", input.username, error);
client_destroy(imap_client, error);
return -1;
}
client_add_input_capability(client, input_buf->data, input_buf->used);
}
- if (mail_namespaces_init(client->user, &error) < 0)
+ if (client_create_finish(client, &error) < 0)
i_fatal("%s", error);
client_add_input_finalize(client);
/* client may be destroyed now */
login_client->auth_req.data_size);
/* finish initializing the user (see comment in main()) */
- if (mail_namespaces_init(client->user, &error) < 0) {
+ if (client_create_finish(client, &error) < 0) {
if (write_full(login_client->fd, MSG_BYE_INTERNAL_ERROR,
strlen(MSG_BYE_INTERNAL_ERROR)) < 0)
if (errno != EAGAIN && errno != EPIPE)