mail-user.h revision 70ead6466f9baa8294e71fc2fba0a4f54f488b5e
#ifndef MAIL_USER_H
#define MAIL_USER_H
struct mail_user;
struct mail_user_vfuncs {
};
struct mail_user {
struct mail_user_vfuncs v;
int refcount;
const char *username;
/* don't access the home directly. It may be set lazily. */
const char *_home;
struct mail_namespace *namespaces;
/* Module-specific contexts. See mail_storage_module_id. */
/* Either home is set or there is no home for the user. */
unsigned int home_looked_up:1;
/* User is an administrator. Allow operations not normally allowed
for other people. */
unsigned int admin:1;
};
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 */
void mail_users_deinit(void);
/* Find another user from the given user's namespaces. */
/* Specify the user's home directory. This should be called also when it's
known that the user doesn't have a home directory to avoid the internal
lookup. */
/* Get the home directory for the user. Returns 1 if home directory looked up
successfully, 0 if there is no home directory (either user doesn't exist or
has no home directory) or -1 if lookup failed. */
/* Returns path + file prefix for creating a temporary file. Uses home
directory if possible, fallbacks to mail directory. */
/* Add more namespaces to user's namespaces. The ->next pointers may be
changed, so the namespaces pointer will be updated to user->namespaces. */
struct mail_namespace **namespaces);
/* Drop autocreated shared namespaces that don't have any "usable" mailboxes. */
/* Replace ~/ at the beginning of the path with the user's home directory. */
/* Returns 0 if ok, -1 if home directory isn't set. */
#endif