Messages

#include <mailutils/message.h>

int mu_message_aget_attachment_name(mu_message_t msg, char **buf);
int mu_message_clear_modified(mu_message_t msg);
int mu_message_create(mu_message_t msg, void *owner);
inr mu_message_create_attachment(const char *content_type, const char *encoding, const char *filename, mu_message_t *msg);
int mu_message_create_copy(mu_message_t *to, mu_message_t from);
void mu_message_destroy(mu_message_t msg, void *owner);
int mu_message_encapsulate(mu_msg_t msg, mu_msg_t *newmsg, void **data);
int mu_message_get_attachment_name(mu_message_t msg, char *buf, size_t buflen, size_t *sz);
int mu_message_get_attribute(mu_message_t msg, mu_attribute_t *attr);
int mu_message_get_body(mu_message_t msg, mu_body_t *body);
int mu_message_get_envelope(mu_message_t msg, mu_envelope_t *envelope);
int mu_message_get_header(mu_message_t msg, mu_header_t *hdr);
int mu_message_get_mailbox(mu_message_t msg, mu_mailbox_t *mailbox);
int mu_message_get_num_parts(mu_message_t msg, size_t *parts);
int mu_message_get_observable(mu_message_t msg, mu_observable_t *obs);
void* mu_message_get_owner(mu_message_t msg);
int mu_message_get_part(mu_message_t msg, size_t part, mu_message_t *pmsg);
int mu_message_get_qid(mu_message_t msg, mu_message_qid_t *qid);
int mu_message_get_stream(mu_message_t msg, stream_t *pstream);
int mu_message_get_uid(mu_message_t msg, size_t *uid);
int mu_message_get_uidl(mu_message_t msg, char *buffer, size_t buflen, size_t *pwriten);
int mu_message_is_modified(mu_message_t msg);
int mu_message_is_multipart(mu_message_t msg, int *part);
int mu_message_lines(mu_message_t msg, size_t *lines);
int mu_message_ref(mu_message_t msg);
int mu_message_save_attachment(mu_message_t msg, const char *filename,void **data);
int mu_message_set_attribute(mu_message_t msg, mu_attribute_t attr, void *owner);
int mu_message_set_body(mu_message_t msg, mu_body_t body, void *owner);
int mu_message_set_envelope(mu_message_t msg, mu_envelope_t envelope, void *owner);
int mu_message_set_header(mu_message_t msg, mu_header_t hdr, void *owner);
int mu_message_set_mailbox(mu_message_t msg, mu_mailbox_t mailbox, void *owner);
int mu_message_set_stream(mu_message_t msg, stream_t pstream, void *owner);
int mu_message_size(mu_message_t msg, size_t *size);
int mu_message_unencapsulate(mu_msg_t msg, mu_msg_t *newmsg, void **data);
int mu_message_unref(mu_message_t msg);

int mu_stream_to_message(mu_stream_t stream, mu_msg_t *msg);

mu_message_t

typedef _mu_message *mu_message_t

This is an opaque data structure. None of the fields should be accessed by a user program.

mu_message_aget_attachment_name

int mu_message_aget_attachment_name(mu_message_t msg, char **buf);

Returns the attachment name in buf, which should be free'd when no longer required. The function returns 0 if successful or an error code.

mu_message_clear_modified

int mu_message_clear_modified(mu_message_t msg);

Clears the modified flag from the message and its components.

mu_message_create

int mu_message_create(mu_message_t msg, void *owner);

Creates a new message. The function returns 0 if successful or an error code.

mu_message_create_attachment

inr mu_message_create_attachment(const char *content_type, const char *encoding, const char *filename, mu_message_t *msg);

Creates a new message from filename. The routine returns 0 if successful or an error code.

mu_message_create_copy

int mu_message_create_copy(mu_message_t *to, mu_message_t from);

Creates a new message to which is a copy of from. The function returns 0 if successful or an error code.

mu_message_get_attribute

int mu_message_get_attribute(mu_message_t msg, mu_attribute_t *attr);

Returns the messages attributes. The function returns 0 if successful or an error code.

mu_message_get_body

int mu_message_get_body(mu_message_t msg, mu_body_t *body);

Returns the body of the message. The function returns 0 if successful or an error code.

mu_message_destroy

void mu_message_destroy(mu_message_t msg, void *owner);

Releases the resources allocated to the message.

mu_message_encapsulate

int mu_message_encapsulate(mu_msg_t msg, mu_msg_t *newmsg, void **data);

Encapsulates the message msg, storing it in newmsg. The function returns 0 if successful or an error code.

mu_message_get_attachment_name

int mu_message_get_attachment_name(mu_message_t msg, char *buf, size_t buflen, size_t *sz);

Returns the attachment name in buf. The size of the buffer is buflen and the number of characters actually added to the buffer is returned in sz. The function returns 0 if successful or an error code.

mu_message_get_attribute

int mu_message_get_attribute(mu_message_t msg,mu_attribute_t *pattribute);

Returns a pointer to the message attributes in pattribute. The function returns 0 if successful or an error code.

mu_message_get_envelope

int mu_message_get_envelope(mu_message_t msg, mu_envelope_t *envelope);

Returns the message envelope. The function returns 0 if successful or an error code.

mu_message_get_header

int mu_message_get_header(mu_message_t msg, mu_header_t *hdr);

Returns the message header. The function returns 0 if successful or an error code.

mu_message_get_mailbox

int mu_message_get_mailbox(mu_message_t msg, mu_mailbox_t *mailbox);

Returns the mailbox associated with the message. The function returns 0 if successful or an error code.

mu_message_get_num_parts

