]> git.notmuchmail.org Git - notmuch/blob - contrib/notmuch-deliver/src/maildircreate.h
ea1c71ac33af00e83ec304e4658f86603e8f489e
[notmuch] / contrib / notmuch-deliver / src / 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 static const char maildircreate_h_rcsid[]="$Id: maildircreate.h,v 1.10 2006/10/29 00:03:53 mrsam Exp $";
20
21         /* Create messages in maildirs */
22
23 struct maildir_tmpcreate_info {
24         const char *maildir;
25         unsigned long msgsize;  /* If known, 0 otherwise (must use requota later)*/
26         const char *uniq;       /* You need when creating multiple msgs */
27         const char *hostname;   /* If known, NULL otherwise */
28         int openmode;           /* Default open mode */
29         int doordie;            /* Loop until we get it right. */
30         char *tmpname;  /* On exit, filename in tmp */
31         char *newname; /* On exit, filename in new */
32 };
33
34 #define maildir_tmpcreate_init(i) \
35         do \
36         { \
37                 memset( (i), 0, sizeof(*(i))); \
38                 (i)->openmode=0644; \
39         } while(0)
40
41 int maildir_tmpcreate_fd(struct maildir_tmpcreate_info *);
42 FILE *maildir_tmpcreate_fp(struct maildir_tmpcreate_info *);
43 void maildir_tmpcreate_free(struct maildir_tmpcreate_info *);
44
45         /* Move created message from tmp to new */
46 int maildir_movetmpnew(const char *tmpname, const char *newname);
47
48 #ifdef  __cplusplus
49 }
50 #endif
51
52 #endif