changeset 21393:50fd64061aac

lib-storage: Allow namespaces_created hook to return failure via user error.
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Thu, 12 Jan 2017 16:20:40 +0200
parents 113f85406791
children 3f108cb63412
files src/lib-storage/mail-namespace.c
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/mail-namespace.c	Thu Jan 12 00:53:54 2017 +0200
+++ b/src/lib-storage/mail-namespace.c	Thu Jan 12 16:20:40 2017 +0200
@@ -382,6 +382,12 @@
 	T_BEGIN {
 		hook_mail_namespaces_created(namespaces);
 	} T_END;
+
+	/* allow namespace hooks to return failure via the user error */
+	if (namespaces->user->error != NULL) {
+		*error_r = t_strdup(namespaces->user->error);
+		return -1;
+	}
 	return 0;
 }