Mailboxes

#include <mailutils/mailbox.h>

const char* mu_folder_directory(void);

int mu_mailbox_append_message(mu_mailbox_t mbox, mu_message_t msg);
int mu_mailbox_close(mu_mailbox_t mbox);
int mu_mailbox_create(mu_mailbox_t *mbox, const char *name);
int mu_mailbox_create_default(mu_mailbox_t *mbox, const char *name);
int mu_mailbox_create_from_url(mu_mailbox_t *mbox, mu_url_t name);
void mu_mailbox_destroy(mu_mailbox_t *mbox);
int mu_mailbox_expunge(mu_mailbox_t mbox);
void mu_mailbox_flush(mu_mailbox_t mbox,int expunge);
int mu_mailbox_get_debug(mu_mailbox_t mbox, mu_debug_t *debug);
int mu_mailbox_get_flags(mu_mailbox_t mbox, int *flags);
int mu_mailbox_get_folder(mu_mailbox_t mbox,mu_folder_t *folder);
int mu_mailbox_get_message(mu_mailbox_t mbox, size_t msgno, mu_message_t *msg);
int mu_mailbox_get_locker(mu_mailbox_t mbox, mu_locker_t *locker);
int mu_mailbox_get_observable(mu_mailbox_t mbox, mu_observable_t *obs);
int mu_mailbox_get_property(mu_mailbox_t mbox, mu_property_t *prop);
int mu_mailbox_get_size(mu_mailbox_t mbox,mu_off_t *size);
int mu_mailbox_get_stream(mu_mailbox_t mbox, mu_stream_t *stream);
int mu_mailbox_get_url(mu_mailbox_t mbox, mu_url_t *url);
int mu_mailbox_has_debug(mu_mailbox_t mbox);
int mu_mailbox_is_updated(mu_mailbox_t mbox);
int mu_mailbox_lock(mu_mailbox_t mbox);
int mu_mailbox_message_unseen(mu_mailbox_t mbox, size_t *count);
int mu_mailbox_messages_count(mu_mailbox_t mbox, size_t *count);
int mu_mailbox_messages_recent(mu_mailbox_t mbox, size_t *count);
int mu_mailbox_open(mu_mailbox_t mbox, int flag);
int mu_mailbox_quick_get_message(mu_mailbox_t mbox, mu_message_qid_t qid, mu_message_t *msg);
int mu_mailbox_scan(mu_mailbox_t mbox, size_t no, size_t *count);
int mu_mailbox_set_debug(mu_mailbox_t mbox, mu_debug_t debug);
int mu_mailbox_set_folder(mu_mailbox_t mbox,mu_folder_t folder);
int mu_mailbox_set_locker(mu_mailbox_t mbox, mu_locker_t locker);
int mu_mailbox_set_stream(mu_mailbox_t mbox, mu_stream_t stream);
int mu_mailbox_sync(mu_mailbox_t mbox);
int mu_mailbox_uidnext(mu_mailbox_t mbox, size_t uid);
int mu_mailbox_uidvalidity(mu_mailbox_t mbox, unsigned long * uidval);
int mu_mailbox_unlock(mu_mailbox_t mbox);
const char* mu_mailbox_url(void);

void mu_set_folder_directory(const char *p);
int mu_set_mail_directory(const char *p);
int mu_set_mailbox_pattern(const char *p);

mu_mailbox_t

typedef struct _mu_mailbox  *mu_mailbox_t

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

mu_folder_directory

const char* mu_folder_directory(void);

This returns the current mail folder directory. It is a path relative to the user's HOME directory.

mu_mailbox_append_message

int mu_mailbox_append_message(mu_mailbox_t mbox, mu_message_t msg);

Appends the message msg to the mailbox. The function returns 0 if successful or an error code.

mu_mailbox_close

int mu_mailbox_close(mu_mailbox_t *mbox);

Closes the mailbox. The function returns 0 if successful or an error code.

mu_mailbox_create

int mu_mailbox_create(mu_mailbox_t *mbox, const char *name);

Creates a new mailbox based on name. The function returns 0 if successful or an error code.

