mail-namespace.h revision c58906589cafc32df4c04ffbef933baadd3f2276
76b43e4417bab52e913da39b5f5bc2a130d3f149Timo Sirainen#ifndef __MAIL_NAMESPACE_H
f877ee033a0737100c2f661a7ca4c559ea2ddb8aTimo Sirainen#define __MAIL_NAMESPACE_H
f877ee033a0737100c2f661a7ca4c559ea2ddb8aTimo Sirainen
f877ee033a0737100c2f661a7ca4c559ea2ddb8aTimo Sirainenenum namespace_type {
f877ee033a0737100c2f661a7ca4c559ea2ddb8aTimo Sirainen NAMESPACE_PRIVATE,
f877ee033a0737100c2f661a7ca4c559ea2ddb8aTimo Sirainen NAMESPACE_SHARED,
f877ee033a0737100c2f661a7ca4c559ea2ddb8aTimo Sirainen NAMESPACE_PUBLIC
f877ee033a0737100c2f661a7ca4c559ea2ddb8aTimo Sirainen};
f877ee033a0737100c2f661a7ca4c559ea2ddb8aTimo Sirainen
f877ee033a0737100c2f661a7ca4c559ea2ddb8aTimo Sirainenstruct mail_namespace {
f877ee033a0737100c2f661a7ca4c559ea2ddb8aTimo Sirainen struct mail_namespace *next;
f877ee033a0737100c2f661a7ca4c559ea2ddb8aTimo Sirainen
f877ee033a0737100c2f661a7ca4c559ea2ddb8aTimo Sirainen enum namespace_type type;
f877ee033a0737100c2f661a7ca4c559ea2ddb8aTimo Sirainen char sep, real_sep, sep_str[3];
f877ee033a0737100c2f661a7ca4c559ea2ddb8aTimo Sirainen
f877ee033a0737100c2f661a7ca4c559ea2ddb8aTimo Sirainen const char *prefix;
f877ee033a0737100c2f661a7ca4c559ea2ddb8aTimo Sirainen size_t prefix_len;
f877ee033a0737100c2f661a7ca4c559ea2ddb8aTimo Sirainen
f877ee033a0737100c2f661a7ca4c559ea2ddb8aTimo Sirainen bool inbox, hidden, subscriptions;
f877ee033a0737100c2f661a7ca4c559ea2ddb8aTimo Sirainen struct mailbox_list *list;
f877ee033a0737100c2f661a7ca4c559ea2ddb8aTimo Sirainen /* FIXME: we should support multiple storages in one namespace */
f877ee033a0737100c2f661a7ca4c559ea2ddb8aTimo Sirainen struct mail_storage *storage;
f877ee033a0737100c2f661a7ca4c559ea2ddb8aTimo Sirainen};
f877ee033a0737100c2f661a7ca4c559ea2ddb8aTimo Sirainen
f877ee033a0737100c2f661a7ca4c559ea2ddb8aTimo Sirainenint mail_namespaces_init(pool_t pool, const char *user,
f877ee033a0737100c2f661a7ca4c559ea2ddb8aTimo Sirainen struct mail_namespace **namespaces_r);
f877ee033a0737100c2f661a7ca4c559ea2ddb8aTimo Sirainenstruct mail_namespace *mail_namespaces_init_empty(pool_t pool);
f877ee033a0737100c2f661a7ca4c559ea2ddb8aTimo Sirainenvoid mail_namespaces_deinit(struct mail_namespace **namespaces);
f877ee033a0737100c2f661a7ca4c559ea2ddb8aTimo Sirainen
f877ee033a0737100c2f661a7ca4c559ea2ddb8aTimo Sirainenconst char *mail_namespace_fix_sep(struct mail_namespace *ns, const char *name);
f877ee033a0737100c2f661a7ca4c559ea2ddb8aTimo Sirainen
f877ee033a0737100c2f661a7ca4c559ea2ddb8aTimo Sirainenstruct mail_namespace *
f877ee033a0737100c2f661a7ca4c559ea2ddb8aTimo Sirainenmail_namespace_find(struct mail_namespace *namespaces, const char **mailbox);
f877ee033a0737100c2f661a7ca4c559ea2ddb8aTimo Sirainenstruct mail_namespace *
f877ee033a0737100c2f661a7ca4c559ea2ddb8aTimo Sirainenmail_namespace_find_visible(struct mail_namespace *namespaces,
f877ee033a0737100c2f661a7ca4c559ea2ddb8aTimo Sirainen const char **mailbox);
f877ee033a0737100c2f661a7ca4c559ea2ddb8aTimo Sirainenstruct mail_namespace *
f877ee033a0737100c2f661a7ca4c559ea2ddb8aTimo Sirainenmail_namespace_find_prefix(struct mail_namespace *namespaces,
f877ee033a0737100c2f661a7ca4c559ea2ddb8aTimo Sirainen const char *prefix);
f877ee033a0737100c2f661a7ca4c559ea2ddb8aTimo Sirainen
f877ee033a0737100c2f661a7ca4c559ea2ddb8aTimo Sirainen#endif
f877ee033a0737100c2f661a7ca4c559ea2ddb8aTimo Sirainen