6
struct mail_user_vfuncs {
7
void (*deinit)(struct mail_user *user);
12
struct mail_user_vfuncs v;
16
/* don't access the home directly. It may be set lazily. */
19
struct mail_namespace *namespaces;
21
/* Module-specific contexts. See mail_storage_module_id. */
22
ARRAY_DEFINE(module_contexts, union mail_user_module_context *);
24
/* Either home is set or there is no home for the user. */
25
unsigned int home_looked_up:1;
26
/* User is an administrator. Allow operations not normally allowed
31
struct mail_user_module_register {
35
union mail_user_module_context {
36
struct mail_user_vfuncs super;
37
struct mail_user_module_register *reg;
39
extern struct mail_user_module_register mail_user_module_register;
41
/* Called after user has been created */
42
extern void (*hook_mail_user_created)(struct mail_user *user);
44
void mail_users_init(const char *auth_socket_path, bool debug);
45
void mail_users_deinit(void);
47
struct mail_user *mail_user_init(const char *username);
48
void mail_user_ref(struct mail_user *user);
49
void mail_user_unref(struct mail_user **user);
51
/* Find another user from the given user's namespaces. */
52
struct mail_user *mail_user_find(struct mail_user *user, const char *name);
54
/* Specify the user's home directory. This should be called also when it's
55
known that the user doesn't have a home directory to avoid the internal
57
void mail_user_set_home(struct mail_user *user, const char *home);
58
/* Get the home directory for the user. Returns 1 if home directory looked up
59
successfully, 0 if there is no home directory (either user doesn't exist or
60
has no home directory) or -1 if lookup failed. */
61
int mail_user_get_home(struct mail_user *user, const char **home_r);
62
/* Returns path + file prefix for creating a temporary file. Uses home
63
directory if possible, fallbacks to mail directory. */
64
const char *mail_user_get_temp_prefix(struct mail_user *user);
66
/* Add more namespaces to user's namespaces. The ->next pointers may be
67
changed, so the namespaces pointer will be updated to user->namespaces. */
68
void mail_user_add_namespace(struct mail_user *user,
69
struct mail_namespace **namespaces);
70
/* Drop autocreated shared namespaces that don't have any "usable" mailboxes. */
71
void mail_user_drop_useless_namespaces(struct mail_user *user);
73
/* Replace ~/ at the beginning of the path with the user's home directory. */
74
const char *mail_user_home_expand(struct mail_user *user, const char *path);
75
/* Returns 0 if ok, -1 if home directory isn't set. */
76
int mail_user_try_home_expand(struct mail_user *user, const char **path);