Nico Golde:
[apps/madmutt.git] / rfc822.h
1 /*
2  * Copyright (C) 1996-2000 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., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
17  */ 
18
19 #ifndef rfc822_h
20 #define rfc822_h
21
22 /* possible values for RFC822Error */
23 enum
24 {
25   ERR_MEMORY = 1,
26   ERR_MISMATCH_PAREN,
27   ERR_MISMATCH_QUOTE,
28   ERR_BAD_ROUTE,
29   ERR_BAD_ROUTE_ADDR,
30   ERR_BAD_ADDR_SPEC
31 };
32
33 typedef struct address_t
34 {
35 #ifdef EXACT_ADDRESS
36   char *val;            /* value of address as parsed */
37 #endif
38   char *personal;       /* real name of address */
39   char *mailbox;        /* mailbox and host address */
40   int group;            /* group mailbox? */
41   struct address_t *next;
42 }
43 ADDRESS;
44
45 void rfc822_free_address (ADDRESS **);
46 void rfc822_qualify (ADDRESS *, const char *);
47 ADDRESS *rfc822_parse_adrlist (ADDRESS *, const char *s);
48 ADDRESS *rfc822_cpy_adr (ADDRESS *addr);
49 ADDRESS *rfc822_cpy_adr_real (ADDRESS *addr);
50 ADDRESS *rfc822_append (ADDRESS **a, ADDRESS *b);
51 void rfc822_write_address (char *, size_t, ADDRESS *, int);
52 void rfc822_write_address_single (char *, size_t, ADDRESS *, int);
53 void rfc822_free_address (ADDRESS **addr);
54 void rfc822_cat (char *, size_t, const char *, const char *);
55
56 extern int RFC822Error;
57 extern const char *RFC822Errors[];
58
59 #define rfc822_error(x) RFC822Errors[x]
60 #define rfc822_new_address() calloc(1,sizeof(ADDRESS))
61
62 #endif /* rfc822_h */