Commit 898646b3 898646b30781ff92f3be33ed9dca9570e20332f4 by Alain Magloire

Put our first attempt at property.

1 parent 073f0ff7
......@@ -20,6 +20,7 @@
#include <sys/types.h>
#include <mailutils/stream.h>
#include <mailutils/property.h>
#ifndef __P
#ifdef __STDC__
......@@ -76,11 +77,14 @@ typedef struct _header * header_t;
extern int header_create __P ((header_t *, const char *,
size_t, void *));
extern void header_destroy __P ((header_t *, void *));
extern void * header_get_owner __P ((header_t));
extern void *header_get_owner __P ((header_t));
extern int header_is_modified __P ((header_t));
extern int header_clear_modified __P ((header_t));
extern int header_get_property __P ((header_t, property_t *));
extern int header_set_property __P ((header_t, property_t, void *));
extern int header_set_value __P ((header_t, const char *,
const char *, int));
extern int header_set_set_value __P ((header_t, int (*_set_value)
......
......@@ -19,11 +19,13 @@
#define _MAILUTILS_MAILER_H
#include <sys/types.h>
#include <mailutils/stream.h>
#include <mailutils/observer.h>
#include <mailutils/debug.h>
#include <mailutils/url.h>
#include <mailutils/message.h>
#include <mailutils/property.h>
#ifndef __P
# ifdef __STDC__
......@@ -48,6 +50,8 @@ extern int mailer_open __P ((mailer_t, int flags));
extern int mailer_close __P ((mailer_t));
extern int mailer_send_message __P ((mailer_t, message_t));
extern int mailer_get_property __P ((mailer_t, property_t *));
/* stream settings */
extern int mailer_get_stream __P ((mailer_t, stream_t *));
extern int mailer_set_stream __P ((mailer_t, stream_t));
......
......@@ -19,6 +19,7 @@
#define _MAILUTILS_PROPERTY_H
#include <sys/types.h>
#include <mailutils/list.h>
#ifndef __P
# ifdef __STDC__
......@@ -35,31 +36,26 @@ extern "C" {
struct _property;
typedef struct _property *property_t;
struct property_list
{
char *key;
int value;
void *private_; /* Private data. */
};
extern int property_create __P ((property_t *, void *));
extern void property_destroy __P ((property_t *, void *));
extern void *property_get_owner __P ((property_t));
extern int property_set_value __P ((property_t, const char *, const void *));
extern int property_get_value __P ((property_t, const char *, void **));
extern int property_set_set_value __P ((property_t, int (*_set_value)
__P ((property_t , const char *,
const void *)), void *));
extern int property_set_get_value __P ((property_t , int (*_get_value)
__P ((property_t, const char *,
void **)), void *owner));
extern int property_set_value __P ((property_t, const char *, int));
extern int property_get_value __P ((property_t, const char *, int *));
extern int property_add_default __P ((property_t, const char *, int *, void *));
extern int property_set __P ((property_t, const char *));
extern int property_unset __P ((property_t, const char *));
extern int property_is_set __P ((property_t, const char *));
extern int property_set_int __P ((property_t, const char *, int));
extern int property_get_int __P ((property_t, const char *));
extern int property_set_long __P ((property_t, const char *, long));
extern long property_get_long __P ((property_t, const char *));
extern int property_set_pointer __P ((property_t, const char *, void *));
extern void *property_get_pointer __P ((property_t, const char *));
extern int property_get_list __P ((property_t, list_t *));
#ifdef __cplusplus
}
......
......@@ -41,16 +41,9 @@ typedef struct _stream *stream_t;
#define MU_STREAM_APPEND 0x00000008
#define MU_STREAM_CREAT 0x00000010
#define MU_STREAM_NONBLOCK 0x00000020
/* Stream will be destroy on stream_destroy. */
/* Stream will be destroy on stream_destroy whitout checking the owner. */
#define MU_STREAM_NO_CHECK 0x00000040
/* Identity of the stream. */
#define MU_STREAM_POP 0x00001000
#define MU_STREAM_IMAP 0x00002000
#define MU_STREAM_FILE 0x00004000
#define MU_STREAM_SMTP 0x00008000
#define MU_STREAM_SENDMAIL 0x00010000
extern int stream_create __P ((stream_t *, int flags, void *owner));
extern void stream_destroy __P ((stream_t *, void *owner));
extern int stream_set_destroy __P ((stream_t, void (*_destroy) __P ((stream_t)), void *owner));
......