int mu_message_get_num_parts(mu_message_t msg, size_t *parts);

Returns the number of parts in a multi-part message in parts. The function returns 0 if successful or an error code.

The default function can be overridden using the mu_message_set_get_num_parts function.

int mu_message_set_get_num_parts(mu_message_t msg, int (*get_num_parts)(mu_message)t, size_t*), void *owner);

mu_message_get_observable

int mu_message_get_observable(mu_message_t msg, mu_observable_t *obs);

Returns an observable object which allows events to be trapped. The function returns 0 if successful or an error code.

mu_message_get_owner

void* mu_message_get_owner(mu_message_t msg);

Returns the owner parameter passed to the mu_message_create function.

mu_message_get_part

int mu_message_get_part(mu_message_t msg, size_t part, mu_message_t *pmsg);

Returns in pmsg the part'th item of a multi-part message. The function returns 0 if successful or an error code.

The default function can be overridden by calling the mu_message_set_get_part.

int mu_message_set_get_part(mu_message_t msg, int (*get_part)(mu_message_t,size_t,mu_message_t*);

mu_message_get_qid

int mu_message_get_qid(mu_message_t msg, mu_message_qid_t *qid);

Returns the message qid. The function returns 0 if successful or an error code.

The default function can be overridden by calling the mu_message_set_qid function.

int mu_message_set_qid(mu_message_t msg, int (*get_qid)(mu_message_t,me_message_qid_t*),void *owner);

mu_message_get_stream

int mu_message_get_stream(mu_message_t msg, stream_t *pstream);

Returns a stream which allows access to the message data. The function returns 0 if successful or an error code.

mu_message_get_uid

int mu_message_get_uid(mu_message_t msg, size_t *uid);

Returns the message uid in uid. The function returns 0 if successful or an error code.

The function can be overridden by calling the mu_message_set_uid function.

int mu_message_set_uid(mu_message_t *msg, int (*get_uid)(mu_message_t, size_t*), void *owner);

mu_message_get_uidl

int mu_message_get_uidl(mu_message_t msg, char *buffer, size_t buflen, size_t *pwriten);

Returns the message UIDL in buffer/. The size of the buffer is buflen. The number of characters written into the buffer is pwriten. The function returns 0 if successful or an error code.

The default function can be overridden by calling the mu_message_set_uidl function.

int mu_message_set_uidl(mu_message_t msg, int (*get_uid)(mu_message_t, char *, size_t, size_t*), void *owner);

mu_message_is_modified

int mu_message_is_modified(mu_message_t msg);

Returns TRUE if the message has been modified.

mu_message_is_multipart

int mu_message_is_multipart(mu_message_t msg, int *part);

Returns TRUE in part if the message is a multi-part message.

The default function used to determine if the message is a multi-part message can be overridden using the mu_message_set_is_multipart.

int mu_message_set_is_multipart(mu_message_t msg, int (*is_multipart)(mu_message_t, int*),void *owner);

mu_message_lines

int mu_message_lines(mu_message_t msg, size_t *lines);

Returns the number of lines in the message in lines. The function returns 0 if successful or an error code.

The default function used to determine the number of lines can be overridden using the mu_message_set_lines.

int mu_message_set_lines(mu_message_t msg, int (*lines)(mu_message_t, size_t*),void *owner);

mu_message_ref

int mu_message_ref(mu_message_t msg);

Increases the reference count of the message by 1.

mu_message_save_attachment

int mu_message_save_attachment(mu_message_t msg, const char *filename,void **data);

Extracts and saves the attachment from the message in the file filename. The function returns 0 if successful or an error code.

mu_message_set_attribute

int mu_message_set_attribute(mu_message_t msg, mu_attribute_t attr, void *owner);

Sets the messages attributes. The function returns 0 if successful or an error code.

mu_message_set_body

int mu_message_set_body(mu_message_t msg, mu_body_t body, void *owner);

Sets the body of the message. The function returns 0 if successful or an error code.

mu_message_set_envelope

int mu_message_set_envelope(mu_message_t msg, mu_envelope_t envelope, void *owner);

Sets the message envelope. The function returns 0 if successful or an error code.

mu_message_set_header

int mu_message_set_header(mu_message_t msg, mu_header_t hdr, void *owner);

Sets the message header. The function returns 0 if successful or an error code.

mu_message_set_mailbox

int mu_message_set_mailbox(mu_message_t msg, mu_mailbox_t mailbox, void *owner);

Sets the mailbox associated with the message. The function returns 0 if successful or an error code.

mu_message_set_stream

int mu_message_set_stream(mu_message_t msg, stream_t pstream, void owner);

Sets the stream used to provide message data. The function returns 0 if successful or an error code.

mu_message_size

int mu_message_size(mu_message_t msg, size_t *size);

Returns the size of the message in size. The function returns 0 if successful or an error code.

The default function used to determine the size can be overridden by calling the mu_message_set_size function.

int mu_message_set_size(mu_message_t msg, int (*size)(mu_message_t,size_t*), void *owner);

mu_message_unencapsulate

int mu_message_unencapsulate(mu_msg_t msg, mu_msg_t *newmsg, void **data);

Unencapsulates msg and stores it in newmsg. The function returns 0 if successful or an error code.

mu_message_unref

int mu_message_unref(mu_message_t msg);

Decreases the reference count of the message by 1. If the reference count reaches zero then the message is destroyed.

mu_stream_to_message

int mu_stream_to_message(mu_stream_t stream, mu_msg_t *msg);

Creates a messages with its contents taken from stream. The function returns 0 if successful or an error code.

 
messages.txt · Last modified: 2009/07/10 08:50 by admin
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki