message.texi 4.26 KB
@code{#include <mailutils/message.h>}

The @code{message_t} object is a convenient way to manipulate messages.  It
encapsulates the @code{header_t}, the @code{attribute_t} and the @code{body_t}.

@example
@group
    __________                   message_t
   (message[1])        +------>+-----------------------+
    ----------         |       |  header_t             |
   (message[2])        |       |-----------------------|
    ----------         |       |  attribute_t          |
   (message[3])--------+       |-----------------------|
    ----------                 |  stream_t             |
   (message[n])                |-----------------------|
    ----------                 |  body_t               |
                               |-----------------------|
                               |  from                 |
                               |-----------------------|
                               |  size                 |
                               |-----------------------|
                               |  uidl                 |
                               +-----------------------+
@end group
@end example

@deftypefun void message_create (message_t *@var{msg}, void *@var{owner})
@end deftypefun

@deftypefun void message_destroy (message_t *@var{msg}, void *@var{owner})
The resources allocate for @var{msg} are freed.
@end deftypefun

@deftypefun int message_get_header (message_t @var{msg}, header_t *@var{pheader})
Retrieve @var{msg} header.
@end deftypefun

@deftypefun int message_set_header (message_t @var{msg}, header_t @var{header}, void *@var{owner})
@end deftypefun

@deftypefun int message_get_body (message_t @var{msg}, body_t *@var{pbody})
@end deftypefun

@deftypefun int message_set_body (message_t @var{msg}, body_t @var{body}, void *@var{owner})
@end deftypefun

@deftypefun int message_is_multipart (message_t @var{msg})
Return non-zero value if message is multi-part.
@end deftypefun

@deftypefun int message_get_num_parts (message_t @var{msg}, size_t *nparts)
@end deftypefun

@deftypefun int message_set_get_num_parts (message_t @var{msg}, size_t *nparts)
@end deftypefun

@deftypefun int message_get_part (message_t @var{msg}, size_t part, message_t *msg)
@end deftypefun

@deftypefun int message_set_get_part ((message_t @var{msg}, size_t part, message_t *msg)
@end deftypefun

@deftypefun int message_add_part (message_t @var{msg}, message_t  @var{msg})
@end deftypefun

@deftypefun int message_set_add_part (message_t @var{msg}, message_t  @var{msg})
@end deftypefun

@deftypefun int message_get_stream (message_t @var{msg}, stream_t *@var{pstream})
@end deftypefun

@deftypefun int message_set_stream (message_t @var{msg}, stream_t @var{stream},void *@var{owner} )
@end deftypefun

@deftypefun int message_get_attribute (message_t @var{msg}, attribute_t *@var{pattribute})
@end deftypefun

@deftypefun int message_set_attribute (message_t @var{msg}, attribute_t @var{attribute}, void *owner)
@end deftypefun

@deftypefun int message_get_from (message_t @var{msg}, char *buffer, size_t len, size_t *n)
@end deftypefun

@deftypefun int message_set_from (message_t @var{msg}, int (*@var{_from}) (message_t, char *, size_t, size_t *), void *@var{owner})
@end deftypefun

@deftypefun int message_get_uidl (message_t @var{msg}, char *@var{buffer}, size_t @var{buflen}, size_t *@var{pwriten})
@end deftypefun

@deftypefun int message_set_uidl (message_t @var{msg}, int (*@var{_get_uidl})(message_t, char *, size_t, size_t *), void *@var{owner})
@end deftypefun

@deftypefun int message_register (message_t @var{msg}, size_t @var{type}, int (*@var{action}) (size_t, void *), void *@var{arg})
@table @code
@item MU_EVT_MSG_DESTROY
Message destruction.
@end table
@end deftypefun

@deftypefun int message_deregister (message_t @var{msg}, void *@var{action})
@end deftypefun

@deftypefun int message_create_attachment (const char *@var{content_type}, const char *@var{encoding}, const char *@var{filename}, message_t *@var{newmsg})
@end deftypefun

@deftypefun int message_save_attachment (message_t @var{msg}, const char *@var{filename}, void **@var{data})
@end deftypefun

@deftypefun int message_encapsulate (message_t @var{msg}, message_t *@var{newmsg}, void **@var{data})
@end deftypefun

@deftypefun int message_unencapsulate (message_t @var{msg}, message_t *@var{newmsg}, void **@var{data});
@end deftypefun