/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2001, 2005, 2006, 2007, 2008, 2009, 2010, 2011
Free Software Foundation, Inc.
GNU Mailutils 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 3, or (at your option)
any later version.
GNU Mailutils 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 GNU Mailutils. If not, see <http://www.gnu.org/licenses/>. */
#include "imap4d.h"
#include <ctype.h>
#include <mailutils/argcv.h>
/* Taken from RFC2060
fetch ::= "FETCH" SPACE set SPACE ("ALL" / "FULL" /
"FAST" / fetch_att / "(" 1#fetch_att ")")
fetch_att ::= "ENVELOPE" / "FLAGS" / "INTERNALDATE" /
"RFC822" [".HEADER" / ".SIZE" / ".TEXT"] /
"BODY" ["STRUCTURE"] / "UID" /
"BODY" [".PEEK"] section
["<" number "." nz_number ">"]
*/
struct fetch_runtime_closure
{
int eltno;
size_t msgno;
mu_message_t msg;
char *err_text;
};
struct fetch_function_closure;
typedef int (*fetch_function_t) (struct fetch_function_closure *,
struct fetch_runtime_closure *);
struct fetch_function_closure
{
fetch_function_t fun; /* Handler function */
const char *name; /* Response tag */
const char *section_tag;
size_t *section_part; /* Section-part */
size_t nset; /* Number of elements in section_part */
int peek;
int not; /* Negate header set */
mu_list_t headers; /* Headers */
size_t start; /* Substr
|