Back to index

courier  0.68.2
maildircreate.h
Go to the documentation of this file.
00001 #ifndef       maildircreate_h
00002 #define       maildircreate_h
00003 
00004 /*
00005 ** Copyright 1998 - 2003 Double Precision, Inc.
00006 ** See COPYING for distribution information.
00007 */
00008 
00009 #if    HAVE_CONFIG_H
00010 #include      "config.h"
00011 #endif
00012 
00013 #include      <stdio.h>
00014 
00015 #ifdef  __cplusplus
00016 extern "C" {
00017 #endif
00018 
00019 
00020        /* Create messages in maildirs */
00021 
00022 struct maildir_tmpcreate_info {
00023        const char *maildir;
00024        unsigned long msgsize;  /* If known, 0 otherwise (must use requota later)*/
00025        const char *uniq;    /* You need when creating multiple msgs */
00026        const char *hostname;       /* If known, NULL otherwise */
00027        int openmode;        /* Default open mode */
00028        int doordie;         /* Loop until we get it right. */
00029        char *tmpname;       /* On exit, filename in tmp */
00030        char *newname; /* On exit, filename in new */
00031 };
00032 
00033 #define maildir_tmpcreate_init(i) \
00034        do \
00035        { \
00036               memset( (i), 0, sizeof(*(i))); \
00037               (i)->openmode=0644; \
00038        } while(0)
00039 
00040 int maildir_tmpcreate_fd(struct maildir_tmpcreate_info *);
00041 FILE *maildir_tmpcreate_fp(struct maildir_tmpcreate_info *);
00042 void maildir_tmpcreate_free(struct maildir_tmpcreate_info *);
00043 
00044        /* Move created message from tmp to new */
00045 int maildir_movetmpnew(const char *tmpname, const char *newname);
00046 
00047 #ifdef  __cplusplus
00048 }
00049 #endif
00050 
00051 #endif