mu_mailbox_create_default

int mu_mailbox_create_default(mu_mailbox_t *mbox, const char *name);

Creates a new mailbox based on the pattern passed in name, which can be:

  • % the default mailbox for the current user
  • %user the default mailbox for user
  • ~/file file in the current user's home directory
  • ~user/file file in the user's home directory
  • +file file in the default folder directory
  • =file file in the default folder directory
  • /file the absolute path to file
  • url the url identifying the mailbox
  • anything else, a file relative to the current working directory

If name is NULL, then the mailbox will be created on the basis of the pattern set by the most recent call to mu_set_mailbox_pattern. If this is NULL, then the patterns set in the FOLDER or MAIL environment variables are used instead. If none of these are defined then the system defined default values are used.

The function returns 0 if successful or an error code.

mu_mailbox_create_from_url

int mu_mailbox_create_from_url(mu_mailbox_t *mbox, mu_url_t name);

Creates a new mailbox based on the mu_url_t structure, name. The function returns 0 if successful or an error code.

mu_mailbox_destroy

void mu_mailbox_destroy(mu_mailbox_t *mbox);

Releases all the resources allocated to the mailbox.

NB this will also destroy any stream set with mu_mailbox_set_stream.

mu_mailbox_expunge

int mu_mailbox_expunge(mu_mailbox_t mbox);

This routine removes messages tagged for deletion from the mailbox. The function returns 0 if successful or an error code.

mu_mailbox_flush

void mu_mailbox_flush(mu_mailbox_t mbox,int expunge);

This function refreshes the physical mailbox associated with the mbox object. If expunge is non zero then any deleted messages are removed by this function.

mu_mailbox_get_debug

int mu_mailbox_get_debug(mu_mailbox_t mbox, mu_debug_t *debug);

Returns the debug object related to the mailbox. The function returns 0 if successful or an error code.

mu_mailbox_get_flags

int mu_mailbox_get_flags(mu_mailbox_t mbox, int *flags);

Returns the flags set when the mailbox was opened in flags. The function returns 0 of successful or an error code.

mu_mailbox_get_folder

int mu_mailbox_get_folder(mu_mailbox_t mbox,mu_folder_t *folder);

This function returns information about the folder holding the mailbox in the folder argument. The function returns 0 if successful or an error code.

mu_mailbox_get_locker

int mu_mailbox_get_locker(mu_mailbox_t mbox, mu_locker_t *locker);

This function returns the locker object used to lock the mailboxes. The function returns 0 if successful or an error code.

mu_mailbox_get_message

int mu_mailbox_get_message(mu_mailbox_t mbox, size_t msgno, mu_message_t *msg);

Returns the msgno'th message in the mailbox in msg. Messages are numbered starting at 1. The function returns 0 if successful or an error code.

mu_mailbox_get_observable

int mu_mailbox_get_observable(mu_mailbox_t mbox, mu_observable_t *obs);

Returns the mu_observable_t object which is associated with the mailbox. This is used to associate events with actions. The function returns 0 if successful or an error code.

mu_mailbox_get_property

int mu_mailbox_get_property(mu_mailbox_t mbox, mu_property_t *prop);

This function returns a pointer to the mailbox's property object. The function returns 0 if successful or an error code.

mu_mailbox_get_size

int mu_mailbox_get_size(mu_mailbox_t mbox,mu_off_t *size);

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

mu_mailbox_get_stream

int mu_mailbox_get_stream(mu_mailbox_t mbox, mu_stream_t *stream);

Returns in stream the current input stream. This stream is owned by the mailbox and should not be closed or destroyed. The function returns 0 if successful or an error code.

mu_mailbox_get_url

int mu_mailbox_get_url(mu_mailbox_t mbox, mu_url_t *url);

Returns the URL of the mailbox. The function returns 0 if successful or an error code.

mu_mailbox_has_debug

int mu_mailbox_has_debug(mu_mailbox_t mbox);

Returns TRUE if the mailbox debug object has been instantiated.

mu_mailbox_is_updated

int mu_mailbox_is_updated(mu_mailbox_t mbox);

