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