mutt stable branch with some hacks
1/*
2 * Copyright (C) 1996-2000 Michael R. Elkins <me@mutt.org>
3 * Copyright (C) 2012 Michael R. Elkins <me@mutt.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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 */
19
20#ifndef rfc822_h
21#define rfc822_h
22
23#include "lib.h"
24
25/* possible values for RFC822Error */
26enum
27{
28 ERR_MEMORY = 1,
29 ERR_MISMATCH_PAREN,
30 ERR_MISMATCH_QUOTE,
31 ERR_BAD_ROUTE,
32 ERR_BAD_ROUTE_ADDR,
33 ERR_BAD_ADDR_SPEC
34};
35
36typedef struct address_t
37{
38#ifdef EXACT_ADDRESS
39 char *val; /* value of address as parsed */
40#endif
41 char *personal; /* real name of address */
42 char *mailbox; /* mailbox and host address */
43 int group; /* group mailbox? */
44 struct address_t *next;
45 unsigned is_intl : 1;
46 unsigned intl_checked : 1;
47}
48ADDRESS;
49
50void rfc822_dequote_comment (char *s);
51void rfc822_free_address (ADDRESS **);
52void rfc822_qualify (ADDRESS *, const char *);
53ADDRESS *rfc822_parse_adrlist (ADDRESS *, const char *s);
54ADDRESS *rfc822_cpy_adr (ADDRESS *addr, int);
55ADDRESS *rfc822_cpy_adr_real (ADDRESS *addr);
56ADDRESS *rfc822_append (ADDRESS **a, ADDRESS *b, int);
57int rfc822_write_address (char *, size_t, ADDRESS *, int);
58void rfc822_write_address_single (char *, size_t, ADDRESS *, int);
59void rfc822_free_address (ADDRESS **addr);
60void rfc822_cat (char *, size_t, const char *, const char *);
61int rfc822_valid_msgid (const char *msgid);
62int rfc822_remove_from_adrlist (ADDRESS **a, const char *mailbox);
63
64extern int RFC822Error;
65extern const char * const RFC822Errors[];
66
67#define rfc822_error(x) RFC822Errors[x]
68#define rfc822_new_address() safe_calloc(1,sizeof(ADDRESS))
69
70#endif /* rfc822_h */