headers.texi 5.98 KB
@c This is part of the GNU Mailutils manual.
@c Copyright (C) 1999-2004, 2006-2007, 2010-2012, 2014 Free Software
@c Foundation, Inc.
@c See file mailutils.texi for copying conditions.
@comment *******************************************************************

@smallexample
@code{/* Prefix @emph{mu_header_} is reserved. */}
@code{#include <mailutils/header.h>}

@end smallexample

So far we plan support for RFC822 and plan for RFC1522. With RFC1522 non-ASCII
characters will be encoded.

@deftypefun  int mu_header_create (mu_header_t *@var{hdr}, const char *@var{blurb}, size_t @var{len}, void *@var{owner})
Initialize a @var{hdr} to a supported type. If @var{blurb} is not @code{NULL},
it is parsed.
@end deftypefun

@deftypefun void mu_header_destroy (mu_header_t *@var{hdr}, void *@var{owner})
The resources allocated for @var{hdr} are freed.
@end deftypefun

@deftypefun void* mu_header_get_owner (mu_header_t *@var{hdr})
@end deftypefun

@deftypefun  int mu_header_is_modified (mu_header_t @var{hdr})
@end deftypefun

@deftypefun  int mu_header_clear_modified (mu_header_t @var{hdr})
@end deftypefun

@c
@c Set and get field values by field name.
@c

@deftypefun  int mu_header_set_value (mu_header_t @var{hdr}, const char *@var{fn}, const char *@var{fv}, int @var{n})

Some basic macros are already provided for RFC822.

@table @code
@item MU_HEADER_UNIX_FROM
From
@item MU_HEADER_RETURN_PATH
Return-Path
@item MU_HEADER_RECEIVED
Received
@item MU_HEADER_DATE
Date
@item MU_HEADER_FROM
From
@item MU_HEADER_SENDER
Sender
@item MU_HEADER_RESENT_FROM
Resent-From
@item MU_HEADER_SUBJECT
Subject
@item MU_HEADER_SENDER
Sender
@item MU_HEADER_RESENT_SENDER
Resent-SENDER
@item MU_HEADER_TO
To
@item MU_HEADER_RESENT_TO
Resent-To
@item MU_HEADER_CC
Cc
@item MU_HEADER_RESENT_CC
Resent-Cc
@item MU_HEADER_BCC
Bcc
@item MU_HEADER_RESENT_BCC
Resent-Bcc
@item MU_HEADER_REPLY_TO
Reply-To
@item MU_HEADER_RESENT_REPLY_TO
Resent-Reply-To
@item MU_HEADER_MESSAGE_ID
Message-ID
@item MU_HEADER_RESENT_MESSAGE_ID
Resent-Message-ID
@item MU_HEADER_IN_REPLY_TO
In-Reply-To
@item MU_HEADER_REFERENCE
Reference
@item MU_HEADER_REFERENCES
References
@item MU_HEADER_ENCRYPTED
Encrypted
@item MU_HEADER_PRECEDENCE
Precedence
@item MU_HEADER_STATUS
Status
@item MU_HEADER_CONTENT_LENGTH
Content-Length
@item MU_HEADER_CONTENT_LANGUAGE
Content-Language
@item MU_HEADER_CONTENT_TRANSFER_ENCODING
Content-transfer-encoding
@item MU_HEADER_CONTENT_ID
Content-ID
@item MU_HEADER_CONTENT_TYPE
Content-Type
@item MU_HEADER_CONTENT_DESCRIPTION
Content-Description
@item MU_HEADER_CONTENT_DISPOSITION
Content-Disposition
@item MU_HEADER_CONTENT_MD5
Content-MD5
@item MU_HEADER_MIME_VERSION
MIME-Version
@item MU_HEADER_X_UIDL
X-UIDL
@item MU_HEADER_X_UID
X-UID
@item MU_HEADER_X_IMAPBASE
X-IMAPbase
@item MU_HEADER_ENV_SENDER
X-Envelope-Sender
@item MU_HEADER_ENV_DATE
X-Envelope-Date
@item MU_HEADER_FCC
Fcc
@item MU_HEADER_DELIVERY_DATE
Delivery-date
@item MU_HEADER_ENVELOPE_TO
Envelope-to
@end table
@end deftypefun

@deftypefun  int mu_header_get_value (mu_header_t @var{hdr}, const char *@var{fn}, char *@var{fv}, size_t @var{len}, size_t *@var{n})
Value of field-name @var{fn} is returned in buffer @var{fv} of size @var{len}.
The number of bytes written is put in @var{n}.
@end deftypefun

@deftypefun  int mu_header_aget_value (mu_header_t @var{hdr}, const char *@var{fn}, char **@var{fv})
The value is allocated.
@end deftypefun

@c
@c Get field values as an address_t.
@c 

@deftypefun  int mu_header_get_address (mu_header_t @var{hdr}, const char *@var{buf}, address_t *@var{addr})
@end deftypefun

@c
@c Stream
@c

@deftypefun  int mu_header_get_stream (mu_header_t @var{hdr}, stream_t *@var{stream})
@end deftypefun

@deftypefun  int mu_header_set_stream (mu_header_t @var{hdr}, stream_t @var{stream}, void *)
@end deftypefun

@c
@c
@c

@deftypefun  int mu_header_get_field_count (mu_header_t @var{hdr}, size_t *@var{count})
@end deftypefun

@deftypefun  int mu_header_get_field_value (mu_header_t @var{hdr}, size_t @var{index}, char *, size_t, size_t *)
@end deftypefun

@deftypefun  int mu_header_get_field_name (mu_header_t @var{hdr}, size_t @var{index}, char *, size_t, size_t *)
@end deftypefun

@deftypefun  int mu_header_aget_field_value (mu_header_t @var{hdr}, size_t @var{index}, char **)
@end deftypefun

@deftypefun  int mu_header_aget_field_name (mu_header_t @var{hdr}, size_t @var{index}, char **)
@end deftypefun

@deftypefun  int mu_header_get_value_unfold (mu_header_t @var{hdr}, const char *@var{name}, char *@var{buffer}, size_t @var{buflen}, size_t *@var{n})
@end deftypefun

@deftypefun  int mu_header_aget_value_unfold (mu_header_t @var{hdr}, const char *@var{name}, char **@var{value})
@end deftypefun

@deftypefun  int mu_header_get_field_value_unfold (mu_header_t @var{hdr}, size_t @var{num}, char *@var{buf}, size_t @var{buflen}, size_t *@var{nwritten})
@end deftypefun

@deftypefun  int mu_header_aget_field_value_unfold (mu_header_t @var{hdr}, size_t @var{num}, char **@var{value});
@end deftypefun

@deftypefun  int mu_header_size (mu_header_t @var{hdr}, size_t *);
@end deftypefun

@deftypefun  int mu_header_lines (mu_header_t @var{hdr}, size_t *);
@end deftypefun

@deftypefun  int mu_header_set_set_value (mu_header_t @var{hdr}, int (*@var{_set_value}) (mu_header_t, const char *, const char *, int), void *);
@end deftypefun

@deftypefun  int mu_header_set_get_value (mu_header_t @var{hdr}, int (*@var{_get_value}) (mu_header_t, const char *, char *, size_t, size_t *), void *);
@end deftypefun

@deftypefun  int mu_header_set_get_fvalue (mu_header_t @var{hdr}, int (*@var{_get_value}) (mu_header_t, const char *, char *, size_t, size_t *), void *);
@end deftypefun

@deftypefun  int mu_header_set_size (mu_header_t @var{hdr}, int (*@var{_size}) (mu_header_t, size_t *), void *);
@end deftypefun

@deftypefun  int mu_header_set_lines (mu_header_t @var{hdr}, int (*@var{_lines}) (mu_header_t, size_t *), void *);
@end deftypefun

@deftypefun  int mu_header_set_fill (mu_header_t @var{hdr}, int (*@var{_fill}) (mu_header_t, char *, size_t, mu_off_t, size_t *), void *@var{owner});
@end deftypefun