dovecot-1.2: Forgot to add mail-user.* files in previous struct ...
dovecot at dovecot.org
dovecot at dovecot.org
Tue Aug 12 19:42:36 EEST 2008
details: http://hg.dovecot.org/dovecot-1.2/rev/f12f8c1da0bf
changeset: 8084:f12f8c1da0bf
user: Timo Sirainen <tss at iki.fi>
date: Tue Aug 12 12:42:28 2008 -0400
description:
Forgot to add mail-user.* files in previous struct mail_user commit.
diffstat:
2 files changed, 82 insertions(+)
src/lib-storage/mail-user.c | 43 +++++++++++++++++++++++++++++++++++++++++++
src/lib-storage/mail-user.h | 39 +++++++++++++++++++++++++++++++++++++++
diffs (90 lines):
diff -r bed6d0895dce -r f12f8c1da0bf src/lib-storage/mail-user.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/lib-storage/mail-user.c Tue Aug 12 12:42:28 2008 -0400
@@ -0,0 +1,43 @@
+/* Copyright (c) 2008 Dovecot authors, see the included COPYING file */
+
+#include "lib.h"
+#include "array.h"
+#include "mail-namespace.h"
+#include "mail-user.h"
+
+struct mail_user_module_register mail_user_module_register = { 0 };
+void (*hook_mail_user_created)(struct mail_user *user) = NULL;
+
+static void mail_user_deinit_base(struct mail_user *user)
+{
+ mail_namespaces_deinit(&user->namespaces);
+ pool_unref(&user->pool);
+}
+
+struct mail_user *mail_user_init(const char *username, const char *home)
+{
+ struct mail_user *user;
+ pool_t pool;
+
+ i_assert(username != NULL);
+
+ pool = pool_alloconly_create("mail user", 512);
+ user = p_new(pool, struct mail_user, 1);
+ user->pool = pool;
+ user->username = p_strdup(pool, username);
+ user->home = p_strdup(pool, home);
+ user->v.deinit = mail_user_deinit_base;
+ p_array_init(&user->module_contexts, user->pool, 5);
+
+ if (hook_mail_user_created != NULL)
+ hook_mail_user_created(user);
+ return user;
+}
+
+void mail_user_deinit(struct mail_user **_user)
+{
+ struct mail_user *user = *_user;
+
+ *_user = NULL;
+ user->v.deinit(user);
+}
diff -r bed6d0895dce -r f12f8c1da0bf src/lib-storage/mail-user.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/lib-storage/mail-user.h Tue Aug 12 12:42:28 2008 -0400
@@ -0,0 +1,39 @@
+#ifndef MAIL_USER_H
+#define MAIL_USER_H
+
+struct mail_user;
+
+struct mail_user_vfuncs {
+ void (*deinit)(struct mail_user *user);
+};
+
+struct mail_user {
+ pool_t pool;
+ struct mail_user_vfuncs v;
+
+ const char *username;
+ const char *home;
+
+ struct mail_namespace *namespaces;
+
+ /* Module-specific contexts. See mail_storage_module_id. */
+ ARRAY_DEFINE(module_contexts, union mail_user_module_context *);
+};
+
+struct mail_user_module_register {
+ unsigned int id;
+};
+
+union mail_user_module_context {
+ struct mail_user_vfuncs super;
+ struct mail_user_module_register *reg;
+};
+extern struct mail_user_module_register mail_user_module_register;
+
+/* Called after user has been created */
+extern void (*hook_mail_user_created)(struct mail_user *user);
+
+struct mail_user *mail_user_init(const char *username, const char *home);
+void mail_user_deinit(struct mail_user **user);
+
+#endif
More information about the dovecot-cvs
mailing list