Commit 39b76908 39b76908aeb9e5aac8e035537e9e3b37284c501f by Alain Magloire

header.c header.h headeri.c mailbox.c mailbox.h mailboxi.c

 	mbx_imap.c mbx_imap.h mbx_mdir.c mbx_mdir.h mbx_mmdf.c
 	mbx_mmdf.h mbx_pop.c mbx_pop.h mbx_unix.c mbx_unix.h
updated.
 	header0.h mailbox0.h
move the structure definition here
1 parent 28762502
......@@ -20,7 +20,7 @@
# include "config.h"
#endif
#include <header.h>
#include <header0.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
......@@ -274,6 +274,7 @@ static int
rfc822_set_value (header_t h, const char *fn, const char *fb,
size_t n, int replace)
{
(void)h; (void)fn; (void)fb; (void)n; (void)replace;
return ENOSYS;
}
......
......@@ -67,20 +67,6 @@ extern "C" {
struct _header;
typedef struct _header * header_t;
struct _header
{
/* Data */
void *data;
/* Functions */
int (*_set_value) __P ((header_t, const char *fn, const char *fv,
size_t n, int replace));
int (*_get_value) __P ((header_t, const char *fn, char *fv,
size_t len, size_t *n));
int (*_get_mvalue) __P ((header_t, const char *fn, char **fv, size_t *n));
int (*_parse) __P ((header_t, const char *blurb, size_t len));
} ;
extern int header_init __P ((header_t *, const char *blurb,
size_t ln, int flag));
extern void header_destroy __P ((header_t *));
......@@ -105,12 +91,6 @@ extern INLINE int header_get_value __P ((header_t, const char *fn, char *fv,
extern INLINE int header_get_mvalue __P ((header_t, const char *fn,
char **fv, size_t *n));
#ifdef USE_MACROS
#define header_set_value(h, fn, fv, n, r) h->_set_value (h, fn, fv, n, r)
#define header_get_value(h, fn, fv, v, ln, n) h->_get_value (h, fn, fv, ln, n)
#define header_get_mvalue(h, fn, fv, v, n) h->_get_mvalue (h, fn, fv, n)
#endif
#ifdef _cpluscplus
}
#endif
......
/* GNU mailutils - a suite of utilities for electronic mail
Copyright (C) 1999, 2000 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#ifndef _HEADER0_H
#define _HEADER0_H
#include <sys/types.h>
#include <header.h>
#ifndef __P
#ifdef __STDC__
#define __P(args) args
#else
#define __P(args) ()
#endif
#endif /*__P */
#ifdef _cpluscplus
extern "C" {
#endif
struct _header
{
/* Data */
void *data;
/* Functions */
int (*_set_value) __P ((header_t, const char *fn, const char *fv,
size_t n, int replace));
int (*_get_value) __P ((header_t, const char *fn, char *fv,
size_t len, size_t *n));
int (*_get_mvalue) __P ((header_t, const char *fn, char **fv, size_t *n));
int (*_parse) __P ((header_t, const char *blurb, size_t len));
} ;
#ifdef USE_MACROS
#define header_set_value(h, fn, fv, n, r) h->_set_value (h, fn, fv, n, r)
#define header_get_value(h, fn, fv, v, ln, n) h->_get_value (h, fn, fv, ln, n)
#define header_get_mvalue(h, fn, fv, v, n) h->_get_mvalue (h, fn, fv, n)
#endif
#ifdef _cpluscplus
}
#endif
#endif /* HEADER0_H */
......@@ -16,7 +16,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <header.h>
#include <header0.h>
int
header_set_value (header_t h, const char *fn, const char *fb, size_t n,
......
......@@ -27,6 +27,7 @@
#include <mbx_imap.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
/* forward prototypes */
......@@ -392,12 +393,14 @@ mbx_check_struct (mailbox_t mbox)
static int
mbx_open (mailbox_t mbox, int flag)
{
(void)mbox; (void)flag;
return ENOSYS;
}
static int
mbx_close (mailbox_t mbox)
{
(void)mbox;
return ENOSYS;
}
......@@ -452,6 +455,7 @@ mbx_get_mname (mailbox_t mbox, int *id, char **name, size_t *n)
static int
mbx_get_passwd (mailbox_t mbox, char *passwd, size_t len, size_t *n)
{
(void)mbox; (void)passwd; (void)len; (void)n;
return ENOSYS;
}
......@@ -473,6 +477,7 @@ mbx_get_mpasswd (mailbox_t mbox, char **passwd, size_t *n)
static int
mbx_set_passwd (mailbox_t mbox, const char *passwd, size_t len)
{
(void)mbox; (void)passwd; (void)len;
return ENOSYS;
}
......@@ -480,24 +485,28 @@ mbx_set_passwd (mailbox_t mbox, const char *passwd, size_t len)
static int
mbx_delete (mailbox_t mbox, size_t msgno)
{
(void)mbox; (void)msgno;
return ENOSYS;
}
static int
mbx_undelete (mailbox_t mbox, size_t msgno)
{
(void)mbox; (void)msgno;
return ENOSYS;
}
static int
mbx_expunge (mailbox_t mbox)
{
(void)mbox;
return ENOSYS;
}
static int
mbx_is_deleted (mailbox_t mbox, size_t msgno)
{
(void)mbox; (void)msgno;
return ENOSYS;
}
......@@ -506,6 +515,7 @@ mbx_is_deleted (mailbox_t mbox, size_t msgno)
static int
mbx_new_msg (mailbox_t mbox, size_t *msgno)
{
(void)mbox; (void)msgno;
return ENOSYS;
}
......@@ -513,6 +523,7 @@ static int
mbx_set_header (mailbox_t mbox, size_t msgno, const char *h,
size_t len, int replace)
{
(void)mbox; (void)msgno; (void)h; (void)len; (void)replace;
return ENOSYS;
}
......@@ -520,18 +531,21 @@ static int
mbx_set_body (mailbox_t mbox, size_t msgno, const char *b,
size_t len, int replace)
{
(void)mbox; (void)msgno; (void)b; (void)len; (void)replace;
return ENOSYS;
}
static int
mbx_append (mailbox_t mbox, size_t msgno)
{
(void)mbox; (void)msgno;
return ENOSYS;
}
static int
mbx_destroy_msg (mailbox_t mbox, size_t msgno)
{
(void)mbox; (void)msgno;
return ENOSYS;
}
......@@ -540,6 +554,7 @@ static int
mbx_get_body (mailbox_t mbox, size_t msgno, off_t off,
char *b, size_t len, size_t *n)
{
(void)mbox; (void)msgno; (void)off; (void)b; (void)len; (void)n;
return ENOSYS;
}
......@@ -563,6 +578,7 @@ static int
mbx_get_header (mailbox_t mbox, size_t msgno, off_t off,
char *h, size_t len, size_t *n)
{
(void)mbox; (void)msgno; (void)off; (void)h; (void)len; (void)n;
return ENOSYS;
}
......@@ -586,12 +602,14 @@ mbx_get_mheader (mailbox_t mbox, size_t msgno, off_t off,
static int
mbx_lock (mailbox_t mbox, int flag)
{
(void)mbox; (void)flag;
return ENOSYS;
}
static int
mbx_unlock (mailbox_t mbox)
{
(void)mbox;
return ENOSYS;
}
......@@ -626,12 +644,14 @@ mbx_get_group (mailbox_t mbox, uid_t *gid)
static int
mbx_scan (mailbox_t mbox, size_t *msgs)
{
(void)mbox; (void)msgs;
return ENOSYS;
}
static int
mbx_is_updated (mailbox_t mbox)
{
(void)mbox;
return ENOSYS;
}
......@@ -666,11 +686,13 @@ mbx_set_refresh (mailbox_t mbox, size_t refresh)
static int
mbx_get_size (mailbox_t mbox, size_t msgno, size_t *sh, size_t *sb)
{
(void)mbox; (void)msgno; (void)sh; (void)sb;
return ENOSYS;
}
static int
mbx_set_notification (mailbox_t mbox, int (*func) (mailbox_t, void *arg))
{
mbox->notification = func;
return ENOSYS;
}
......
......@@ -39,9 +39,6 @@ extern "C" {
struct _mailbox;
typedef struct _mailbox *mailbox_t;
/* Lock settings */
typedef enum { MB_ULOCK, MB_RLOCK, MB_WLOCK } mailbox_lock_t;
struct mailbox_type
{
char *name;
......@@ -51,104 +48,6 @@ struct mailbox_type
void (*_destroy) __P ((mailbox_t *));
};
struct _mailbox
{
/* Data */
char *name;
uid_t owner;
gid_t group;
size_t messages;
size_t num_deleted;
off_t size;
int lock;
size_t timeout;
size_t refresh;
int (*func) __P ((mailbox_t, void *arg));
struct mailbox_type *mtype;
/* back pointer to the specific mailbox */
void *data;
/* Functions */
#define MU_MB_RDONLY ((int)1)
#define MU_MB_WRONLY (MU_MB_RDONLY << 1)
#define MU_MB_RDWR (MU_MB_WRONLY << 1)
#define MU_MB_APPEND (MU_MB_RDWR << 1)
#define MU_MB_CREAT (MU_MB_APPEND << 1)
int (*_open) __P ((mailbox_t, int flag));
int (*_close) __P ((mailbox_t));
/* type */
int (*_get_name) __P ((mailbox_t, int *id, char *name,
size_t len, size_t *n));
int (*_get_mname) __P ((mailbox_t, int *id, char **name, size_t *n));
/* passwd if needed */
int (*_get_passwd) __P ((mailbox_t, char *passwd,
size_t len, size_t *n));
int (*_get_mpasswd) __P ((mailbox_t, char **passwd, size_t *n));
int (*_set_passwd) __P ((mailbox_t, const char *passwd, size_t len));
/* deleting mesgs */
int (*_is_deleted) __P ((mailbox_t, size_t msgno));
int (*_delete) __P ((mailbox_t, size_t msgno));
int (*_undelete) __P ((mailbox_t, size_t msgno));
int (*_expunge) __P ((mailbox_t));
int (*_is_updated) __P ((mailbox_t));
int (*_scan) __P ((mailbox_t, size_t *msgs));
/* appending messages */
int (*_new_msg) __P ((mailbox_t, size_t *msgno));
int (*_set_header) __P ((mailbox_t, size_t msgno, const char *h,
size_t len, int replace));
int (*_set_body) __P ((mailbox_t, size_t msgno, const char *b,
size_t len, int replace));
int (*_append) __P ((mailbox_t, size_t msgno));
int (*_destroy_msg) __P ((mailbox_t, size_t msgno));
#define MU_MB_RDLOCK 0
#define MU_MB_WRLOCK 1
/* locking */
int (*_lock) __P ((mailbox_t, int flag));
int (*_unlock) __P ((mailbox_t));
int (*_ilock) __P ((mailbox_t, int flag));
int (*_iunlock) __P ((mailbox_t));
/* reading mesgs */
int (*_get_body) __P ((mailbox_t, size_t msgno, off_t off,
char *b, size_t len, size_t *n));
int (*_get_mbody) __P ((mailbox_t, size_t msgno, off_t off,
char **b, size_t *n));
int (*_get_header) __P ((mailbox_t, size_t msgno, off_t off,
char *h, size_t len, size_t *n));
int (*_get_mheader) __P ((mailbox_t, size_t msgno, off_t off,
char **h, size_t *n));
int (*_get_size) __P ((mailbox_t, size_t msgno,
size_t *h, size_t *b));
/* setting flags */
int (*_is_read) __P ((mailbox_t, size_t msgno));
int (*_set_read) __P ((mailbox_t, size_t msgno));
int (*_is_seen) __P ((mailbox_t, size_t msgno));
int (*_set_seen) __P ((mailbox_t, size_t msgno));
/* owner and group */
int (*_set_owner) __P ((mailbox_t, uid_t uid));
int (*_get_owner) __P ((mailbox_t, uid_t *uid));
int (*_set_group) __P ((mailbox_t, gid_t gid));
int (*_get_group) __P ((mailbox_t, gid_t *gid));
/* miscellany */
int (*_size) __P ((mailbox_t, off_t *size));
int (*_get_timeout) __P ((mailbox_t, size_t *timeout));
int (*_set_timeout) __P ((mailbox_t, size_t timeout));
int (*_get_refresh) __P ((mailbox_t, size_t *refresh));
int (*_set_refresh) __P ((mailbox_t, size_t refresh));
int (*_set_notification) __P ((mailbox_t,
int (*func) __P ((mailbox_t, void * arg))));
};
/* constructor/destructor and possible types */
extern int mailbox_init __P ((mailbox_t *, const char *name, int id));
......@@ -170,6 +69,13 @@ extern int mailbox_get_type __P ((struct mailbox_type **mtype, int id));
# endif
#endif
/* flags for mailbox_open () */
#define MU_MB_RDONLY ((int)1)
#define MU_MB_WRONLY (MU_MB_RDONLY << 1)
#define MU_MB_RDWR (MU_MB_WRONLY << 1)
#define MU_MB_APPEND (MU_MB_RDWR << 1)
#define MU_MB_CREAT (MU_MB_APPEND << 1)
extern INLINE int mailbox_open __P ((mailbox_t, int flag));
extern INLINE int mailbox_close __P ((mailbox_t));
......@@ -215,7 +121,8 @@ extern INLINE int mailbox_get_header __P ((mailbox_t, size_t msgno, off_t off,
extern INLINE int mailbox_get_mheader __P ((mailbox_t, size_t msgno, off_t off,
char **h, size_t *n));
/* locking */
/* Lock settings */
typedef enum { MB_RDLOCK, MB_WRLOCK } mailbox_lock_t;
extern INLINE int mailbox_lock __P ((mailbox_t, int flag));
extern INLINE int mailbox_unlock __P ((mailbox_t));
......@@ -233,62 +140,9 @@ extern INLINE int mailbox_set_refresh __P ((mailbox_t, size_t refresh));
extern INLINE int mailbox_get_size __P ((mailbox_t, size_t msgno,
size_t *header, size_t *body));
extern INLINE int mailbox_set_notification __P ((mailbox_t,
int (*func)
int (*notification)
__P ((mailbox_t, void *))));
#ifdef MU_USE_MACROS
#define mailbox_open(m, f) m->_open (m, f)
#define mailbox_close(m) m->_close (m)
/* type */
#define mailbox_get_name(m, t, d, l, n) m->_get_name (m, t, d, l, n)
#define mailbox_get_mtype(m, t, d, n) m->_get_mtype (m, t, d, n)
/* passwd */
#define mailbox_get_passwd(m, p, l, n) m->_get_passwd (m, p, l, n)
#define mailbox_get_mpasswd(m, p, n) m->_get_mpasswd (m, p, n)
#define mailbox_set_passwd(m, p, l) m->_set_passwd (m, p, l)
/* deleting */
#define mailbox_delete(m, mid) m->_delete (m, mid)
#define mailbox_undelete(m, mid) m->_undelete (m, mid)
#define mailbox_is_deleted(m, mid) m->_is_deleted (m, mid)
#define mailbox_expunge(m) m->_expunge (m)
/* appending */
#define mailbox_new_msg(m, mid) m->_new_msg (m, mid)
#define mailbox_set_header(m, mid, h, l, r) m->_set_header(m, mid, h, n, r)
#define mailbox_set_body(m, mid, b, l r) m->_set_body (m, mid, b, l, r)
#define mailbox_append(m, mid) m->_append (m, mid)
#define mailbox_destroy_msg(m, mid) m->_destroy_msg (m, mid)
/* locking */
#define mailbox_lock(m, f) m->_lock (m, f)
#define mailbox_unlock(m) m->_unlock (m)
/* reading */
#define mailbox_get_header(m, mid, h, l, n) m->_get_header (m, mid, h, o, n)
#define mailbox_get_mheader(m, mid, h, l) m->_get_header (m, mid, h, l)
#define mailbox_get_body(m, mid, b, l, n) m->_get_body (m, mid, b, l, n)
#define mailbox_get_mbody(m, mid, b, n) m->_get_body (m, mid, b, n)
/* owner and group */
#define mailbox_set_owner(m, uid) m->_set_owner(m, uid)
#define mailbox_get_owner(m, uid) m->_set_owner(m, uid)
#define mailbox_set_group(m, gid) m->_set_group(m, gid)
#define mailbox_get_group(m, gid) m->_set_group(m, gid)
/* miscellany */
#define mailbox_scan(m, t) m->_scan (m, t)
#define mailbox_is_updated(m) m->_is_updated (m)
#define mailbox_get_timeout(m, t) m->_get_timeout (m, t)
#define mailbox_set_timeout(m, t) m->_set_timeout (m, t)
#define mailbox_get_refresh(m, r) m->_get_refresh (m, r)
#define mailbox_set_refresh(m, r) m->_set_refresh (m, r)
#define mailbox_get_size(m, mid, sh, sb) m->_get_size(m, mid, sh, sb)
#define mailbox_set_notification(m, func) m->_set_notification (m, func)
#endif /* MU_USE_MACROS */
#ifdef __cplusplus
}
#endif
......
/* GNU mailutils - a suite of utilities for electronic mail
Copyright (C) 1999, 2000 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#ifndef _MAILBOX0_H
# define _MAILBOX0_H
#include <url.h>
#include <mailbox.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdlib.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __P
# ifdef __STDC__
# define __P(args) args
# else
# define __P(args) ()
# endif
#endif /*__P */
/* forward declaration */
//struct _mailbox;
//typedef struct _mailbox *mailbox_t;
/* Lock settings */
//typedef enum { MB_ULOCK, MB_RLOCK, MB_WLOCK } mailbox_lock_t;
/*
struct mailbox_type
{
char *name;
int id;
struct url_type *utype;
int (*_init) __P ((mailbox_t *, const char *name));
void (*_destroy) __P ((mailbox_t *));
};
*/
struct _mailbox
{
/* Data */
char *name;
uid_t owner;
gid_t group;
size_t messages;
size_t num_deleted;
off_t size;
int lock;
size_t timeout;
size_t refresh;
int (*notification) __P ((mailbox_t, void *arg));
struct mailbox_type *mtype;
/* back pointer to the specific mailbox */
void *data;
/* Functions */
#define MU_MB_RDONLY ((int)1)
#define MU_MB_WRONLY (MU_MB_RDONLY << 1)
#define MU_MB_RDWR (MU_MB_WRONLY << 1)
#define MU_MB_APPEND (MU_MB_RDWR << 1)
#define MU_MB_CREAT (MU_MB_APPEND << 1)
int (*_open) __P ((mailbox_t, int flag));
int (*_close) __P ((mailbox_t));
/* type */
int (*_get_name) __P ((mailbox_t, int *id, char *name,
size_t len, size_t *n));
int (*_get_mname) __P ((mailbox_t, int *id, char **name, size_t *n));
/* passwd if needed */
int (*_get_passwd) __P ((mailbox_t, char *passwd,
size_t len, size_t *n));
int (*_get_mpasswd) __P ((mailbox_t, char **passwd, size_t *n));
int (*_set_passwd) __P ((mailbox_t, const char *passwd, size_t len));
/* deleting mesgs */
int (*_is_deleted) __P ((mailbox_t, size_t msgno));
int (*_delete) __P ((mailbox_t, size_t msgno));
int (*_undelete) __P ((mailbox_t, size_t msgno));
int (*_expunge) __P ((mailbox_t));
int (*_is_updated) __P ((mailbox_t));
int (*_scan) __P ((mailbox_t, size_t *msgs));
/* appending messages */
int (*_new_msg) __P ((mailbox_t, size_t *msgno));
int (*_set_header) __P ((mailbox_t, size_t msgno, const char *h,
size_t len, int replace));
int (*_set_body) __P ((mailbox_t, size_t msgno, const char *b,
size_t len, int replace));
int (*_append) __P ((mailbox_t, size_t msgno));
int (*_destroy_msg) __P ((mailbox_t, size_t msgno));
#define MU_MB_RDLOCK 0
#define MU_MB_WRLOCK 1
/* locking */
int (*_lock) __P ((mailbox_t, int flag));
int (*_unlock) __P ((mailbox_t));
int (*_ilock) __P ((mailbox_t, int flag));
int (*_iunlock) __P ((mailbox_t));
/* reading mesgs */
int (*_get_body) __P ((mailbox_t, size_t msgno, off_t off,
char *b, size_t len, size_t *n));
int (*_get_mbody) __P ((mailbox_t, size_t msgno, off_t off,
char **b, size_t *n));
int (*_get_header) __P ((mailbox_t, size_t msgno, off_t off,
char *h, size_t len, size_t *n));
int (*_get_mheader) __P ((mailbox_t, size_t msgno, off_t off,
char **h, size_t *n));
int (*_get_size) __P ((mailbox_t, size_t msgno,
size_t *h, size_t *b));
/* setting flags */
int (*_is_read) __P ((mailbox_t, size_t msgno));
int (*_set_read) __P ((mailbox_t, size_t msgno));
int (*_is_seen) __P ((mailbox_t, size_t msgno));
int (*_set_seen) __P ((mailbox_t, size_t msgno));
/* owner and group */
int (*_set_owner) __P ((mailbox_t, uid_t uid));
int (*_get_owner) __P ((mailbox_t, uid_t *uid));
int (*_set_group) __P ((mailbox_t, gid_t gid));
int (*_get_group) __P ((mailbox_t, gid_t *gid));
/* miscellany */
int (*_size) __P ((mailbox_t, off_t *size));
int (*_get_timeout) __P ((mailbox_t, size_t *timeout));
int (*_set_timeout) __P ((mailbox_t, size_t timeout));
int (*_get_refresh) __P ((mailbox_t, size_t *refresh));
int (*_set_refresh) __P ((mailbox_t, size_t refresh));
int (*_set_notification) __P ((mailbox_t,
int (*func) __P ((mailbox_t, void * arg))));
};
#ifdef MU_USE_MACROS
#define mailbox_open(m, f) m->_open (m, f)
#define mailbox_close(m) m->_close (m)
/* type */
#define mailbox_get_name(m, t, d, l, n) m->_get_name (m, t, d, l, n)
#define mailbox_get_mtype(m, t, d, n) m->_get_mtype (m, t, d, n)
/* passwd */
#define mailbox_get_passwd(m, p, l, n) m->_get_passwd (m, p, l, n)
#define mailbox_get_mpasswd(m, p, n) m->_get_mpasswd (m, p, n)
#define mailbox_set_passwd(m, p, l) m->_set_passwd (m, p, l)
/* deleting */
#define mailbox_delete(m, mid) m->_delete (m, mid)
#define mailbox_undelete(m, mid) m->_undelete (m, mid)
#define mailbox_is_deleted(m, mid) m->_is_deleted (m, mid)
#define mailbox_expunge(m) m->_expunge (m)
/* appending */
#define mailbox_new_msg(m, mid) m->_new_msg (m, mid)
#define mailbox_set_header(m, mid, h, l, r) m->_set_header(m, mid, h, n, r)
#define mailbox_set_body(m, mid, b, l r) m->_set_body (m, mid, b, l, r)
#define mailbox_append(m, mid) m->_append (m, mid)
#define mailbox_destroy_msg(m, mid) m->_destroy_msg (m, mid)
/* locking */
#define mailbox_lock(m, f) m->_lock (m, f)
#define mailbox_unlock(m) m->_unlock (m)
/* reading */
#define mailbox_get_header(m, mid, h, l, n) m->_get_header (m, mid, h, o, n)
#define mailbox_get_mheader(m, mid, h, l) m->_get_header (m, mid, h, l)
#define mailbox_get_body(m, mid, b, l, n) m->_get_body (m, mid, b, l, n)
#define mailbox_get_mbody(m, mid, b, n) m->_get_body (m, mid, b, n)
/* owner and group */
#define mailbox_set_owner(m, uid) m->_set_owner(m, uid)
#define mailbox_get_owner(m, uid) m->_set_owner(m, uid)
#define mailbox_set_group(m, gid) m->_set_group(m, gid)
#define mailbox_get_group(m, gid) m->_set_group(m, gid)
/* miscellany */
#define mailbox_scan(m, t) m->_scan (m, t)
#define mailbox_is_updated(m) m->_is_updated (m)
#define mailbox_get_timeout(m, t) m->_get_timeout (m, t)
#define mailbox_set_timeout(m, t) m->_set_timeout (m, t)
#define mailbox_get_refresh(m, r) m->_get_refresh (m, r)
#define mailbox_set_refresh(m, r) m->_set_refresh (m, r)
#define mailbox_get_size(m, mid, sh, sb) m->_get_size(m, mid, sh, sb)
#define mailbox_set_notification(m, func) m->_set_notification (m, func)
#endif /* MU_USE_MACROS */
#ifdef __cplusplus
}
#endif
#endif /* _MAILBOX0_H */
......@@ -15,7 +15,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <mailbox.h>
#include <mailbox0.h>
int
mailbox_open (mailbox_t mbox, int flag)
......
......@@ -30,11 +30,13 @@ struct mailbox_type _mailbox_imap_type =
void
mailbox_imap_destroy (mailbox_t *mbox)
{
(void)mbox;
return;
}
int
mailbox_imap_init (mailbox_t *mbox, const char *name)
{
(void)mbox; (void)name;
return ENOSYS;
}
......
/* GNU mailutils - a suite of utilities for electronic mail
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999, 2000 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Library General Public License as published by
......@@ -18,7 +18,7 @@
#ifndef _MBX_IMAP_H
#define _MBX_IMAP_H 1
#include <mailbox.h>
#include <mailbox0.h>
extern int mailbox_imap_init __P ((mailbox_t *mbox, const char *name));
extern void mailbox_imap_destroy __P ((mailbox_t *mbox));
......
......@@ -29,11 +29,13 @@ struct mailbox_type _mailbox_maildir_type =
int
mailbox_maildir_init (mailbox_t *mbox, const char *name)
{
(void)mbox; (void)name;
return ENOSYS;
}
void
mailbox_maildir_destroy (mailbox_t *mbox)
{
(void)mbox;
return;
}
......
/* GNU mailutils - a suite of utilities for electronic mail
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999, 2000 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Library General Public License as published by
......@@ -18,7 +18,7 @@
#ifndef _MBX_MDIR_H
#define _MBX_MDIR_H 1
#include <mailbox.h>
#include <mailbox0.h>
extern int mailbox_maildir_init __P ((mailbox_t *mbox, const char *name));
extern void mailbox_maildir_destroy __P ((mailbox_t *mbox));
......
......@@ -29,11 +29,13 @@ struct mailbox_type _mailbox_mmdf_type =
int
mailbox_mmdf_init (mailbox_t *mbox, const char *name)
{
(void)mbox; (void)name;
return ENOSYS;
}
void
mailbox_mmdf_destroy (mailbox_t *mbox)
{
(void)mbox;
return;
}
......
/* GNU mailutils - a suite of utilities for electronic mail
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999, 2000 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Library General Public License as published by
......@@ -18,7 +18,7 @@
#ifndef _MBX_MMDF_H
#define _MBX_MMDF_H 1
#include <mailbox.h>
#include <mailbox0.h>
extern int mailbox_mmdf_init __P ((mailbox_t *mbox, const char *name));
extern void mailbox_mmdf_destroy __P ((mailbox_t *mbox));
......
......@@ -29,11 +29,13 @@ struct mailbox_type _mailbox_pop_type =
void
mailbox_pop_destroy (mailbox_t *mbox)
{
(void)mbox;
return;
}
int
mailbox_pop_init (mailbox_t *mbox, const char *name)
{
(void)mbox; (void)name;
return ENOSYS;
}
......
/* GNU mailutils - a suite of utilities for electronic mail
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999, 2000 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Library General Public License as published by
......@@ -18,7 +18,7 @@
#ifndef _MBX_POP_H
#define _MBX_POP_H 1
#include <mailbox.h>
#include <mailbox0.h>
extern int mailbox_pop_init __P ((mailbox_t *mbox, const char *name));
extern void mailbox_pop_destroy __P ((mailbox_t *mbox));
......
......@@ -72,8 +72,8 @@ typedef struct _mailbox_unix_data
static int mailbox_unix_open (mailbox_t mbox, int flag);
static int mailbox_unix_close (mailbox_t mbox);
static int mailbox_unix_get_name (mailbox_t, int *id, char *name,
size_t len, size_t *n);
//static int mailbox_unix_get_name (mailbox_t, int *id, char *name,
// size_t len, size_t *n);
/* passwd */
......@@ -128,8 +128,8 @@ static int mailbox_unix_size (mailbox_t, off_t *size);
static int mailbox_unix_is_from (const char *);
static int mailbox_unix_readhdr (mailbox_t mbox, char *buf, size_t len,
off_t *content_length);
static int mailbox_unix_sigblock ();
static int mailbox_unix_sigunblock ();
//static int mailbox_unix_sigblock ();
//static int mailbox_unix_sigunblock ();
/* Having a structure initialize at compiletime instead of runtime
may speed thing a bit, but it is a real pain to maintain with
......@@ -161,7 +161,7 @@ static struct _mailbox unixmbox =
mailbox_unix_close, /* (*_close) */
/* type */
mailbox_unix_get_name, /* (*_get_name) */
NULL, /* (*_get_name) */
NULL, /* (*_get_mname) */
/* passwd if needed */
......@@ -311,7 +311,7 @@ mailbox_unix_init (mailbox_t *pmbox, const char *name)
/* mutex when accessing the structure fields */
/* FIXME: should we use rdwr locks instead ?? */
#ifdef HAVE_PHTREAD_H
pthread_mutex_init (mud->mutex, NULL);
pthread_mutex_init (&(mud->mutex), NULL);
#endif
......@@ -502,6 +502,7 @@ mailbox_unix_close (mailbox_t mbox)
return 0;
}
/*
static int
mailbox_unix_get_name (mailbox_t mbox, int *id, char *name,
size_t len, size_t *n)
......@@ -524,6 +525,7 @@ mailbox_unix_get_name (mailbox_t mbox, int *id, char *name,
}
return 0;
}
*/
/* passwd */
/* We don't care */
......@@ -989,28 +991,33 @@ mailbox_unix_expunge (mailbox_t mbox)
static int
mailbox_unix_new_msg (mailbox_t mbox, size_t *msgno)
{
(void)mbox; (void)msgno;
return ENOSYS;
}
static int
mailbox_unix_set_header (mailbox_t mbox, size_t msgno, const char *h,
size_t len, int replace)
{
(void)mbox; (void)msgno; (void)h; (void)len; (void)replace;
return ENOSYS;
}
static int
mailbox_unix_set_body (mailbox_t mbox, size_t msgno, const char *b,
size_t len, int replace)
{
(void)mbox; (void)msgno; (void)b; (void)len; (void)replace;
return ENOSYS;
}
static int
mailbox_unix_append (mailbox_t mbox, size_t msgno)
{
(void)mbox; (void)msgno;
return ENOSYS;
}
static int
mailbox_unix_destroy_msg (mailbox_t mbox, size_t msgno)
{
(void)mbox; (void)msgno;
return ENOSYS;
}
......@@ -1039,7 +1046,7 @@ mailbox_unix_get_body (mailbox_t mbox, size_t msgno, off_t off,
mailbox_unix_iunlock (mbox);
return EIO;
}
nread = (ln < len) ? ln : len;
nread = ((size_t)ln < len) ? ln : len;
/* position the file pointer and the buffer */
if (fseek (mud->file, mum->body + off, SEEK_SET) < 0)
{
......@@ -1086,7 +1093,7 @@ mailbox_unix_get_header (mailbox_t mbox, size_t msgno, off_t off,
mailbox_unix_iunlock (mbox);
return EIO;
}
nread = (ln < len) ? ln : len;
nread = ((size_t)ln < len) ? ln : len;
/* position the file pointer and the buffer */
if (fseek (mud->file, mum->header + off, SEEK_SET) < 0)
{
......@@ -1161,7 +1168,11 @@ static int
mailbox_unix_ilock (mailbox_t mbox, int flag)
{
#ifdef HAVE_PTHREAD_H
pthread_mutex_lock (&mutex)
mailbox_unix_data_t mud = (mailbox_unix_data_t) mbox->data;
(void)flag; /* we should use rwlocks for more concurency */
pthread_mutex_lock (&(mud->mutex));
#else
(void)mbox; (void)flag;
#endif
return 0;
}
......@@ -1170,7 +1181,10 @@ static int
mailbox_unix_iunlock (mailbox_t mbox)
{
#ifdef HAVE_PTHREAD_H
pthread_mutex_unlock (&mutex)
mailbox_unix_data_t mud = (mailbox_unix_data_t) mbox->data;
pthread_mutex_unlock (&(mud->mutex));
#else
(void)mbox;
#endif
return 0;
}
......@@ -1179,6 +1193,8 @@ static int
mailbox_unix_lock (mailbox_t mbox, int flag)
{
#ifdef HAVE_MAILOCK_H
#else
(void)mbox; (void)flag;
#endif
return 0;
}
......@@ -1186,6 +1202,8 @@ static int
mailbox_unix_unlock (mailbox_t mbox)
{
#ifdef HAVE_MAILOCK_H
#else
(void)mbox;
#endif
return 0;
}
......
/* GNU mailutils - a suite of utilities for electronic mail
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999, 2000 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Library General Public License as published by
......@@ -18,11 +18,19 @@
#ifndef _MBX_UNIX_H
#define _MBX_UNIX_H 1
#include <mailbox.h>
#include <mailbox0.h>
#ifdef __cplucplus
extern "C" {
#endif
extern int mailbox_unix_init __P ((mailbox_t *mbox, const char *name));
extern void mailbox_unix_destroy __P ((mailbox_t *mbox));
extern struct mailbox_type _mailbox_unix_type;
#ifdef __cplucplus
}
#endif
#endif /* _MBX_UNIX_H */
......