summaryrefslogtreecommitdiffstats
path: root/maildir/maildirinfo.h
blob: b8f4d479e27f898e28850357895963e7b3b93231 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#ifndef	maildir_maildirinfo_h
#define	maildir_maildirinfo_h

#include "config.h"

#ifdef  __cplusplus
extern "C" {
#endif

/*
** Copyright 2004 Double Precision, Inc.
** See COPYING for distribution information.
*/


struct maildir_info {
	int mailbox_type;
	char *homedir;
	char *maildir;
	char *owner;
};

char *imap_foldername_to_filename(int utf8_format, const char *foldername);

char *imap_filename_to_foldername(int utf8_format, const char *filename);

void maildir_info_destroy(struct maildir_info *); /* Deallocate memory */

int maildir_info_imap_find(struct maildir_info *info, const char *path,
			   const char *myid);

/*
** Initialize info based on path.  Returns 0 for success, -1 if path is
** syntactically invalid.  The mailbox may not actually exist.
**
** 'myid' is my login id, used to initialize owner (see below) for INBOX
** folders.
**
** homedir is set to the mailbox's homedir, which may not necessarily be
** "." if path points to #shared.user.folder.
** maildir is the local mailbox path, such as INBOX.folder
**
** owner will be set to the mailbox's owner, for ACL purposes.
**
** maildir will be NULL for a node in the legacy shared hierarchy.
*/

#define MAILBOXTYPE_INBOX 0	/* Inbox maildir */
#define MAILBOXTYPE_OLDSHARED 1	/* Legacy shared hierarchy */
#define MAILBOXTYPE_NEWSHARED 2 /* #shared hierarchy */

#define MAILBOXTYPE_IGNORE  255 /* Ignore this mailbox */

/*
** The application must define the following callback function that returns
** non-zero if the filename refers to the current account's maildir, and
** should be suppressed from the shared folder hierarchy.
*/
extern int maildir_info_suppress(const char *maildir);

/*
** The SMAP version:
*/
int maildir_info_smap_find(struct maildir_info *info, char **folder,
			   const char *myid);

char **maildir_smapfn_fromutf8(const char *modutf8);
void maildir_smapfn_free(char **fn);

/*
** The shared index files use UTF-8.  Convenience function to convert
** names into IMAP-compatible modified-UTF7.
*/

extern void maildir_info_munge_complex(int);
	/* If true, use "complex" munging */

extern char *maildir_info_imapmunge(const char *name);

#ifdef  __cplusplus
}
#endif

#endif