#ifndef MAIL_USER_H
#define MAIL_USER_H
#include "net.h"
#include "unichar.h"
#include "mail-storage-settings.h"
struct module;
struct stats;
struct fs_settings;
struct ssl_iostream_settings;
struct mail_user;
struct mail_user_vfuncs {
};
struct mail_user_connection_data {
};
struct mail_user {
int refcount;
/* User's creator if such exists. For example for autocreated shared
mailbox users their creator is the logged in user. */
/* Set if user was created via mail_storage_service. */
const char *username;
/* don't access the home directly. It may be set lazily. */
const char *_home;
const char *service;
const char *session_id;
const char *const *userdb_fields;
/* Timestamp when this session was initially created. Most importantly
this stays the same after IMAP client is hibernated and restored. */
/* 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;
/* Filled lazily by mailbox_attribute_*() when accessing attributes. */
/* Module-specific contexts. See mail_storage_module_id. */
/* User doesn't exist (as reported by userdb lookup when looking
up home) */
/* Either home is set or there is no home for the user. */
/* User is anonymous */
/* This is an autocreated user (e.g. for shared namespace or
lda raw storage) */
/* mail_user_init() has been called */
/* The initial namespaces have been created and
hook_mail_namespaces_created() has been called. */
/* SET_STR_VARS in user's all settings have been expanded.
This happens near the beginning of the user initialization,
so this is rarely needed to be checked. */
/* Shortcut to mail_storage_settings.mail_debug */
/* If INBOX can't be opened, log an error, but only once. */
/* Fuzzy search works for this user (FTS enabled) */
/* We're running dsync */
/* Failed to create attribute dict, don't try again */
/* We're deinitializing the user */
/* Enable administrator user commands for the user */
/* Enable all statistics gathering */
/* This session was restored (e.g. IMAP unhibernation) */
};
struct mail_user_module_register {
unsigned int id;
};
union mail_user_module_context {
};
extern struct mail_user_module_register mail_user_module_register;
extern struct auth_master_connection *mail_user_auth_master_conn;
extern const struct var_expand_func_table *mail_user_var_expand_func_table;
const char *username,
const struct setting_parser_info *set_info,
const struct mail_user_settings *set);
struct mail_user *
const char *username,
const struct setting_parser_info *set_info,
const struct mail_user_settings *set);
/* Returns -1 if settings were invalid. */
/* Duplicate a mail_user. mail_user_init() and mail_namespaces_init() need to
be called before the user is usable. */
/* Find another user from the given user's namespaces. */
/* Specify mail location %variable expansion data. */
const struct mail_user_connection_data *conn);
/* 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 1 on success, 0 if lock_secs is reached, -1 on error */
unsigned int lock_secs,
/* Returns TRUE if plugin is loaded for the user. */
/* If name exists in plugin_envs, return its value. */
const char *name);
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. */
/* Basically the same as mail_storage_find_class(), except automatically load
storage plugins when needed. */
struct mail_storage *
/* Initialize SSL client settings from mail_user settings. */
struct ssl_iostream_settings *ssl_set);
/* Initialize fs_settings from mail_user settings. */
struct fs_settings *fs_set,
struct ssl_iostream_settings *ssl_set);
/* Fill statistics for user. By default there are no statistics, so stats
plugin must be loaded to have anything filled. */
#endif