/*
* Copyright (C) 1996-2002,2010,2013 Michael R. Elkins <me@mutt.org>
* Copyright (C) 2004 g10 Code GmbH
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef MUTT_H
#define MUTT_H
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h> /* needed for SEEK_SET */
#ifdef HAVE_UNIX_H
# include <unix.h> /* needed for snprintf on QNX. */
#endif
#include <sys/types.h>
#include <sys/stat.h>
#include <time.h>
#include <limits.h>
#include <stdarg.h>
#include <signal.h>
/* On OS X 10.5.x, wide char functions are inlined by default breaking
* --without-wc-funcs compilation
*/
#ifdef __APPLE_CC__
#define _DONT_USE_CTYPE_INLINE_
#endif
#ifdef HAVE_WCHAR_H
# include <wchar.h>
#endif
#if defined(HAVE_WCTYPE_H) && defined(HAVE_WC_FUNCS)
# include <wctype.h>
#endif
#ifndef _POSIX_PATH_MAX
#include <limits.h>
#endif
/* PATH_MAX is undefined on the hurd */
#if !defined(PATH_MAX) && defined(_POSIX_PATH_MAX)
#define PATH_MAX _POSIX_PATH_MAX
#endif
#include <pwd.h>
#include <grp.h>
#include "rfc822.h"
#include "hash.h"
#include "charset.h"
#include "buffer.h"
#include "color.h"
#ifndef HAVE_WC_FUNCS
# ifdef MB_LEN_MAX
# undef MB_LEN_MAX
# endif
# define MB_LEN_MAX 16
#endif
#ifdef HAVE_FGETS_UNLOCKED
# ifdef fgets
# undef fgets
# endif
# define fgets fgets_unlocked
#endif
#ifdef HAVE_FGETC_UNLOCKED
# ifdef fgetc
# undef fgetc
# endif
# define fgetc fgetc_unlocked
#endif
#ifndef HAVE_STRUCT_TIMESPEC
struct timespec
{
time_t tv_sec;
long tv_nsec;
};
#endif
/* nifty trick I stole from ELM 2.5alpha. */
#ifdef MAIN_C
#define WHERE
#define INITVAL(x) = x
#else
#define WHERE extern
#define INITVAL(x)
#endif
#define WHERE_DEFINED 1
#include "mutt_regex.h"
/* flags for mutt_enter_string() */
#define MUTT_ALIAS 1 /* do alias "completion" by calling up the alias-menu */
#define MUTT_FILE (1<<1) /* do file completion, file history ring */
#define MUTT_MAILBOX (1<<2) /* do file completion, mailbox history ring */
#define MUTT_INCOMING (1<<3) /* do incoming folders buffy cycle */
#define MUTT_CMD (1<<4) /* do completion on previous word */
#define MUTT_PASS (1<<5) /* password mode (no echo) */
#define MUTT_CLEAR (1<<6) /* clear input if printable character is pressed */
#define MUTT_COMMAND (1<<7) /* do command completion */
#define MUTT_PATTERN (1<<8) /* pattern mode - only used for history classes */
#define MUTT_LABEL (1<<9) /* do label completion */
/* flags for mutt_get_token() */
#define MUTT_TOKEN_EQUAL 1 /* treat '=' as a special */
#define MUTT_TOKEN_CONDENSE (1<<1) /* ^(char) to control chars (macros) */
#define MUTT_TOKEN_SPACE (1<<2) /* don't treat whitespace as a term */
#define MUTT_TOKEN_QUOTE (1<<3) /* don't interpret quotes */
#define MUTT_TOKEN_PATTERN (1<<4) /* !)|~ are terms (for patterns) */
#define MUTT_TOKEN_COMMENT (1<<5) /* don't reap comments */
#define MUTT_TOKEN_SEMICOLON (1<<6) /* don't treat ; as special */
#define MUTT_TOKEN_ESC_VARS (1<<7) /* escape configuration variables */
#define MUTT_TOKEN_LISP (1<<8) /* enable lisp processing */
#define MUTT_TOKEN_NOLISP (1<<9) /* force-disable lisp, ignoring $lisp_args */
typedef struct
{
int ch; /* raw key pressed */
int op; /* function op */
} event_t;
/* flags for _mutt_system() */
#define MUTT_DETACH_PROCESS 1 /* detach subprocess from group */
/* flags for mutt_get_stat_timespec */
typedef enum
{
MUTT_STAT_ATIME,
MUTT_STAT_MTIME,
MUTT_STAT_CTIME
} mutt_stat_type;
/* flags for mutt_FormatString() */
typedef enum
{
MUTT_FORMAT_FORCESUBJ = (1<<0), /* print the subject even if unchanged */
MUTT_FORMAT_TREE = (1<<1), /* draw the thread tree */
MUTT_FORMAT_OPTIONAL = (1<<2),
MUTT_FORMAT_STAT_FILE = (1<<3), /* used by mutt_attach_fmt */
MUTT_FORMAT_ARROWCURSOR = (1<<4), /* reserve space for arrow_cursor */
MUTT_FORMAT_INDEX = (1<<5), /* this is a main index entry */
MUTT_FORMAT_NOFILTER = (1<<6) /* do not allow filtering on this pass */
} format_flag;
/* mode for mutt_write_rfc822_header() */
typedef enum
{
MUTT_WRITE_HEADER_NORMAL,
MUTT_WRITE_HEADER_FCC,
MUTT_WRITE_HEADER_POSTPONE,
MUTT_WRITE_HEADER_EDITHDRS,
MUTT_WRITE_HEADER_MIME
} mutt_write_header_mode;
/* types for mutt_add_hook() */
#define MUTT_FOLDERHOOK 1
#define MUTT_MBOXHOOK (1<<1)
#define MUTT_SENDHOOK (1<<2)
#define MUTT_FCCHOOK (1<<3)
#define MUTT_SAVEHOOK (1<<4)
#define MUTT_CHARSETHOOK (1<<5)
#define MUTT_ICONVHOOK (1<<6)
#define MUTT_MESSAGEHOOK (1<<7)
#define MUTT_CRYPTHOOK (1<<8)
#define MUTT_ACCOUNTHOOK (1<<9)
#define MUTT_REPLYHOOK (1<<10)
#define MUTT_SEND2HOOK (1<<11)
#ifdef USE_COMPRESSED
#define MUTT_OPENHOOK (1<<12)
#define MUTT_APPENDHOOK (1<<13)
#define MUTT_CLOSEHOOK (1<<14)
#endif /* USE_COMPRESSED */
#define MUTT_IDXFMTHOOK (1<<15)
/* tree characters for linearize_tree and print_enriched_string */
#define MUTT_TREE_LLCORNER 1
#define MUTT_TREE_ULCORNER 2
#define MUTT_TREE_LTEE 3
#define MUTT_TREE_HLINE 4
#define MUTT_TREE_VLINE 5
#define MUTT_TREE_SPACE 6
#define MUTT_TREE_RARROW 7
#define MUTT_TREE_STAR 8
#define MUTT_TREE_HIDDEN 9
#define MUTT_TREE_EQUALS 10
#define MUTT_TREE_TTEE 11
#define MUTT_TREE_BTEE 12
#define MUTT_TREE_MISSING 13