mail-user.h revision d74c9540cd64888055c4840a4544b1de4248e584
#ifndef MAIL_USER_H
#define MAIL_USER_H
#include "unichar.h"
#include "mail-storage-settings.h"
struct module;
struct mail_user;
struct mail_user_vfuncs {
};
struct mail_user {
struct mail_user_vfuncs v, *vlast;
int refcount;
const char *username;
/* don't access the home directly. It may be set lazily. */
const char *_home;
const char *service;
const struct var_expand_table *var_expand_table;
/* If non-NULL, fail the user initialization with this error.
This could be set by plugins that need to fail the initialization. */
const char *error;
const struct setting_parser_info *set_info;
const struct mail_user_settings *unexpanded_set;
struct mail_user_settings *set;
struct mail_namespace *namespaces;
struct mail_storage *storages;
struct mountpoint_list *mountpoints;
/* 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;
/* This is an autocreated user (e.g. for shared namespace or
lda raw storage) */
unsigned int autocreated:1;
/* mail_user_init() has been called */
unsigned int initialized:1;
/* Shortcut to mail_storage_settings.mail_debug */
unsigned int mail_debug:1;
/* If INBOX can't be opened, log an error, but only once. */
unsigned int inbox_open_error_logged:1;
/* Fuzzy search works for this user (FTS enabled) */
unsigned int fuzzy_search:1;
/* We're running dsync */
unsigned int dsyncing: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;
extern struct auth_master_connection *mail_user_auth_master_conn;
const struct setting_parser_info *set_info,
const struct mail_user_settings *set);
/* Returns -1 if settings were invalid. */
/* Find another user from the given user's namespaces. */
/* Specify mail location %variable expansion data. */
/* Return %variable expansion table for the user. */
const struct var_expand_table *
/* 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. */
/* Appends path + file prefix for creating a temporary file.
The file prefix doesn't contain any uniqueness. */
const struct mail_user_settings *set);
/* Returns TRUE if plugin is loaded for the user. */
/* If name exists in plugin_envs, return its value. */
const char *name);
/* 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. */
/* Returns unique user+ip identifier for anvil. */
/* Returns FALSE if path is in a mountpoint that should be mounted,
but isn't mounted. In such a situation it's better to fail than to attempt
mountpoint should be mounted. */
const char **error_r);
#endif