1 #ifndef	maildir_maildirinfo_h
2 #define	maildir_maildirinfo_h
3 
4 #include "config.h"
5 
6 #ifdef  __cplusplus
7 extern "C" {
8 #endif
9 
10 /*
11 ** Copyright 2004 Double Precision, Inc.
12 ** See COPYING for distribution information.
13 */
14 
15 
16 struct maildir_info {
17 	int mailbox_type;
18 	char *homedir;
19 	char *maildir;
20 	char *owner;
21 };
22 
23 char *imap_foldername_to_filename(int utf8_format, const char *foldername);
24 
25 char *imap_filename_to_foldername(int utf8_format, const char *filename);
26 
27 void maildir_info_destroy(struct maildir_info *); /* Deallocate memory */
28 
29 int maildir_info_imap_find(struct maildir_info *info, const char *path,
30 			   const char *myid);
31 
32 /*
33 ** Initialize info based on path.  Returns 0 for success, -1 if path is
34 ** syntactically invalid.  The mailbox may not actually exist.
35 **
36 ** 'myid' is my login id, used to initialize owner (see below) for INBOX
37 ** folders.
38 **
39 ** homedir is set to the mailbox's homedir, which may not necessarily be
40 ** "." if path points to #shared.user.folder.
41 ** maildir is the local mailbox path, such as INBOX.folder
42 **
43 ** owner will be set to the mailbox's owner, for ACL purposes.
44 **
45 ** maildir will be NULL for a node in the legacy shared hierarchy.
46 */
47 
48 #define MAILBOXTYPE_INBOX 0	/* Inbox maildir */
49 #define MAILBOXTYPE_OLDSHARED 1	/* Legacy shared hierarchy */
50 #define MAILBOXTYPE_NEWSHARED 2 /* #shared hierarchy */
51 
52 #define MAILBOXTYPE_IGNORE  255 /* Ignore this mailbox */
53 
54 /*
55 ** The application must define the following callback function that returns
56 ** non-zero if the filename refers to the current account's maildir, and
57 ** should be suppressed from the shared folder hierarchy.
58 */
59 extern int maildir_info_suppress(const char *maildir);
60 
61 /*
62 ** The SMAP version:
63 */
64 int maildir_info_smap_find(struct maildir_info *info, char **folder,
65 			   const char *myid);
66 
67 char **maildir_smapfn_fromutf8(const char *modutf8);
68 void maildir_smapfn_free(char **fn);
69 
70 /*
71 ** The shared index files use UTF-8.  Convenience function to convert
72 ** names into IMAP-compatible modified-UTF7.
73 */
74 
75 extern void maildir_info_munge_complex(int);
76 	/* If true, use "complex" munging */
77 
78 extern char *maildir_info_imapmunge(const char *name);
79 
80 #ifdef  __cplusplus
81 }
82 #endif
83 
84 #endif
85