/*
* Copyright (C) 1996-2000 Michael R. Elkins <me@cs.hmc.edu>, and others
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*/
#include "mutt.h"
#include "mapping.h"
#include "keymap.h"
#include "mailbox.h"
#include "copy.h"
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <sys/stat.h>
#include <unistd.h>
#include <stdarg.h>
#ifdef HAVE_PGP
#include "pgp.h"
#endif
static int eat_regexp (pattern_t *pat, BUFFER *, BUFFER *);
static int eat_date (pattern_t *pat, BUFFER *, BUFFER *);
static int eat_range (pattern_t *pat, BUFFER *, BUFFER *);
struct pattern_flags
{
int tag; /* character used to represent this op */
int op; /* operation to perform */
int class;
int (*eat_arg) (pattern_t *, BUFFER *, BUFFER *);
}
Flags[] =
{
{ 'A', M_ALL, 0, NULL },
{ 'b', M_BODY, M_FULL_MSG, eat_regexp },
{ 'B', M_WHOLE_MSG, M_FULL_MSG, eat_regexp },
{ 'c', M_CC, 0, eat_regexp },
{ 'C', M_RECIPIENT, 0, eat_regexp },
{ 'd', M_DATE, 0, eat_date },
{ 'D', M_DELETED, 0, NULL },
{ 'e', M_SENDER, 0, eat_regexp },
{ 'E', M_EXPIRED, 0, NULL },
{ 'f', M_FROM, 0, eat_regexp },
{ 'F', M_FLAG, 0, NULL },
#ifdef HAVE_PGP
{ 'g', M_PGP_SIGN, 0, NULL },
{ 'G', M_PGP_ENCRYPT, 0, NULL },
#endif
{ 'h', M_HEADER, M_FULL_MSG, eat_regexp },
{ 'i', M_ID, 0, eat_regexp },
#ifdef HAVE_PGP
{ 'k', M_PGP_KEY, 0, NULL },
#endif
{ 'L', M_ADDRESS, 0, eat_regexp },
{ 'l', M_LIST, 0, NULL },
{ 'm', M_MESSAGE, 0, eat_range },
{ 'n', M_SCORE, 0, eat_range },
{ 'N', M_NEW, 0, NULL },
{ 'O', M_OLD, 0, NULL },
{ 'p', M_PERSONAL_RECIP, 0, NULL },
{ 'P', M_PERSONAL_FROM, 0, NULL },
{ 'Q', M_REPLIED, 0, NULL },
{ 'R', M_READ, 0, NULL },
{ 'r', M_DATE_RECEIVED, 0, eat_date },
{ 's', M_SUBJECT, 0, eat_regexp },
{ 'S',