Returns 0 if the mailbox has been updated or 1 if it has not been.

mu_mailbox_lock

int mu_mailbox_lock(mu_mailbox_t mbox);

Locks the mailbox. Returns 0 if successful or an error code.

mu_mailbox_message_unseen

int mu_mailbox_messages_unseen(mu_mailbox_t mbox, size_t *count);

Returns the number of unseen messages in the mailbox in count. The function returns 0 if successful or an error code.

mu_mailbox_messages_count

int mu_mailbox_messages_count(mu_mailbox_t mbox, size_t *count);

Returns the number of messages in the mailbox in count. The function returns 0 if successful or an error code.

mu_mailbox_messages_recent

int mu_mailbox_messages_recent(mu_mailbox_t mbox, size_t *count);

Returns the number of recent messages in the mailbox in count. The function returns 0 if successful or an error code.

mu_mailbox_open

int mu_mailbox_open(mu_mailbox_t mbox, int flag);

Opens the mailbox for the operations defined in flag. flag can be any of the flags specified in Streams. The function returns 0 if successful or an error code.

mu_mailbox_quick_get_message

int mu_mailbox_quick_get_message(mu_mailbox_t mbox, mu_message_qid_t qid, mu_message_t *msg);

Returns the message identified by the qid argument. In order for this function to work, the mailbox must have been opened with the MU_STREAM_QACCESS flag. The function returns 0 if successful or an error code.

mu_mailbox_scan

int mu_mailbox_scan(mu_mailbox_t mbox, size_t no, size_t *count);

Scans the mailbox starting at message no looking for new messages, triggering events if necessary. The actual number of messages found is returned in count. The function returns 0 if successful or an error code.

mu_mailbox_set_debug

int mu_mailbox_set_debug(mu_mailbox_t mbox, mu_debug_t debug);

Sets the debug object to the one passed in debug. The function returns 0 if successful or an error code.

mu_mailbox_set_folder

int mu_mailbox_set_folder(mu_mailbox_t mbox,mu_folder_t folder);

This function sets the current folder where the mailbox resides. The function returns 0 if successful or an error code.

mu_mailbox_set_locker

int mu_mailbox_set_locker(mu_mailbox_t mbox, mu_locker_t locker);

This function replaces the default locker object for the mailbox with locker. The function returns 0 if successful or an error code.

mu_mailbox_set_stream

int mu_mailbox_set_stream(mu_mailbox_t mbox, mu_stream_t stream);

Sets the input stream for the mailbox. The function returns 0 if successful or an error code.

mu_mailbox_sync

int mu_mailbox_sync(mu_mailbox_t mbox);

This function commits changes to the mailbox without removing deleted messages. The function returns 0 if successful or an error code.

mu_mailbox_uidnext

int mu_mailbox_uidnext(mu_mailbox_t mbox, size_t *uid);

This functions returns the next uid for messages in the mailbox. The function returns 0 if successful or an error code.

mu_mailbox_uidvalidity

int mu_mailbox_uidvalidity(mu_mailbox_t mbox, unsigned long * uidval);

The mailbox handling routines cache the next uid value available for messages. This function returns in uidval the time (as a time_t) that this value was last cached. The function returns 0 if successful or an error code.

mu_mailbox_unlock

int mu_mailbox_unlock(mu_mailbox_t mbox);

Unlocks the mailbox. Returns 0 if successful or an error code.

mu_mailbox_url

const char* mu_mailbox_url(void);

This returns the pattern used to create system default mailboxes.

mu_set_folder_directory

void mu_set_folder_directory(const char *p);

This sets the default folder directory. The path refers to a directory within the users HOME directory.

mu_set_mail_directory

int mu_set_mail_directory(const char *p);

This sets the default mail spool directory. This function returns 0 if successful or an error code.

mu_set_mailbox_pattern

int mu_set_mailbox_pattern(const char *p);

This sets the default pattern used to create mailboxes if the NULL is passed to the mu_mailbox_create_default routine. The function returns 0 if successful or an error code.

 
mailboxes.txt · Last modified: 2009/06/28 16:53 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