]>
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 * Parse an address header, and return a sequence of email addresses.
45 * This function is the main entry point into the nmh address parser.
46 * It is used in conjunction with getm() to parse an email header.
50 * header - Pointer to the start of an email header.
52 * On the first call, header is copied and saved internally. Each email
53 * address in the header is returned on the first and subsequent calls
54 * to getname(). When there are no more email addresses available in
55 * the header, NULL is returned and the parser's internal state is
59 char *getname(const char *header
);
62 * Format an email address given a struct mailname.
64 * This function takes a pointer to a struct mailname and returns a pointer
65 * to a static buffer holding the resulting email address.
67 * It is worth noting that group names are NOT handled, so if you want to
68 * do something with groups you need to handle it externally to this function.
72 * mp - Pointer to mailname structure
73 * extras - If true, include the personal name and/or note in the
74 * address. Otherwise, omit it.
77 char *auxformat(struct mailname
*mp
, int extras
);
80 * Parse an email address into it's components.
82 * Used in conjunction with getname() to parse a complete email header.
86 * str - Email address being parsed.
87 * dfhost - A default host to append to the email address if
88 * one is not included. If NULL, use nmh's idea of
90 * dftype - If dfhost is given, use dftype as the email address type
91 * if no host is in the email address.
92 * eresult - A buffer containing an error message returned by the
93 * address parser. May be NULL.
94 * eresultsize - The size of the buffer passed in eresult.
96 * A pointer to an allocated struct mailname corresponding to the email
97 * address is returned.
99 * This function used to have an argument called 'wanthost' which would
100 * control whether or not it would canonicalize hostnames in email
101 * addresses. This functionalit was removed for nmh 1.5, and eventually
102 * all of the code that used this argument was garbage collected.
104 struct mailname
*getm(char *str
, char *dfhost
, int dftype
, char *eresult
,