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