#ifndef USER_DIRECTORY_H
#define USER_DIRECTORY_H
enum user_kill_state {
USER_KILL_STATE_NONE,
USER_KILL_STATE_KILLING,
USER_KILL_STATE_KILLING_NOTIFY_RECEIVED,
USER_KILL_STATE_KILLED_WAITING_FOR_NOTIFY,
USER_KILL_STATE_KILLED_WAITING_FOR_EVERYONE,
USER_KILL_STATE_DELAY
};
struct user {
struct user *prev, *next;
unsigned int username_hash;
unsigned int timestamp;
struct mail_host *host;
struct timeout *to_move;
enum user_kill_state kill_state;
};
struct user_directory *user_directory_init(unsigned int timeout_secs);
void user_directory_deinit(struct user_directory **dir);
struct user *user_directory_lookup(struct user_directory *dir,
unsigned int username_hash);
struct user *
user_directory_add(struct user_directory *dir, unsigned int username_hash,
struct mail_host *host, time_t timestamp);
void user_directory_refresh(struct user_directory *dir, struct user *user);
void user_directory_remove_host(struct user_directory *dir,
struct mail_host *host);
unsigned int user_directory_get_username_hash(const char *username);
bool user_directory_user_has_connections(struct user_directory *dir,
struct user *user);
struct user_directory_iter *
user_directory_iter_init(struct user_directory *dir);
struct user *user_directory_iter_next(struct user_directory_iter *iter);
void user_directory_iter_deinit(struct user_directory_iter **iter);
#endif