diff options
author | José Fonseca <jrfonseca@users.sourceforge.net> | 2003-07-03 17:37:11 +0000 |
---|---|---|
committer | José Fonseca <jrfonseca@users.sourceforge.net> | 2003-07-03 17:37:11 +0000 |
commit | 2867d16bc9bae9764904efbf44cd5131fca1bc9b (patch) | |
tree | 1e910b1566a40e9b02961bf5aed2958b9fa7b974 /message.h | |
parent | 2b266bab3687c078061c7b8bf3676ef3a61d53a7 (diff) |
Modularization of the code.
Hability to get the recipients from the message headers.
Local delivery via a MDA.
Diffstat (limited to 'message.h')
-rw-r--r-- | message.h | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/message.h b/message.h new file mode 100644 index 0000000..5977be6 --- /dev/null +++ b/message.h @@ -0,0 +1,64 @@ +/** + * \file message.h + * Simple message handling. + * + * \author José Fonseca + */ + +#ifndef _MESSAGE_H +#define _MESSAGE_H + + +#include <libesmtp.h> + +#include "list.h" + + +/** + * Item of the recipient list. + */ +typedef struct { + struct list_head list; + char *address; +} recipient_t; + +/** + * A message. + */ +typedef struct { + char *reverse_path; /**< reverse path for the mail envelope */ + struct list_head remote_recipients; /**< remote recipients */ + struct list_head local_recipients; /**< local recipients */ + + enum notify_flags notify; /**< libESMTP notificiation flags */ + + /** \name buffering */ + /*@{*/ + char *buffer; + size_t buffer_size; + size_t buffer_start, buffer_stop; + int buffer_r; /**< whether the last character was a '\r' */ + /*@}*/ + + FILE *fp; /**< message file pointer */ +} message_t; + +/** Create a new message. */ +message_t *message_new(void); + +/** Free the resources associated with a message. */ +void message_free(message_t *m); + +int message_set_reverse_path(message_t *message, const char *address); + +int message_add_recipient(message_t *message, const char *address); + +int message_parse_headers(message_t *message); + +size_t message_read(message_t *message, char *ptr, size_t size); + +void message_rewind(message_t *message); + +int message_eof(message_t *message); + +#endif |