37e7e41bc1fe51101fbf956d2d5d2661ace04b84
[apps/madmutt.git] / mx.h
1 /*
2  * Copyright (C) 1996-2002 Michael R. Elkins <me@mutt.org>
3  * Copyright (C) 1999-2002 Thomas Roessler <roessler@does-not-exist.org>
4  *
5  *     This program is free software; you can redistribute it and/or modify
6  *     it under the terms of the GNU General Public License as published by
7  *     the Free Software Foundation; either version 2 of the License, or
8  *     (at your option) any later version.
9  * 
10  *     This program is distributed in the hope that it will be useful,
11  *     but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  *     GNU General Public License for more details.
14  * 
15  *     You should have received a copy of the GNU General Public License
16  *     along with this program; if not, write to the Free Software
17  *     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
18  */
19
20 /*
21  * This header file contains prototypes for internal functions used by the
22  * generic mailbox api.  None of these functions should be called directly.
23  */
24
25 #ifndef _MX_H
26 #define _MX_H
27
28 #include "mailbox.h"
29
30 /* supported mailbox formats */
31 enum {
32   M_MBOX = 1,
33   M_MMDF,
34   M_MH,
35   M_MAILDIR
36 #ifdef USE_IMAP
37     , M_IMAP
38 #endif
39 #ifdef USE_POP
40     , M_POP
41 #endif
42 #ifdef USE_NNTP
43     , M_NNTP
44 #endif
45 #ifdef USE_COMPRESSED
46     , M_COMPRESSED
47 #endif
48 };
49
50 WHERE short DefaultMagic INITVAL (M_MBOX);
51
52 #define MMDF_SEP "\001\001\001\001\n"
53 #define MAXLOCKATTEMPT 5
54
55 int mbox_sync_mailbox (CONTEXT *, int *);
56 int mbox_open_mailbox (CONTEXT *);
57 int mbox_check_mailbox (CONTEXT *, int *);
58 int mbox_close_mailbox (CONTEXT *);
59 int mbox_lock_mailbox (CONTEXT *, int, int);
60 int mbox_parse_mailbox (CONTEXT *);
61 int mmdf_parse_mailbox (CONTEXT *);
62 void mbox_unlock_mailbox (CONTEXT *);
63 int mbox_check_empty (const char *);
64
65 int mh_read_dir (CONTEXT *, const char *);
66 int mh_sync_mailbox (CONTEXT *, int *);
67 int mh_check_mailbox (CONTEXT *, int *);
68 int mh_buffy (const char *);
69 int mh_check_empty (const char *);
70
71 int maildir_read_dir (CONTEXT *);
72 int maildir_check_mailbox (CONTEXT *, int *);
73 int maildir_check_empty (const char *);
74
75 int maildir_commit_message (CONTEXT *, MESSAGE *, HEADER *);
76 int mh_commit_message (CONTEXT *, MESSAGE *, HEADER *);
77
78 int maildir_open_new_message (MESSAGE *, CONTEXT *, HEADER *);
79 int mh_open_new_message (MESSAGE *, CONTEXT *, HEADER *);
80
81 FILE *maildir_open_find_message (const char *, const char *);
82
83 int mbox_strict_cmp_headers (const HEADER *, const HEADER *);
84 int mutt_reopen_mailbox (CONTEXT *, int *);
85
86 void mx_alloc_memory (CONTEXT *);
87 void mx_update_context (CONTEXT *, int);
88 void mx_update_tables (CONTEXT *, int);
89
90
91 int mx_lock_file (const char *, int, int, int, int);
92 int mx_unlock_file (const char *path, int fd, int dot);
93
94
95 #endif