aboutsummaryrefslogtreecommitdiffhomepage
path: root/contrib/notmuch-deliver/src/maildircreate.h
blob: ea1c71ac33af00e83ec304e4658f86603e8f489e (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
#ifndef	maildircreate_h
#define	maildircreate_h

/*
** Copyright 1998 - 2003 Double Precision, Inc.
** See COPYING for distribution information.
*/

#if	HAVE_CONFIG_H
#include	"config.h"
#endif

#include	<stdio.h>

#ifdef  __cplusplus
extern "C" {
#endif

static const char maildircreate_h_rcsid[]="$Id: maildircreate.h,v 1.10 2006/10/29 00:03:53 mrsam Exp $";

	/* Create messages in maildirs */

struct maildir_tmpcreate_info {
	const char *maildir;
	unsigned long msgsize;  /* If known, 0 otherwise (must use requota later)*/
	const char *uniq;	/* You need when creating multiple msgs */
	const char *hostname;	/* If known, NULL otherwise */
	int openmode;		/* Default open mode */
	int doordie;		/* Loop until we get it right. */
	char *tmpname;	/* On exit, filename in tmp */
	char *newname; /* On exit, filename in new */
};

#define maildir_tmpcreate_init(i) \
	do \
	{ \
		memset( (i), 0, sizeof(*(i))); \
		(i)->openmode=0644; \
	} while(0)

int maildir_tmpcreate_fd(struct maildir_tmpcreate_info *);
FILE *maildir_tmpcreate_fp(struct maildir_tmpcreate_info *);
void maildir_tmpcreate_free(struct maildir_tmpcreate_info *);

	/* Move created message from tmp to new */
int maildir_movetmpnew(const char *tmpname, const char *newname);

#ifdef  __cplusplus
}
#endif

#endif