mutt stable branch with some hacks
1/*
2 * Copyright (C) 1996-2002 Michael R. Elkins <me@mutt.org>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 */
18
19#ifndef _MAILBOX_H
20#define _MAILBOX_H
21
22/* flags for mutt_open_mailbox() */
23#define MUTT_NOSORT (1<<0) /* do not sort the mailbox after opening it */
24#define MUTT_APPEND (1<<1) /* open mailbox for appending messages */
25#define MUTT_READONLY (1<<2) /* open in read-only mode */
26#define MUTT_QUIET (1<<3) /* do not print any messages */
27#define MUTT_NEWFOLDER (1<<4) /* create a new folder - same as MUTT_APPEND, but uses
28 * safe_fopen() with mode "w" for mbox-style folders.
29 * This will truncate an existing file. */
30#define MUTT_PEEK (1<<5) /* revert atime back after taking a look (if applicable) */
31#define MUTT_APPENDNEW (1<<6) /* set in mx_open_mailbox_append if the mailbox doesn't
32 * exist. used by maildir/mh to create the mailbox. */
33
34/* mx_open_new_message() */
35#define MUTT_ADD_FROM (1<<0) /* add a From_ line */
36#define MUTT_SET_DRAFT (1<<1) /* set the message draft flag */
37
38/* return values from mx_check_mailbox() */
39enum
40{
41 MUTT_NEW_MAIL = 1, /* new mail received in mailbox */
42 MUTT_LOCKED, /* couldn't lock the mailbox */
43 MUTT_REOPENED, /* mailbox was reopened */
44 MUTT_FLAGS /* nondestructive flags change (IMAP) */
45};
46
47typedef struct _message
48{
49 FILE *fp; /* pointer to the message data */
50 char *path; /* path to temp file */
51 short write; /* nonzero if message is open for writing */
52 struct {
53 unsigned read : 1;
54 unsigned flagged : 1;
55 unsigned replied : 1;
56 unsigned draft : 1;
57 } flags;
58 time_t received; /* the time at which this message was received */
59} MESSAGE;
60
61CONTEXT *mx_open_mailbox (const char *, int, CONTEXT *);
62
63MESSAGE *mx_open_message (CONTEXT *, int);
64MESSAGE *mx_open_new_message (CONTEXT *, HEADER *, int);
65
66void mx_fastclose_mailbox (CONTEXT *);
67
68int mx_close_mailbox (CONTEXT *, int *);
69int mx_sync_mailbox (CONTEXT *, int *);
70int mx_commit_message (MESSAGE *, CONTEXT *);
71int mx_close_message (CONTEXT *, MESSAGE **);
72int mx_get_magic (const char *);
73int mx_set_magic (const char *);
74int mx_check_mailbox (CONTEXT *, int *);
75#ifdef USE_IMAP
76int mx_is_imap (const char *);
77#endif
78#ifdef USE_POP
79int mx_is_pop (const char *);
80#endif
81
82int mx_access (const char*, int);
83int mx_check_empty (const char *);
84int mx_msg_padding_size (CONTEXT *);
85int mx_save_to_header_cache (CONTEXT *, HEADER *);
86
87int mx_is_maildir (const char *);
88int mx_is_mh (const char *);
89
90#endif