]> rtime.felk.cvut.cz Git - notmuch.git/blob - contrib/notmuch-deliver/maildrop/maildir/maildircreate.h
emacs: Washing should use more `defcustom'.
[notmuch.git] / contrib / notmuch-deliver / maildrop / maildir / maildircreate.h
1 #ifndef maildircreate_h
2 #define maildircreate_h
3
4 /*
5 ** Copyright 1998 - 2003 Double Precision, Inc.
6 ** See COPYING for distribution information.
7 */
8
9 #if     HAVE_CONFIG_H
10 #include        "config.h"
11 #endif
12
13 #include        <stdio.h>
14
15 #ifdef  __cplusplus
16 extern "C" {
17 #endif
18
19
20         /* Create messages in maildirs */
21
22 struct maildir_tmpcreate_info {
23         const char *maildir;
24         unsigned long msgsize;  /* If known, 0 otherwise (must use requota later)*/
25         const char *uniq;       /* You need when creating multiple msgs */
26         const char *hostname;   /* If known, NULL otherwise */
27         int openmode;           /* Default open mode */
28         int doordie;            /* Loop until we get it right. */
29         char *tmpname;  /* On exit, filename in tmp */
30         char *newname; /* On exit, filename in new */
31 };
32
33 #define maildir_tmpcreate_init(i) \
34         do \
35         { \
36                 memset( (i), 0, sizeof(*(i))); \
37                 (i)->openmode=0644; \
38         } while(0)
39
40 int maildir_tmpcreate_fd(struct maildir_tmpcreate_info *);
41 FILE *maildir_tmpcreate_fp(struct maildir_tmpcreate_info *);
42 void maildir_tmpcreate_free(struct maildir_tmpcreate_info *);
43
44         /* Move created message from tmp to new */
45 int maildir_movetmpnew(const char *tmpname, const char *newname);
46
47 #ifdef  __cplusplus
48 }
49 #endif
50
51 #endif