]>
diplodocus.org Git - nmh/blob - h/addrsbr.h
1 /* addrsbr.h -- definitions for the address parsing system
10 * The email structure used by nmh to define an email address
14 struct mailname
*m_next
; /* Linked list linkage; available for */
16 char *m_text
; /* Full unparsed text of email address */
17 char *m_pers
; /* display-name in RFC 5322 parlance */
18 char *m_mbox
; /* local-part in RFC 5322 parlance */
19 char *m_host
; /* domain in RFC 5322 parlance */
20 char *m_path
; /* Host routing; should not be used */
21 int m_type
; /* UUCPHOST, LOCALHOST, NETHOST, or BADHOST */
22 char m_nohost
; /* True if no host part available */
23 char m_bcc
; /* Used by post to keep track of bcc's */
24 int m_ingrp
; /* True if email address is in a group */
25 char *m_gname
; /* display-name of group */
26 char *m_note
; /* Note (post-address comment) */
30 * See notes for auxformat() below.
33 #define adrformat(m) auxformat ((m), 1)
38 void mnfree(struct mailname
*);
39 int ismymbox(struct mailname
*);
42 * Enable Email Address Internationalization, which requires
43 * support of 8-bit addresses.
45 void enable_eai(void);
48 * Parse an address header, and return a sequence of email addresses.
49 * This function is the main entry point into the nmh address parser.
50 * It is used in conjunction with getm() to parse an email header.
54 * header - Pointer to the start of an email header.
56 * On the first call, header is copied and saved internally. Each email
57 * address in the header is returned on the first and subsequent calls
58 * to getname(). When there are no more email addresses available in
59 * the header, NULL is returned and the parser's internal state is
63 char *getname(const char *header
);
66 * Format an email address given a struct mailname.
68 * This function takes a pointer to a struct mailname and returns a pointer
69 * to a static buffer holding the resulting email address.
71 * It is worth noting that group names are NOT handled, so if you want to
72 * do something with groups you need to handle it externally to this function.
76 * mp - Pointer to mailname structure
77 * extras - If true, include the personal name and/or note in the
78 * address. Otherwise, omit it.
81 char *auxformat(struct mailname
*mp
, int extras
);
84 * Parse an email address into it's components.
86 * Used in conjunction with getname() to parse a complete email header.
90 * str - Email address being parsed.
91 * dfhost - A default host to append to the email address if
92 * one is not included. If NULL, use nmh's idea of
94 * dftype - If dfhost is given, use dftype as the email address type
95 * if no host is in the email address.
96 * eresult - A buffer containing an error message returned by the
97 * address parser. May be NULL.
98 * eresultsize - The size of the buffer passed in eresult.
100 * A pointer to an allocated struct mailname corresponding to the email
101 * address is returned.
103 * This function used to have an argument called 'wanthost' which would
104 * control whether or not it would canonicalize hostnames in email
105 * addresses. This functionality was removed for nmh 1.5, and eventually
106 * all of the code that used this argument was garbage collected.
108 struct mailname
*getm(char *str
, char *dfhost
, int dftype
, char *eresult
,