jaromail

a commandline tool to easily and privately handle your e-mail
git clone git://parazyd.org/jaromail.git
Log | Files | Refs | Submodules | README

rfc822.h (2037B)


      1 /*
      2  * Copyright (C) 1996-8 Michael R. Elkins <me@cs.hmc.edu>
      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 Foundation,
     16  *     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301,, USA.
     17  */ 
     18 
     19 /* $Id: rfc822.h,v 1.3 2005-10-29 14:48:11 roland Exp $ */
     20 
     21 #ifndef rfc822_h
     22 #define rfc822_h
     23 
     24 /* possible values for RFC822Error */
     25 enum
     26 {
     27   ERR_MEMORY = 1,
     28   ERR_MISMATCH_PAREN,
     29   ERR_MISMATCH_QUOTE,
     30   ERR_BAD_ROUTE,
     31   ERR_BAD_ROUTE_ADDR,
     32   ERR_BAD_ADDR_SPEC
     33 };
     34 
     35 typedef struct address_t
     36 {
     37 #ifdef EXACT_ADDRESS
     38   char *val;		/* value of address as parsed */
     39 #endif
     40   char *personal;	/* real name of address */
     41   char *mailbox;	/* mailbox and host address */
     42   int group;		/* group mailbox? */
     43   struct address_t *next;
     44 }
     45 ADDRESS;
     46 
     47 void rfc822_free_address (ADDRESS **);
     48 void rfc822_qualify (ADDRESS *, const char *);
     49 ADDRESS *rfc822_parse_adrlist (ADDRESS *, const char *s);
     50 ADDRESS *rfc822_cpy_adr (ADDRESS *addr);
     51 ADDRESS *rfc822_cpy_adr_real (ADDRESS *addr);
     52 ADDRESS *rfc822_append (ADDRESS **a, ADDRESS *b);
     53 void rfc822_write_address (char *, size_t, ADDRESS *);
     54 void rfc822_write_list (char *, size_t, ADDRESS *);
     55 void rfc822_free_address (ADDRESS **addr);
     56 void rfc822_cat (char *, size_t, const char *, const char *);
     57 
     58 extern int RFC822Error;
     59 extern const char *RFC822Errors[];
     60 
     61 #define rfc822_error(x) RFC822Errors[x]
     62 #define rfc822_new_address() calloc(1,sizeof(ADDRESS))
     63 
     64 #endif /* rfc822_h */