Commit 6d202df0 6d202df0a2d3d5b3d71d8f8c7511c68d1bee0c89 by Sergey Poznyakoff

Removed unneeded files

1 parent 5756cbe6
Showing 149 changed files with 0 additions and 4873 deletions
## Process this file with GNU Automake to create Makefile.in
## Copyright (C) 2001, 2002 Free Software Foundation, Inc.
##
## GNU Mailutils is free software; you can redistribute it and/or
## modify it under the terms of the GNU 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 General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
AUTOMAKE_OPTIONS = ../lib/ansi2knr
#INCLUDES = -I${top_srcdir}/include
INCLUDES = -I${top_srcdir}/mailbox2/include
SUBDIRS = include pop3 mbox
lib_LTLIBRARIES = libmailbox.la
libmailbox_la_SOURCES = \
address.c \
attribute.c \
authority.c \
bstream.c \
dattribute.c \
debug.c \
dotlock.c \
envelope.c \
fdstream.c \
folder.c \
fstream.c \
header.c \
iterator.c \
list.c \
lockfile.c \
mailbox.c \
md5-rsa.c \
memstream.c \
message.c \
mapstream.c \
mutil.c \
observable.c \
observer.c \
parse822.c \
pticket.c \
refcount.c \
sdebug.c \
stream.c \
tcpstream.c \
ticket.c
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <string.h>
#include <stdio.h>
#include <sys/types.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <errno.h>
#include <mailutils/parse822.h>
#include <mailutils/mutil.h>
#include <mailutils/sys/address.h>
/* Get email address from rfc822 address. */
int
address_create (address_t *a, const char *s)
{
/* 'paddress' must exist, and can't already have been initialized
*/
int status;
if (!a)
return EINVAL;
*a = NULL;
status = parse822_address_list (a, (char*) s);
if (status == 0)
{
/* And address-list may contain 0 addresses but parse correctly.
*/
if (!*a)
return ENOENT;
(*a)->addr = strdup (s);
if (!(*a)->addr)
{
address_destroy (a);
return ENOMEM;
}
}
return status;
}
void
address_destroy (address_t *paddress)
{
if (paddress && *paddress)
{
address_t current;
address_t address = *paddress;
for (; address; address = current)
{
if (address->addr)
free (address->addr);
if (address->comments)
free (address->comments);
if (address->personal)
free (address->personal);
if (address->email)
free (address->email);
if (address->local_part)
free (address->local_part);
if (address->domain)
free (address->domain);
if (address->route)
free (address->route);
current = address->next;
free (address);
}
*paddress = NULL;
}
}
int
address_get_personal (address_t addr, size_t no, char *buf, size_t len,
size_t *n)
{
size_t i, j;
int status = ENOENT;
if (addr == NULL)
return EINVAL;
for (i = 0, j = 1; addr; addr = addr->next, j++)
{
if (j == no)
{
i = util_cpystr (buf, addr->personal, len);
status = 0;
break;
}
}
if (n)
*n = i;
return status;
}
int
address_get_comments (address_t addr, size_t no, char *buf, size_t len,
size_t *n)
{
size_t i, j;
int status = ENOENT;
if (addr == NULL)
return EINVAL;
for (j = 1; addr; addr = addr->next, j++)
{
if (j == no)
{
i = util_cpystr (buf, addr->comments, len);
if (n)
*n = i;
status = 0;
break;
}
}
return status;
}
int
address_get_email (address_t addr, size_t no, char *buf, size_t len, size_t *n)
{
size_t i, j;
int status = ENOENT;
if (addr == NULL)
return EINVAL;
for (j = 1; addr; addr = addr->next, j++)
{
if (j == no)
{
i = util_cpystr (buf, addr->email, len);
if (n)
*n = i;
status = 0;
break;
}
}
return status;
}
int
address_get_local_part (address_t addr, size_t no, char *buf, size_t len, size_t *n)
{
size_t i, j;
int status = ENOENT;
if (addr == NULL)
return EINVAL;
for (j = 1; addr; addr = addr->next, j++)
{
if (j == no)
{
i = util_cpystr (buf, addr->local_part, len);
if (n)
*n = i;
status = 0;
break;
}
}
return status;
}
int
address_get_domain (address_t addr, size_t no, char *buf, size_t len, size_t *n)
{
size_t i, j;
int status = ENOENT;
if (addr == NULL)
return EINVAL;
for (j = 1; addr; addr = addr->next, j++)
{
if (j == no)
{
i = util_cpystr (buf, addr->domain, len);
if (n)
*n = i;
status = 0;
break;
}
}
return status;
}
int
address_get_route (address_t addr, size_t no, char *buf, size_t len, size_t *n)
{
size_t i, j;
int status = ENOENT;
if (addr == NULL)
return EINVAL;
for (j = 1; addr; addr = addr->next, j++)
{
if (j == no)
{
i = util_cpystr (buf, addr->route, len);
if (n)
*n = i;
status = 0;
break;
}
}
return status;
}
int
address_is_group (address_t addr, size_t no, int* yes)
{
size_t j;
int status = ENOENT;
if(addr == NULL)
return EINVAL;
for (j = 1; addr; addr = addr->next, j++)
{
if (j == no)
{
status = 0;
if(yes)
{
*yes = 0;
if(addr->personal && !addr->local_part && !addr->domain)
*yes = 1;
}
break;
}
}
return status;
}
int
address_to_string (address_t addr, char *buf, size_t len, size_t *n)
{
size_t i;
if (addr == NULL)
return EINVAL;
if (buf)
*buf = '\0';
i = util_cpystr (buf, addr->addr, len);
if (n)
*n = i;
return 0;
}
int
address_get_count (address_t addr, size_t *pcount)
{
size_t j;
for (j = 0; addr; addr = addr->next, j++)
;
if (pcount)
*pcount = j;
return 0;
}
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <sys/types.h>
#include <stdlib.h>
#include <mailutils/error.h>
#include <mailutils/sys/attribute.h>
int
attribute_ref (attribute_t attribute)
{
if (attribute == NULL || attribute->vtable == NULL
|| attribute->vtable->ref == NULL)
return MU_ERROR_NOT_SUPPORTED;
return attribute->vtable->ref (attribute);
}
void
attribute_destroy (attribute_t *pattribute)
{
if (pattribute && *pattribute)
{
attribute_t attribute = *pattribute;
if (attribute->vtable && attribute->vtable->destroy)
attribute->vtable->destroy (pattribute);
*pattribute = NULL;
}
}
int
attribute_get_flags (attribute_t attribute, int *pflags)
{
if (attribute == NULL || attribute->vtable == NULL
|| attribute->vtable->get_flags == NULL)
return MU_ERROR_NOT_SUPPORTED;
return attribute->vtable->get_flags (attribute, pflags);
}
int
attribute_set_flags (attribute_t attribute, int flags)
{
if (attribute == NULL || attribute->vtable == NULL
|| attribute->vtable->set_flags == NULL)
return MU_ERROR_NOT_SUPPORTED;
return attribute->vtable->set_flags (attribute, flags);
}
int
attribute_unset_flags (attribute_t attribute, int flags)
{
if (attribute == NULL || attribute->vtable == NULL
|| attribute->vtable->unset_flags == NULL)
return MU_ERROR_NOT_SUPPORTED;
return attribute->vtable->unset_flags (attribute, flags);
}
int
attribute_clear_flags (attribute_t attribute)
{
if (attribute == NULL || attribute->vtable == NULL
|| attribute->vtable->clear_flags == NULL)
return MU_ERROR_NOT_SUPPORTED;
return attribute->vtable->clear_flags (attribute);
}
int
attribute_get_userflags (attribute_t attribute, int *puserflags)
{
if (attribute == NULL || attribute->vtable == NULL
|| attribute->vtable->get_userflags == NULL)
return MU_ERROR_NOT_SUPPORTED;
return attribute->vtable->get_userflags (attribute, puserflags);
}
int
attribute_set_userflags (attribute_t attribute, int userflags)
{
if (attribute == NULL || attribute->vtable == NULL
|| attribute->vtable->set_userflags == NULL)
return MU_ERROR_NOT_SUPPORTED;
return attribute->vtable->set_userflags (attribute, userflags);
}
int
attribute_unset_userflags (attribute_t attribute, int userflags)
{
if (attribute == NULL || attribute->vtable == NULL
|| attribute->vtable->unset_userflags == NULL)
return MU_ERROR_NOT_SUPPORTED;
return attribute->vtable->unset_userflags (attribute, userflags);
}
int
attribute_clear_userflags (attribute_t attribute)
{
if (attribute == NULL || attribute->vtable == NULL
|| attribute->vtable->clear_userflags == NULL)
return MU_ERROR_NOT_SUPPORTED;
return attribute->vtable->clear_userflags (attribute);
}
/* Stub helpers for the wellknown flags. */
int
attribute_set_seen (attribute_t attribute)
{
if (attribute == NULL)
return MU_ERROR_INVALID_PARAMETER;
return attribute_set_flags (attribute, MU_ATTRIBUTE_SEEN);
}
int
attribute_set_answered (attribute_t attribute)
{
if (attribute == NULL)
return MU_ERROR_INVALID_PARAMETER;
return attribute_set_flags (attribute, MU_ATTRIBUTE_ANSWERED);
}
int
attribute_set_flagged (attribute_t attribute)
{
if (attribute == NULL)
return MU_ERROR_INVALID_PARAMETER;
return attribute_set_flags (attribute, MU_ATTRIBUTE_FLAGGED);
}
int
attribute_set_read (attribute_t attribute)
{
if (attribute == NULL)
return MU_ERROR_INVALID_PARAMETER;
return attribute_set_flags (attribute, MU_ATTRIBUTE_READ);
}
int
attribute_set_deleted (attribute_t attribute)
{
if (attribute == NULL)
return MU_ERROR_INVALID_PARAMETER;
return attribute_set_flags (attribute, MU_ATTRIBUTE_DELETED);
}
int
attribute_set_draft (attribute_t attribute)
{
if (attribute == NULL)
return MU_ERROR_INVALID_PARAMETER;
return attribute_set_flags (attribute, MU_ATTRIBUTE_DRAFT);
}
int
attribute_set_recent (attribute_t attribute)
{
if (attribute == NULL)
return MU_ERROR_INVALID_PARAMETER;
attribute_unset_flags (attribute, MU_ATTRIBUTE_READ);
return attribute_unset_flags (attribute, MU_ATTRIBUTE_SEEN);
}
int
attribute_set_modified (attribute_t attribute)
{
if (attribute == NULL)
return MU_ERROR_INVALID_PARAMETER;
return attribute_set_flags (attribute, MU_ATTRIBUTE_MODIFIED);
}
int
attribute_is_userflags (attribute_t attribute, int userflag)
{
int flags = 0;
if (attribute == NULL)
return 0;
attribute_get_userflags (attribute, &flags);
return flags & userflag;
}
int
attribute_is_seen (attribute_t attribute)
{
int flags = 0;
if (attribute == NULL)
return 0;
attribute_get_flags (attribute, &flags);
return flags & MU_ATTRIBUTE_SEEN;
}
int
attribute_is_answered (attribute_t attribute)
{
int flags = 0;
if (attribute == NULL)
return 0;
attribute_get_flags (attribute, &flags);
return flags & MU_ATTRIBUTE_ANSWERED;
}
int
attribute_is_flagged (attribute_t attribute)
{
int flags = 0;
if (attribute == NULL)
return 0;
attribute_get_flags (attribute, &flags);
return flags & MU_ATTRIBUTE_FLAGGED;
}
int
attribute_is_read (attribute_t attribute)
{
int flags = 0;
if (attribute == NULL)
return 0;
attribute_get_flags (attribute, &flags);
return flags & MU_ATTRIBUTE_READ;
}
int
attribute_is_deleted (attribute_t attribute)
{
int flags = 0;
if (attribute == NULL)
return 0;
attribute_get_flags (attribute, &flags);
return flags & MU_ATTRIBUTE_DELETED;
}
int
attribute_is_draft (attribute_t attribute)
{
int flags = 0;
if (attribute == NULL)
return 0;
attribute_get_flags (attribute, &flags);
return flags & MU_ATTRIBUTE_DRAFT;
}
int
attribute_is_recent (attribute_t attribute)
{
int flags = 0;
if (attribute == NULL)
return 0;
attribute_get_flags (attribute, &flags);
/* Something is recent when it is not read and not seen. */
return (flags == 0
|| ! ((flags & MU_ATTRIBUTE_SEEN) || (flags & MU_ATTRIBUTE_READ)));
}
int
attribute_is_modified (attribute_t attribute)
{
int flags = 0;
if (attribute == NULL)
return 0;
attribute_get_flags (attribute, &flags);
return flags & MU_ATTRIBUTE_MODIFIED;
}
int
attribute_unset_seen (attribute_t attribute)
{
if (attribute == NULL)
return 0;
return attribute_unset_flags (attribute, MU_ATTRIBUTE_SEEN);
}
int
attribute_unset_answered (attribute_t attribute)
{
if (attribute == NULL)
return 0;
return attribute_unset_flags (attribute, MU_ATTRIBUTE_ANSWERED);
}
int
attribute_unset_flagged (attribute_t attribute)
{
if (attribute == NULL)
return 0;
return attribute_unset_flags (attribute, MU_ATTRIBUTE_FLAGGED);
}
int
attribute_unset_read (attribute_t attribute)
{
if (attribute == NULL)
return 0;
return attribute_unset_flags (attribute, MU_ATTRIBUTE_READ);
}
int
attribute_unset_deleted (attribute_t attribute)
{
if (attribute == NULL)
return 0;
return attribute_unset_flags (attribute, MU_ATTRIBUTE_DELETED);
}
int
attribute_unset_draft (attribute_t attribute)
{
if (attribute == NULL)
return 0;
return attribute_unset_flags (attribute, MU_ATTRIBUTE_DRAFT);
}
int
attribute_unset_recent (attribute_t attribute)
{
if (attribute == NULL)
return 0;
return attribute_unset_flags (attribute, MU_ATTRIBUTE_SEEN);
}
int
attribute_unset_modified (attribute_t attribute)
{
if (attribute == NULL)
return 0;
return attribute_unset_flags (attribute, MU_ATTRIBUTE_MODIFIED);
}
/* Miscellaneous. */
int
attribute_is_equal (attribute_t attribute1, attribute_t attribute2)
{
int flags1 = 0;
int flags2 = 0;
if (attribute1)
attribute_get_flags (attribute1, &flags1);
if (attribute2)
attribute_get_flags (attribute2, &flags2);
return flags1 == flags2;
}
int
attribute_copy (attribute_t dest, attribute_t src)
{
int sflags = 0;
if (dest == NULL || src == NULL)
return MU_ERROR_INVALID_PARAMETER;
attribute_get_flags (src, &sflags);
attribute_clear_flags (dest);
attribute_set_flags (dest, sflags);
return 0;
}
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <stdlib.h>
#include <mailutils/error.h>
#include <mailutils/sys/authority.h>
int
authority_ref (authority_t authority)
{
if (authority == NULL || authority->vtable == NULL
|| authority->vtable->ref == NULL)
return MU_ERROR_NOT_SUPPORTED;
return authority->vtable->ref (authority);
}
void
authority_destroy (authority_t *pauthority)
{
if (pauthority && *pauthority)
{
authority_t authority = *pauthority;
if (authority->vtable && authority->vtable->destroy)
authority->vtable->destroy (pauthority);
*pauthority = NULL;
}
}
int
authority_set_ticket (authority_t authority, ticket_t ticket)
{
if (authority == NULL || authority->vtable == NULL
|| authority->vtable->set_ticket == NULL)
return MU_ERROR_NOT_SUPPORTED;
return authority->vtable->set_ticket (authority, ticket);
}
int
authority_get_ticket (authority_t authority, ticket_t *pticket)
{
if (authority == NULL || authority->vtable == NULL
|| authority->vtable->get_ticket == NULL)
return MU_ERROR_NOT_SUPPORTED;
return authority->vtable->get_ticket (authority, pticket);
}
int
authority_authenticate (authority_t authority)
{
if (authority == NULL || authority->vtable == NULL
|| authority->vtable->authenticate == NULL)
return MU_ERROR_NOT_SUPPORTED;
return authority->vtable->authenticate (authority);
}
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <sys/types.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#ifdef HAVE_STRINGS_H
# include <strings.h>
#endif
#include <mailutils/error.h>
#include <mailutils/sys/dattribute.h>
int
_attribute_default_ref (attribute_t attribute)
{
struct _attribute_default *da = (struct _attribute_default *)attribute;
return mu_refcount_inc (da->refcount);
}
void
_attribute_default_destroy (attribute_t *pattribute)
{
struct _attribute_default *da = (struct _attribute_default *)*pattribute;
if (mu_refcount_dec (da->refcount) == 0)
{
mu_refcount_destroy (&da->refcount);
free (da);
}
}
int
_attribute_default_get_flags (attribute_t attribute, int *pflags)
{
struct _attribute_default *da = (struct _attribute_default *)attribute;
mu_refcount_lock (da->refcount);
if (pflags)
*pflags = da->flags;
mu_refcount_unlock (da->refcount);
return 0;
}
int
_attribute_default_set_flags (attribute_t attribute, int flags)
{
struct _attribute_default *da = (struct _attribute_default *)attribute;
mu_refcount_lock (da->refcount);
da->flags |= (flags | MU_ATTRIBUTE_MODIFIED);
mu_refcount_unlock (da->refcount);
return 0;
}
int
_attribute_default_unset_flags (attribute_t attribute, int flags)
{
struct _attribute_default *da = (struct _attribute_default *)attribute;
mu_refcount_lock (da->refcount);
da->flags &= ~flags;
/* If Modified was being unset do not reset it. */
if (!(flags & MU_ATTRIBUTE_MODIFIED))
da->flags |= MU_ATTRIBUTE_MODIFIED;
mu_refcount_unlock (da->refcount);
return 0;
}
int
_attribute_default_clear_flags (attribute_t attribute)
{
struct _attribute_default *da = (struct _attribute_default *)attribute;
mu_refcount_lock (da->refcount);
da->flags = 0;
mu_refcount_unlock (da->refcount);
return 0;
}
int
_attribute_default_get_userflags (attribute_t attribute, int *puserflags)
{
struct _attribute_default *da = (struct _attribute_default *)attribute;
mu_refcount_lock (da->refcount);
if (puserflags)
*puserflags = da->userflags;
mu_refcount_unlock (da->refcount);
return 0;
}
int
_attribute_default_set_userflags (attribute_t attribute, int userflags)
{
struct _attribute_default *da = (struct _attribute_default *)attribute;
mu_refcount_lock (da->refcount);
da->userflags |= (userflags | MU_ATTRIBUTE_MODIFIED);
mu_refcount_unlock (da->refcount);
return 0;
}
int
_attribute_default_unset_userflags (attribute_t attribute, int userflags)
{
struct _attribute_default *da = (struct _attribute_default *)attribute;
mu_refcount_lock (da->refcount);
da->userflags &= ~userflags;
/* If Modified was being unset do not reset it. */
if (!(userflags & MU_ATTRIBUTE_MODIFIED))
da->userflags |= MU_ATTRIBUTE_MODIFIED;
mu_refcount_unlock (da->refcount);
return 0;
}
int
_attribute_default_clear_userflags (attribute_t attribute)
{
struct _attribute_default *da = (struct _attribute_default *)attribute;
mu_refcount_lock (da->refcount);
da->userflags = 0;
mu_refcount_unlock (da->refcount);
return 0;
}
static struct _attribute_vtable _attribute_default_vtable =
{
_attribute_default_ref,
_attribute_default_destroy,
_attribute_default_get_flags,
_attribute_default_set_flags,
_attribute_default_unset_flags,
_attribute_default_clear_flags,
_attribute_default_get_userflags,
_attribute_default_set_userflags,
_attribute_default_unset_userflags,
_attribute_default_clear_userflags
};
int
_attribute_default_ctor (struct _attribute_default *da)
{
mu_refcount_create (&(da->refcount));
if (da->refcount == NULL)
return MU_ERROR_NO_MEMORY;
da->flags = 0;
da->base.vtable = &_attribute_default_vtable;
return 0;
}
void
_attribute_default_dtor (attribute_t attribute)
{
struct _attribute_default *da = (struct _attribute_default *)attribute;
if (da)
mu_refcount_destroy (&da->refcount);
}
int
attribute_default_create (attribute_t *pattribute)
{
struct _attribute_default *da;
int status;
if (pattribute == NULL)
return MU_ERROR_INVALID_PARAMETER;
da = calloc (1, sizeof *da);
if (da == NULL)
return MU_ERROR_NO_MEMORY;
status = _attribute_default_ctor (da);
if (status != 0)
{
free (da);
return status;
}
*pattribute = &da->base;
return 0;
}
int
attribute_status_create (attribute_t *pattribute, const char *field)
{
struct _attribute_default *da;
int status;
char *colon;
if (pattribute == NULL || field == NULL)
return MU_ERROR_INVALID_PARAMETER;
da = calloc (1, sizeof *da);
if (da == NULL)
return MU_ERROR_NO_MEMORY;
status = _attribute_default_ctor (da);
if (status != 0)
{
free (da);
return status;
}
*pattribute = &da->base;
colon = strchr (field, ':');
if (colon)
field = ++colon;
for (; *field; field++)
{
switch (*field)
{
case 'O':
case 'o':
attribute_set_seen (*pattribute);
break;
case 'r':
case 'R':
attribute_set_read (*pattribute);
break;
case 'a':
case 'A':
attribute_set_answered (*pattribute);
break;
case 'd':
case 'D':
attribute_set_deleted (*pattribute);
break;
case 't':
case 'T':
attribute_set_draft (*pattribute);
break;
case 'f':
case 'F':
attribute_set_flagged (*pattribute);
break;
}
}
attribute_unset_modified (*pattribute);
return 0;
}
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <stdlib.h>
#include <mailutils/sys/debug.h>
#include <mailutils/error.h>
#include <mailutils/debug.h>
int
mu_debug_ref (mu_debug_t debug)
{
if (debug == NULL || debug->vtable == NULL || debug->vtable->ref == NULL)
return MU_ERROR_NOT_SUPPORTED;
return debug->vtable->ref (debug);
}
void
mu_debug_destroy (mu_debug_t *pdebug)
{
if (pdebug && *pdebug)
{
mu_debug_t debug = *pdebug;
if (debug->vtable && debug->vtable->destroy)
debug->vtable->destroy (pdebug);
*pdebug = NULL;
}
}
int
mu_debug_set_level (mu_debug_t debug, unsigned int level)
{
if (debug == NULL || debug->vtable == NULL
|| debug->vtable->set_level == NULL)
return MU_ERROR_NOT_SUPPORTED;
return debug->vtable->set_level (debug, level);
}
int
mu_debug_get_level (mu_debug_t debug, unsigned int *plevel)
{
if (debug == NULL || debug->vtable == NULL
|| debug->vtable->get_level == NULL)
return MU_ERROR_NOT_SUPPORTED;
return debug->vtable->get_level (debug, plevel);
}
int
mu_debug_print (mu_debug_t debug, unsigned int level, const char *msg)
{
if (debug == NULL || debug->vtable == NULL || debug->vtable->print == NULL)
return MU_ERROR_NOT_SUPPORTED;
return debug->vtable->print (debug, level, msg);
}
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <errno.h>
#include <sys/types.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <fcntl.h>
#include <limits.h>
#include <sys/stat.h>
#include <unistd.h>
#include <time.h>
#include <utime.h>
#include <signal.h>
#include <mailutils/error.h>
#include <mailutils/sys/dotlock.h>
#include <mailutils/refcount.h>
/* First draft by Brian Edmond. */
int
_lockfile_dotlock_ref (lockfile_t lockfile)
{
struct _lockfile_dotlock *dotlock = (struct _lockfile_dotlock *)lockfile;
return mu_refcount_inc (dotlock->refcount);
}
void
_lockfile_dotlock_destroy (lockfile_t *plockfile)
{
struct _lockfile_dotlock *dotlock = (struct _lockfile_dotlock *)*plockfile;
if (mu_refcount_dec (dotlock->refcount) == 0)
{
mu_refcount_destroy (&dotlock->refcount);
if (dotlock->fname)
free (dotlock->fname);
free (dotlock);
}
}
int
_lockfile_dotlock_lock (lockfile_t lockfile)
{
struct _lockfile_dotlock *dotlock = (struct _lockfile_dotlock *)lockfile;
int fd = -1;
char buf[16];
pid_t pid;
int removed = 0;
if (dotlock == NULL)
return MU_ERROR_INVALID_PARAMETER;
/* Is the lock already applied?
FIXME: should we check flags != lock->flags ?? */
if (dotlock->fd != -1)
{
dotlock->refcnt++;
return 0;
}
/*
Check for lock existance:
if it exists but the process is gone the lock can be removed,
if the lock is expired, remove it. */
fd = open (dotlock->fname, O_RDONLY);
if (fd != -1)
{
/* Check to see if this process is still running. */
if (dotlock->flags & MU_LOCKFILE_DOTLOCK_PID)
{
int nread = read (fd, buf, sizeof (buf) - 1);
if (nread > 0)
{
buf[nread] = '\0';
switch (pid = strtol (buf, NULL, 10))
{
case LONG_MIN:
case LONG_MAX:
if (errno == ERANGE)
removed = 1;
break;
default:
/* Process is gone so we try to remove the lock. */
if (kill (pid, 0) == -1)
removed = 1;
}
}
}
/* Check to see if the lock expired. */
if (dotlock->flags & MU_LOCKFILE_DOTLOCK_TIME)
{
struct stat stbuf;
fstat (fd, &stbuf);
/* The lock has expired. */
if ((time (NULL) - stbuf.st_mtime) > MU_LOCKFILE_DOTLOCK_EXPIRE_TIME)
removed = 1;
}
close (fd);
if (removed)
unlink (dotlock->fname);
}
/* Try to create the lockfile. */
fd = open (dotlock->fname, O_WRONLY | O_CREAT | O_EXCL, MU_LOCKFILE_DOTLOCK_ATTR);
if (fd == -1)
return errno;
else
{
struct stat fn_stat;
struct stat fd_stat;
if (lstat (dotlock->fname, &fn_stat)
|| fstat(fd, &fd_stat)
|| fn_stat.st_nlink != 1
|| fn_stat.st_dev != fd_stat.st_dev
|| fn_stat.st_ino != fd_stat.st_ino
|| fn_stat.st_uid != fd_stat.st_uid
|| fn_stat.st_gid != fd_stat.st_gid)
{
close (fd);
unlink (dotlock->fname);
return EPERM;
}
}
/* Success. */
sprintf (buf, "%ld", (long)getpid ());
write (fd, buf, strlen (buf));
/* Try to get a file lock. */
if (dotlock->flags & MU_LOCKFILE_DOTLOCK_FCNTL)
{
struct flock fl;
memset (&fl, 0, sizeof (struct flock));
fl.l_type = F_WRLCK;
if (fcntl (fd, F_SETLK, &fl) == -1)
{
int err = errno;
/* Could not get the file lock. */
close (fd);
unlink (dotlock->fname); /* Remove the file I created. */
return err;
}
}
dotlock->fd = fd;
dotlock->refcnt++;
return 0;
}
int
_lockfile_dotlock_touchlock (lockfile_t lockfile)
{
struct _lockfile_dotlock *dotlock = (struct _lockfile_dotlock *)lockfile;
if (!dotlock || !dotlock->fname || dotlock->fd == -1)
return MU_ERROR_INVALID_PARAMETER;
return utime (dotlock->fname, NULL);
}
int
_lockfile_dotlock_unlock (lockfile_t lockfile)
{
struct _lockfile_dotlock *dotlock = (struct _lockfile_dotlock *)lockfile;
if (!dotlock || !dotlock->fname || dotlock->fd == -1 || dotlock->refcnt <= 0)
return EINVAL;
if (--dotlock->refcnt > 0)
return 0;
if (dotlock->flags & MU_LOCKFILE_DOTLOCK_FCNTL)
{
struct flock fl;
memset (&fl, 0, sizeof (struct flock));
fl.l_type = F_UNLCK;
/* Unlock failed? */
if (fcntl (dotlock->fd, F_SETLK, &fl) == -1)
return errno;
}
close (dotlock->fd);
dotlock->fd = -1;
unlink (dotlock->fname);
return 0;
}
static struct _lockfile_vtable _lockfile_dotlock_vtable =
{
_lockfile_dotlock_ref,
_lockfile_dotlock_destroy,
_lockfile_dotlock_lock,
_lockfile_dotlock_touchlock,
_lockfile_dotlock_unlock,
};
int
_lockfile_dotlock_ctor (struct _lockfile_dotlock *dotlock,
const char *filename)
{
mu_refcount_create (&dotlock->refcount);
if (dotlock->refcount == NULL)
return MU_ERROR_NO_MEMORY;
dotlock->fname = calloc (strlen (filename) + 5 /*strlen(".lock")*/ + 1, 1);
if (dotlock->fname == NULL)
{
mu_refcount_destroy (&dotlock->refcount);
return MU_ERROR_NO_MEMORY;
}
strcpy (dotlock->fname, filename);
strcat (dotlock->fname, ".lock");
dotlock->flags = MU_LOCKFILE_DOTLOCK_PID | MU_LOCKFILE_DOTLOCK_TIME
| MU_LOCKFILE_DOTLOCK_FCNTL;
dotlock->fd = -1;
dotlock->refcnt = 0;
dotlock->base.vtable = &_lockfile_dotlock_vtable;
return 0;
}
void
_lockfile_dotlock_dtor (lockfile_t lockfile)
{
struct _lockfile_dotlock *dotlock = (struct _lockfile_dotlock *)lockfile;
if (dotlock)
{
mu_refcount_destroy (&dotlock->refcount);
if (dotlock->fname)
free (dotlock->fname);
}
}
int
lockfile_dotlock_create (lockfile_t *plockfile, const char *filename)
{
struct _lockfile_dotlock *dotlock;
int status;
if (plockfile == NULL || filename == NULL)
return MU_ERROR_INVALID_PARAMETER;
dotlock = calloc (1, sizeof *dotlock);
if (dotlock == NULL)
return MU_ERROR_NO_MEMORY;
status = _lockfile_dotlock_ctor (dotlock, filename);
if (status != 0)
{
free (dotlock);
return status;
}
*plockfile = &dotlock->base;
return 0;
}
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <mailutils/error.h>
#include <mailutils/sys/envelope.h>
int
envelope_ref (envelope_t envelope)
{
if (envelope == NULL || envelope->vtable == NULL
|| envelope->vtable->ref == NULL)
return MU_ERROR_NOT_SUPPORTED;
return envelope->vtable->ref (envelope);
}
void
envelope_destroy (envelope_t *penvelope)
{
if (penvelope && *penvelope)
{
envelope_t envelope = *penvelope;
if (envelope->vtable && envelope->vtable->destroy)
envelope->vtable->destroy (penvelope);
*penvelope = NULL;
}
}
int
envelope_get_sender (envelope_t envelope, address_t *paddr)
{
if (envelope == NULL || envelope->vtable == NULL
|| envelope->vtable->get_sender == NULL)
return MU_ERROR_NOT_SUPPORTED;
return envelope->vtable->get_sender (envelope, paddr);
}
int
envelope_set_sender (envelope_t envelope, address_t addr)
{
if (envelope == NULL || envelope->vtable == NULL
|| envelope->vtable->set_sender == NULL)
return MU_ERROR_NOT_SUPPORTED;
return envelope->vtable->set_sender (envelope, addr);
}
int
envelope_get_recipient (envelope_t envelope, address_t *paddr)
{
if (envelope == NULL || envelope->vtable == NULL
|| envelope->vtable->get_recipient == NULL)
return MU_ERROR_NOT_SUPPORTED;
return envelope->vtable->get_recipient (envelope, paddr);
}
int
envelope_set_recipient (envelope_t envelope, address_t addr)
{
if (envelope == NULL || envelope->vtable == NULL
|| envelope->vtable->set_recipient == NULL)
return MU_ERROR_NOT_SUPPORTED;
return envelope->vtable->set_recipient (envelope, addr);
}
int
envelope_get_date (envelope_t envelope, struct tm *tm, struct mu_timezone *tz)
{
if (envelope == NULL || envelope->vtable == NULL
|| envelope->vtable->get_date == NULL)
return MU_ERROR_NOT_SUPPORTED;
return envelope->vtable->get_date (envelope, tm, tz);
}
int
envelope_set_date (envelope_t envelope, struct tm *tm, struct mu_timezone *tz)
{
if (envelope == NULL || envelope->vtable == NULL
|| envelope->vtable->set_date == NULL)
return MU_ERROR_NOT_SUPPORTED;
return envelope->vtable->set_date (envelope, tm, tz);
}
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <stdlib.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <mailutils/sys/fdstream.h>
#include <mailutils/monitor.h>
#include <mailutils/error.h>
static void
_stream_fd_cleanup (void *arg)
{
struct _stream_fd *fds = arg;
mu_refcount_unlock (fds->refcount);
}
int
_stream_fd_ref (stream_t stream)
{
struct _stream_fd *fds = (struct _stream_fd *)stream;
return mu_refcount_inc (fds->refcount);
}
void
_stream_fd_destroy (stream_t *pstream)
{
struct _stream_fd *fds = (struct _stream_fd *)*pstream;
if (mu_refcount_dec (fds->refcount) == 0)
{
mu_refcount_destroy (&fds->refcount);
free (fds);
}
}
static int
_stream_fd_close0 (stream_t stream)
{
struct _stream_fd *fds = (struct _stream_fd *)stream;
fds->state = MU_STREAM_STATE_CLOSE;
if (fds->fd != -1)
close (fds->fd);
fds->fd = -1;
return 0;
}
int
_stream_fd_close (stream_t stream)
{
struct _stream_fd *fds = (struct _stream_fd *)stream;
mu_refcount_lock (fds->refcount);
monitor_cleanup_push (_stream_fd_cleanup, fds);
_stream_fd_close0 (stream);
mu_refcount_unlock (fds->refcount);
monitor_cleanup_pop (0);
return 0;
}
int
_stream_fd_open (stream_t stream, const char *name, int port, int flags)
{
(void)stream; (void)name; (void)port; (void)flags;
return MU_ERROR_NOT_SUPPORTED;
}
int
_stream_fd_get_fd (stream_t stream, int *fd)
{
struct _stream_fd *fds = (struct _stream_fd *)stream;
if (fd == NULL)
return MU_ERROR_INVALID_PARAMETER;
*fd = fds->fd;
return 0;
}
int
_stream_fd_read (stream_t stream, void *buf, size_t buf_size, off_t offset,
size_t *br)
{
struct _stream_fd *fds = (struct _stream_fd *)stream;
int bytes = 0;
int status = 0;
if (fds->fd < 0)
{
if (br)
*br = 0;
return MU_ERROR_BAD_FILE_DESCRIPTOR;
}
fds->state = MU_STREAM_STATE_READ;
if (fds->offset != offset)
{
lseek (fds->fd, offset, SEEK_SET);
fds->offset = offset;
}
bytes = read (fds->fd, buf, buf_size);
if (bytes == -1)
{
bytes = 0;
status = errno;
}
else
fds->offset += bytes;
if (br)
*br = bytes;
return status;
}
int
_stream_fd_readline (stream_t stream, char *buf, size_t buflen,
off_t offset, size_t *br)
{
struct _stream_fd *fds = (struct _stream_fd *)stream;
int status = 0;
size_t n;
int nr = 0;
char c;
if (fds->fd < 0)
{
if (br)
*br = 0;
return MU_ERROR_BAD_FILE_DESCRIPTOR;
}
fds->state = MU_STREAM_STATE_READ;
if (fds->offset != offset)
{
lseek (fds->fd, offset, SEEK_SET);
fds->offset = offset;
}
/* Grossly inefficient hopefully they override this */
for (n = 1; n < buflen; n++)
{
nr = read (fds->fd, &c, 1);
if (nr == -1) /* Error. */
{
status = errno;
break;
}
else if (nr == 1)
{
*buf++ = c;
if (c == '\n') /* Newline is stored like fgets(). */
break;
}
else if (nr == 0)
{
if (n == 1) /* EOF, no data read. */
n = 0;
break; /* EOF, some data was read. */
}
}
if (buf)
*buf = '\0';
fds->offset = (n == buflen) ? n - 1: n;
if (br)
*br = (n == buflen) ? n - 1: n;
return status;
}
int
_stream_fd_write (stream_t stream, const void *buf, size_t buf_size,
off_t offset, size_t *bw)
{
struct _stream_fd *fds = (struct _stream_fd *)stream;
int bytes = 0;
int status = 0;
if (fds->fd < 0)
{
if (bw)
*bw = 0;
return MU_ERROR_BAD_FILE_DESCRIPTOR;
}
fds->state = MU_STREAM_STATE_WRITE;
if (fds->offset != offset)
{
lseek (fds->fd, offset, SEEK_SET);
fds->offset = offset;
}
bytes = write (fds->fd, buf, buf_size);
if (bytes == -1)
{
bytes = 0;
status = errno;
}
if (bw)
*bw = bytes;
return status;
}
int
_stream_fd_is_seekable (stream_t stream)
{
off_t off;
return _stream_fd_tell (stream, &off) == 0;
}
int
_stream_fd_tell (stream_t stream, off_t *poff)
{
struct _stream_fd *fds = (struct _stream_fd *)stream;
int err = 0;
if (poff)
{
*poff = lseek (fds->fd, 0, SEEK_CUR);
if (*poff == -1)
{
err = errno;
*poff = 0;
}
}
return err;
}
int
_stream_fd_get_size (stream_t stream, off_t *psize)
{
struct _stream_fd *fds = (struct _stream_fd *)stream;
struct stat stbuf;
int err = 0;
stbuf.st_size = 0;
if (fstat (fds->fd, &stbuf) == -1)
err = errno;
if (psize)
*psize = stbuf.st_size;
return err;
}
int
_stream_fd_truncate (stream_t stream, off_t len)
{
struct _stream_fd *fds = (struct _stream_fd *)stream;
int err = 0;
if (ftruncate (fds->fd, len) == -1)
err = errno;
return err;
}
int
_stream_fd_flush (stream_t stream)
{
(void)stream;
return 0;
}
int
_stream_fd_get_flags (stream_t stream, int *flags)
{
struct _stream_fd *fds = (struct _stream_fd *)stream;
if (flags == NULL)
return MU_ERROR_INVALID_PARAMETER;
*flags = fds->flags;
return 0;
}
int
_stream_fd_get_state (stream_t stream, enum stream_state *state)
{
struct _stream_fd *fds = (struct _stream_fd *)stream;
if (state == NULL)
return MU_ERROR_INVALID_PARAMETER;
*state = fds->state;
return 0;
}
int
_stream_fd_is_readready (stream_t stream, int timeout)
{
struct _stream_fd *fds = (struct _stream_fd *)stream;
int ready = 0;
if (fds->fd >= 0)
{
struct timeval tv;
fd_set fset;
FD_ZERO (&fset);
FD_SET (fds->fd, &fset);
tv.tv_sec = timeout / 100;
tv.tv_usec = (timeout % 1000) * 1000;
ready = select (fds->fd + 1, &fset, NULL, NULL,
(timeout == -1) ? NULL: &tv);
ready = (ready == -1) ? 0 : 1;
}
return ready;
}
int
_stream_fd_is_writeready (stream_t stream, int timeout)
{
struct _stream_fd *fds = (struct _stream_fd *)stream;
int ready = 0;
if (fds->fd >= 0)
{
struct timeval tv;
fd_set fset;
FD_ZERO (&fset);
FD_SET (fds->fd, &fset);
tv.tv_sec = timeout / 100;
tv.tv_usec = (timeout % 1000) * 1000;
ready = select (fds->fd + 1, NULL, &fset, NULL,
(timeout == -1) ? NULL: &tv);
ready = (ready == -1) ? 0 : 1;
}
return ready;
}
int
_stream_fd_is_exceptionpending (stream_t stream, int timeout)
{
struct _stream_fd *fds = (struct _stream_fd *)stream;
int ready = 0;
if (fds->fd >= 0)
{
struct timeval tv;
fd_set fset;
FD_ZERO (&fset);
FD_SET (fds->fd, &fset);
tv.tv_sec = timeout / 100;
tv.tv_usec = (timeout % 1000) * 1000;
ready = select (fds->fd + 1, NULL, NULL, &fset,
(timeout == -1) ? NULL: &tv);
ready = (ready == -1) ? 0 : 1;
}
return 0;
}
int
_stream_fd_is_open (stream_t stream)
{
struct _stream_fd *fds = (struct _stream_fd *)stream;
return fds->fd >= 0;
}
static struct _stream_vtable _stream_fd_vtable =
{
_stream_fd_ref,
_stream_fd_destroy,
_stream_fd_open,
_stream_fd_close,
_stream_fd_read,
_stream_fd_readline,
_stream_fd_write,
_stream_fd_tell,
_stream_fd_get_size,
_stream_fd_truncate,
_stream_fd_flush,
_stream_fd_get_fd,
_stream_fd_get_flags,
_stream_fd_get_state,
_stream_fd_is_seekable,
_stream_fd_is_readready,
_stream_fd_is_writeready,
_stream_fd_is_exceptionpending,
_stream_fd_is_open
};
int
_stream_fd_ctor (struct _stream_fd *fds, int fd)
{
mu_refcount_create (&fds->refcount);
if (fds->refcount == NULL)
return MU_ERROR_NO_MEMORY;
fds->fd = fd;
fds->base.vtable = &_stream_fd_vtable;
return 0;
}
void
_stream_fd_dtor (stream_t stream)
{
struct _stream_fd *fds = (struct _stream_fd *)stream;
if (fds)
mu_refcount_destroy (&fds->refcount);
}
int
stream_fd_create (stream_t *pstream, int fd)
{
struct _stream_fd *fds;
int status;
if (pstream == NULL || fd < 0)
return MU_ERROR_INVALID_PARAMETER;
fds = calloc (1, sizeof *fds);
if (fds == NULL)
return MU_ERROR_NO_MEMORY;
status = _stream_fd_ctor (fds, fd);
if (status != 0)
{
free (fds);
return status;
}
*pstream = &fds->base;
return 0;
}
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <stdlib.h>
#include <mailutils/error.h>
#include <mailutils/sys/folder.h>
int
folder_ref (folder_t folder)
{
if (folder == NULL || folder->vtable == NULL
|| folder->vtable->ref == NULL)
return MU_ERROR_NOT_SUPPORTED;
return folder->vtable->ref (folder);
}
void
folder_destroy (folder_t *pfolder)
{
if (pfolder && *pfolder)
{
folder_t folder = *pfolder;
if (folder->vtable && folder->vtable->destroy)
folder->vtable->destroy (pfolder);
*pfolder = NULL;
}
}
int
folder_open (folder_t folder, int flag)
{
if (folder == NULL || folder->vtable == NULL
|| folder->vtable->open == NULL)
return MU_ERROR_NOT_SUPPORTED;
return folder->vtable->open (folder, flag);
}
int
folder_close (folder_t folder)
{
if (folder == NULL || folder->vtable == NULL
|| folder->vtable->close == NULL)
return MU_ERROR_NOT_SUPPORTED;
return folder->vtable->close (folder);
}
int
folder_delete (folder_t folder, const char *name)
{
if (folder == NULL || folder->vtable == NULL
|| folder->vtable->delete == NULL)
return MU_ERROR_NOT_SUPPORTED;
return folder->vtable->delete (folder, name);
}
int
folder_rename (folder_t folder, const char *oldname, const char *newname)
{
if (folder == NULL || folder->vtable == NULL
|| folder->vtable->rename == NULL)
return MU_ERROR_NOT_SUPPORTED;
return folder->vtable->rename (folder, oldname, newname);
}
int
folder_subscribe (folder_t folder, const char *name)
{
if (folder == NULL || folder->vtable == NULL
|| folder->vtable->subscribe == NULL)
return MU_ERROR_NOT_SUPPORTED;
return folder->vtable->subscribe (folder, name);
}
int
folder_unsubscribe (folder_t folder, const char *name)
{
if (folder == NULL || folder->vtable == NULL
|| folder->vtable->unsubscribe == NULL)
return MU_ERROR_NOT_SUPPORTED;
return folder->vtable->unsubscribe (folder, name);
}
int
folder_list (folder_t folder, const char *dir, const char *name,
iterator_t *iterator)
{
if (folder == NULL || folder->vtable == NULL
|| folder->vtable->list == NULL)
return MU_ERROR_NOT_SUPPORTED;
return folder->vtable->list (folder, dir, name, iterator);
}
int
folder_lsub (folder_t folder, const char *dir, const char *name,
iterator_t *iterator)
{
if (folder == NULL || folder->vtable == NULL
|| folder->vtable->lsub == NULL)
return MU_ERROR_NOT_SUPPORTED;
return folder->vtable->lsub (folder, dir, name, iterator);
}
/* Stream settings. */
int
folder_get_stream (folder_t folder, stream_t *stream)
{
if (folder == NULL || folder->vtable == NULL
|| folder->vtable->get_stream == NULL)
return MU_ERROR_NOT_SUPPORTED;
return folder->vtable->get_stream (folder, stream);
}
int
folder_set_stream (folder_t folder, stream_t stream)
{
if (folder == NULL || folder->vtable == NULL
|| folder->vtable->set_stream == NULL)
return MU_ERROR_NOT_SUPPORTED;
return folder->vtable->set_stream (folder, stream);
}
/* Notifications. */
int
folder_get_observable (folder_t folder, observable_t *observable)
{
if (folder == NULL || folder->vtable == NULL
|| folder->vtable->get_observable == NULL)
return MU_ERROR_NOT_SUPPORTED;
return folder->vtable->get_observable (folder, observable);
}
int
folder_get_debug (folder_t folder, mu_debug_t *debug)
{
if (folder == NULL || folder->vtable == NULL
|| folder->vtable->get_debug == NULL)
return MU_ERROR_NOT_SUPPORTED;
return folder->vtable->get_debug (folder, debug);
}
int
folder_set_debug (folder_t folder, mu_debug_t debug)
{
if (folder == NULL || folder->vtable == NULL
|| folder->vtable->set_debug == NULL)
return MU_ERROR_NOT_SUPPORTED;
return folder->vtable->set_debug (folder, debug);
}
/* Authentication. */
int
folder_get_authority (folder_t folder, authority_t *authority)
{
if (folder == NULL || folder->vtable == NULL
|| folder->vtable->get_authority == NULL)
return MU_ERROR_NOT_SUPPORTED;
return folder->vtable->get_authority (folder, authority);
}
int
folder_set_authority (folder_t folder, authority_t authority)
{
if (folder == NULL || folder->vtable == NULL
|| folder->vtable->set_authority == NULL)
return MU_ERROR_NOT_SUPPORTED;
return folder->vtable->set_authority (folder, authority);
}
/* URL. */
int
folder_get_url (folder_t folder, url_t *url)
{
if (folder == NULL || folder->vtable == NULL
|| folder->vtable->get_url == NULL)
return MU_ERROR_NOT_SUPPORTED;
return folder->vtable->get_url (folder, url);
}
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <stdlib.h>
#include <string.h>
#include <mailutils/error.h>
#include <mailutils/sys/header.h>
int
header_ref (header_t header)
{
if (header == NULL || header->vtable == NULL
|| header->vtable->ref == NULL)
return MU_ERROR_NOT_SUPPORTED;
return header->vtable->ref (header);
}
void
header_destroy (header_t *pheader)
{
if (pheader && *pheader)
{
header_t header = *pheader;
if (header->vtable && header->vtable->destroy)
header->vtable->destroy (pheader);
*pheader = NULL;
}
}
int
header_is_modified (header_t header)
{
if (header == NULL || header->vtable == NULL
|| header->vtable->is_modified == NULL)
return MU_ERROR_NOT_SUPPORTED;
return header->vtable->is_modified (header);
}
int
header_clear_modified (header_t header)
{
if (header == NULL || header->vtable == NULL
|| header->vtable->clear_modified == NULL)
return MU_ERROR_NOT_SUPPORTED;
return header->vtable->clear_modified (header);
}
int
header_set_value (header_t header, const char *fn, const char *fv, int replace)
{
if (header == NULL || header->vtable == NULL
|| header->vtable->set_value == NULL)
return MU_ERROR_NOT_SUPPORTED;
return header->vtable->set_value (header, fn, fv, replace);
}
int
header_get_value (header_t header, const char *name, char *buffer,
size_t buflen, size_t *pn)
{
if (header == NULL || header->vtable == NULL
|| header->vtable->get_value == NULL)
return MU_ERROR_NOT_SUPPORTED;
return header->vtable->get_value (header, name, buffer, buflen, pn);
}
int
header_aget_value (header_t header, const char *name, char **pvalue)
{
char *value;
size_t n = 0;
int status = header_get_value (header, name, NULL, 0, &n);
if (status == 0)
{
value = calloc (n + 1, 1);
if (value == NULL)
return MU_ERROR_NO_MEMORY;
header_get_value (header, name, value, n + 1, NULL);
*pvalue = value;
}
return status;
}
int
header_get_field_count (header_t header, size_t *pcount)
{
if (header == NULL || header->vtable == NULL
|| header->vtable->get_field_count == NULL)
return MU_ERROR_NOT_SUPPORTED;
return header->vtable->get_field_count (header, pcount);
}
int
header_get_field_name (header_t header, size_t num, char *buf,
size_t buflen, size_t *pn)
{
if (header == NULL || header->vtable == NULL
|| header->vtable->get_field_name == NULL)
return MU_ERROR_NOT_SUPPORTED;
return header->vtable->get_field_name (header, num, buf, buflen, pn);
}
int
header_aget_field_name (header_t header, size_t num, char **pvalue)
{
char *value;
size_t n = 0;
int status = header_get_field_name (header, num, NULL, 0, &n);
if (status == 0)
{
value = calloc (n + 1, 1);
if (value == NULL)
return MU_ERROR_NO_MEMORY;
header_get_field_name (header, num, value, n + 1, NULL);
*pvalue = value;
}
return status;
}
int
header_get_field_value (header_t header, size_t num, char *buf,
size_t buflen, size_t *pn)
{
if (header == NULL || header->vtable == NULL
|| header->vtable->get_field_value == NULL)
return MU_ERROR_NOT_SUPPORTED;
return header->vtable->get_field_value (header, num, buf, buflen, pn);
}
int
header_aget_field_value (header_t header, size_t num, char **pvalue)
{
char *value;
size_t n = 0;
int status = header_get_field_value (header, num, NULL, 0, &n);
if (status == 0)
{
value = calloc (n + 1, 1);
if (value == NULL)
return MU_ERROR_NO_MEMORY;
header_get_field_value (header, num, value, n + 1, NULL);
*pvalue = value;
}
return status;
}
int
header_get_lines (header_t header, size_t *plines)
{
if (header == NULL || header->vtable == NULL
|| header->vtable->get_lines == NULL)
return MU_ERROR_NOT_SUPPORTED;
return header->vtable->get_lines (header, plines);
}
int
header_get_size (header_t header, size_t *psize)
{
if (header == NULL || header->vtable == NULL
|| header->vtable->get_size == NULL)
return MU_ERROR_NOT_SUPPORTED;
return header->vtable->get_size (header, psize);
}
int
header_get_stream (header_t header, stream_t *pstream)
{
if (header == NULL || header->vtable == NULL
|| header->vtable->get_stream == NULL)
return MU_ERROR_NOT_SUPPORTED;
return header->vtable->get_stream (header, pstream);
}
## Process this file with GNU Automake to create Makefile.in
## Copyright (C) 2001, 2002 Free Software Foundation, Inc.
##
## GNU Mailutils is free software; you can redistribute it and/or
## modify it under the terms of the GNU 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 General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
SUBDIRS = mailutils
## Process this file with GNU Automake to create Makefile.in
## Copyright (C) 2001, 2002 Free Software Foundation, Inc.
##
## GNU Mailutils is free software; you can redistribute it and/or
## modify it under the terms of the GNU 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 General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
SUBDIRS = sys
pkginclude_HEADERS = \
address.h \
attribute.h \
authority.h \
body.h \
debug.h \
envelope.h \
error.h \
folder.h \
header.h \
iterator.h \
list.h \
lockfile.h \
mailbox.h \
mbox.h \
md5-rsa.h \
message.h \
monitor.h \
mu_features.h \
mutil.h \
observable.h \
observer.h \
parse822.h \
pop3.h \
property.h \
refcount.h \
stream.h \
ticket.h \
types.h \
url.h
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef _MAILUTILS_ADDRESS_H
#define _MAILUTILS_ADDRESS_H
#include <sys/types.h>
#include <mailutils/mu_features.h>
#include <mailutils/types.h>
#ifdef __cplusplus
extern "C" {
#endif
extern int address_create __P ((address_t *, const char *));
extern int address_ref __P ((address_t));
extern void address_destroy __P ((address_t *));
extern int address_get_email
__P ((address_t, size_t, char *, size_t, size_t *));
extern int address_get_local_part
__P ((address_t, size_t, char *, size_t, size_t *));
extern int address_get_domain
__P ((address_t, size_t, char *, size_t, size_t *));
extern int address_get_personal
__P ((address_t, size_t, char *, size_t, size_t *));
extern int address_get_comments
__P ((address_t, size_t, char *, size_t, size_t *));
extern int address_get_route
__P ((address_t, size_t, char *, size_t, size_t *));
extern int address_is_group
__P ((address_t, size_t, int*));
extern int address_to_string __P ((address_t, char *, size_t, size_t *));
extern int address_get_count __P ((address_t, size_t *));
#ifdef __cplusplus
}
#endif
#endif /* _MAILUTILS_ADDRESS_H */
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef _MAILUTILS_ATTRIBUTE_H
#define _MAILUTILS_ATTRIBUTE_H
#include <mailutils/mu_features.h>
#include <mailutils/types.h>
#ifdef __cplusplus
extern "C" {
#endif
#define MU_ATTRIBUTE_ANSWERED 0x000001
#define MU_ATTRIBUTE_FLAGGED 0x000002
#define MU_ATTRIBUTE_DELETED 0x000004
#define MU_ATTRIBUTE_DRAFT 0x000008
#define MU_ATTRIBUTE_SEEN 0x000010
#define MU_ATTRIBUTE_READ 0x000020
#define MU_ATTRIBUTE_MODIFIED 0x100000
#define MU_ATTRIBUTE_RECENT 0x000000
extern int attribute_ref __P ((attribute_t));
extern void attribute_destroy __P ((attribute_t *));
extern int attribute_is_seen __P ((attribute_t));
extern int attribute_is_answered __P ((attribute_t));
extern int attribute_is_flagged __P ((attribute_t));
extern int attribute_is_deleted __P ((attribute_t));
extern int attribute_is_draft __P ((attribute_t));
extern int attribute_is_recent __P ((attribute_t));
extern int attribute_is_read __P ((attribute_t));
extern int attribute_is_modified __P ((attribute_t));
extern int attribute_set_seen __P ((attribute_t));
extern int attribute_set_answered __P ((attribute_t));
extern int attribute_set_flagged __P ((attribute_t));
extern int attribute_set_deleted __P ((attribute_t));
extern int attribute_set_draft __P ((attribute_t));
extern int attribute_set_recent __P ((attribute_t));
extern int attribute_set_read __P ((attribute_t));
extern int attribute_set_modified __P ((attribute_t));
extern int attribute_unset_seen __P ((attribute_t));
extern int attribute_unset_answered __P ((attribute_t));
extern int attribute_unset_flagged __P ((attribute_t));
extern int attribute_unset_deleted __P ((attribute_t));
extern int attribute_unset_draft __P ((attribute_t));
extern int attribute_unset_recent __P ((attribute_t));
extern int attribute_unset_read __P ((attribute_t));
extern int attribute_unset_modified __P ((attribute_t));
extern int attribute_is_userflags __P ((attribute_t, int));
extern int attribute_set_userflags __P ((attribute_t, int));
extern int attribute_unset_userflags __P ((attribute_t, int));
extern int attribute_get_userflags __P ((attribute_t, int *));
extern int attribute_clear_userflags __P ((attribute_t));
extern int attribute_get_flags __P ((attribute_t, int *));
extern int attribute_set_flags __P ((attribute_t, int));
extern int attribute_unset_flags __P ((attribute_t, int));
extern int attribute_clear_flags __P ((attribute_t));
extern int attribute_is_equal __P ((attribute_t, attribute_t));
extern int attribute_copy __P ((attribute_t dst, attribute_t src));
extern int attribute_default_create __P ((attribute_t *));
extern int attribute_status_create __P ((attribute_t *, const char *));
#ifdef __cplusplus
}
#endif
#endif /* _MAILUTILS_ATTRIBUTE_H */
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef _MAILUTILS_AUTHORITY_H
#define _MAILUTILS_AUTHORITY_H
#include <mailutils/types.h>
#ifdef __cplusplus
extern "C" {
#endif
extern int authority_ref __P ((authority_t));
extern void authority_destroy __P ((authority_t *));
extern int authority_set_ticket __P ((authority_t, ticket_t));
extern int authority_get_ticket __P ((authority_t, ticket_t *));
extern int authority_authenticate __P ((authority_t));
extern int authority_userpass_create __P ((authority_t *));
#ifdef __cplusplus
}
#endif
#endif /* _MAILUTILS_AUTHORITY_H */
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef _MAILUTILS_BODY_H
#define _MAILUTILS_BODY_H
#include <sys/types.h>
#include <mailutils/mu_features.h>
#include <mailutils/types.h>
#include <mailutils/property.h>
#include <mailutils/stream.h>
#ifdef __cplusplus
extern "C" {
#endif
/* forward declaration */
extern int body_ref __P ((body_t));
extern void body_release __P ((body_t *));
extern int body_destroy __P ((body_t));
extern int body_is_modified __P ((body_t));
extern int body_clear_modified __P ((body_t));
extern int body_get_stream __P ((body_t, stream_t *));
extern int body_get_property __P ((body_t, property_t *));
extern int body_get_size __P ((body_t, size_t*));
extern int body_get_lines __P ((body_t, size_t *));
#ifdef __cplusplus
}
#endif
#endif /* _MAILUTILS_BODY_H */
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef _MAILUTILS_DEBUG_H
#define _MAILUTILS_DEBUG_H
#include <sys/types.h>
#include <mailutils/mu_features.h>
#include <mailutils/types.h>
#include <mailutils/stream.h>
#ifdef __cplusplus
extern "C" {
#endif
#define MU_DEBUG_TRACE 1
#define MU_DEBUG_PROT 2
extern int mu_debug_ref __P ((mu_debug_t));
extern void mu_debug_destroy __P ((mu_debug_t *));
extern int mu_debug_set_level __P ((mu_debug_t, unsigned int));
extern int mu_debug_get_level __P ((mu_debug_t, unsigned int *));
extern int mu_debug_print __P ((mu_debug_t, unsigned int, const char *));
extern int mu_debug_stream_create __P ((mu_debug_t *, stream_t, int));
#ifdef __cplusplus
}
#endif
#endif /* _MAILUTILS_DEBUG_H */
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef _MAILUTILS_ENVELOPE_H
# define _MAILUTILS_ENVELOPE_H
#include <mailutils/mu_features.h>
#include <mailutils/types.h>
#include <mailutils/address.h>
#include <mailutils/mutil.h>
#ifdef __cplusplus
extern "C" {
#endif
extern int envelope_ref __P ((envelope_t));
extern void envelope_destroy __P ((envelope_t *));
extern int envelope_get_sender __P ((envelope_t, address_t *));
extern int envelope_set_sender __P ((envelope_t, address_t));
extern int envelope_get_recipient __P ((envelope_t, address_t *));
extern int envelope_set_recipient __P ((envelope_t, address_t));
extern int envelope_get_date __P ((envelope_t, struct tm *, struct mu_timezone *));
extern int envelope_set_date __P ((envelope_t, struct tm *, struct mu_timezone *));
#ifdef __cplusplus
}
#endif
#endif /* _MAILUTILS_ENVELOPE_H */
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef _MAILUTILS_ERROR_H
#define _MAILUTILS_ERROR_H
#include <errno.h>
#ifdef __cplusplus
extern "C" {
#endif
/* When Possible use the platform error for our needs. */
#ifndef MU_ERROR_RANGE
# define MU_ERROR_RANGE 600
#endif
/* Error codes. */
#define MU_ERROR_OK 0
#if defined (EINVAL)
# define MU_ERROR_INVALID_PARAMETER EINVAL
#else
# define MU_ERROR_INVALID_PARAMETER (MU_ERROR_RANGE + 1)
#endif
#if defined (ENOMEM)
# define MU_ERROR_NO_MEMORY ENOMEM
#else
# define MU_ERROR_NO_MEMORY (MU_ERROR_RANGE + 2)
#endif
#if defined (EIO)
# define MU_ERROR_IO EIO
#else
# define MU_ERROR_IO (MU_ERROR_RANGE + 3)
#endif
#if defined (EINTR)
# define MU_ERROR_INTERRUPT EINTR
#else
# define MU_ERROR_INTERRUPT (MU_ERROR_RANGE + 4)
#endif
#if defined (ENOSYS)
# define MU_ERROR_NOT_SUPPORTED ENOSYS
#else
# define MU_ERROR_NOT_SUPPORTED (MU_ERROR_RANGE + 5)
#endif
#if defined (EACCESS)
# define MU_ERROR_OPERATION_DENIED EACCESS
#else
# define MU_ERROR_OPERATION_DENIED (MU_ERROR_RANGE + 6)
#endif
#if defined (ETIMEOUT)
# define MU_ERROR_TIMEOUT ETIMEOUT
#else
# define MU_ERROR_TIMEOUT (MU_ERROR_RANGE + 7)
#endif
#if defined (EAGAIN)
# define MU_ERROR_TRY_AGAIN EAGAIN
#else
# define MU_ERROR_TRY_AGAIN (MU_ERROR_RANGE + 8)
#endif
#if defined (ENOLCK)
# define MU_ERROR_NO_LOCK ENOLCK
#else
# define MU_ERROR_NO_LOCK (MU_ERROR_RANGE + 9)
#endif
#if defined (EINPROGRESS)
# define MU_ERROR_OPERATION_IN_PROGRESS EINPROGRESS
#else
# define MU_ERROR_OPERATION_IN_PROGRESS (MU_ERROR_RANGE + 10)
#endif
#if defined (EBUSY)
# define MU_ERROR_RESOURCE_BUSY EBUSY
#else
# define MU_ERROR_RESOURCE_BUSY (MU_ERROR_RANGE + 11)
#endif
#if defined (ESPIPE)
# define MU_ERROR_INVALID_SEEK ESPIPE
#else
# define MU_ERROR_INVALID_SEEK (MU_ERROR_RANGE + 12)
#endif
#if defined (ECANCELED)
# define MU_ERROR_OPERATION_CANCELED ECANCELED
#else
# define MU_ERROR_OPERATION_CANCELED (MU_ERROR_RANGE + 13)
#endif
#if defined (EBADF)
# define MU_ERROR_FD_INVALID EBADF
#else
# define MU_ERROR_FD_INVALID (MU_ERROR_RANGE + 14)
#endif
#if defined (ENOENT)
# define MU_ERROR_ENTRY_NOT_EXIST ENOENT
#else
# define MU_ERROR_ENTRY_NOT_EXIST (MU_ERROR_RANGE + 15)
#endif
#if defined (EEXIST)
# define MU_ERROR_ENTRY_EXIST EEXIST
#else
# define MU_ERROR_ENTRY_EXIST (MU_ERROR_RANGE + 16)
#endif
#if defined (ENOTDIR)
# define MU_ERROR_NO_DIRECTORY ENOTDIR
#else
# define MU_ERROR_NO_DIRECTORY (MU_ERROR_RANGE + 17)
#endif
#if defined (EBADFD)
# define MU_ERROR_BAD_FILE_DESCRIPTOR EBADFD
#else
# define MU_ERROR_BAD_FILE_DESCRIPTOR (MU_ERROR_RANGE + 18)
#endif
#ifdef __cplusplus
}
#endif
#endif /* _MAILUTILS_ERROR_H */
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef _MAILUTILS_FOLDER_H
# define _MAILUTILS_FOLDER_H
#include <sys/types.h>
#include <mailutils/mu_features.h>
#include <mailutils/types.h>
#include <mailutils/url.h>
#include <mailutils/observable.h>
#include <mailutils/debug.h>
#include <mailutils/stream.h>
#include <mailutils/authority.h>
#include <mailutils/stream.h>
#include <mailutils/iterator.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Forward declaration. */
#define MU_FOLDER_ATTRIBUTE_DIRECTORY 0x001
#define MU_FOLDER_ATTRIBUTE_FILE 0x002
struct list_response
{
int type;
int separator;
char *name;
};
extern int folder_create __P ((folder_t *, const char *));
extern int folder_ref __P ((folder_t));
extern void folder_destroy __P ((folder_t *));
extern int folder_open __P ((folder_t, int));
extern int folder_close __P ((folder_t));
extern int folder_delete __P ((folder_t, const char *));
extern int folder_rename __P ((folder_t, const char *, const char *));
extern int folder_subscribe __P ((folder_t, const char *));
extern int folder_unsubscribe __P ((folder_t, const char *));
extern int folder_list __P ((folder_t, const char *, const char *,
iterator_t *));
extern int folder_lsub __P ((folder_t, const char *, const char *,
iterator_t *));
/* Stream settings. */
extern int folder_get_stream __P ((folder_t, stream_t *));
extern int folder_set_stream __P ((folder_t, stream_t));
/* Notifications. */
extern int folder_get_observable __P ((folder_t, observable_t *));
extern int folder_get_debug __P ((folder_t, mu_debug_t *));
extern int folder_set_debug __P ((folder_t, mu_debug_t));
/* Authentication. */
extern int folder_get_authority __P ((folder_t, authority_t *));
extern int folder_set_authority __P ((folder_t, authority_t));
/* URL. */
extern int folder_get_url __P ((folder_t, url_t *));
#ifdef __cplusplus
}
#endif
#endif /* _MAILUTILS_FOLDER_H */
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef _MAILUTILS_HEADER_H
#define _MAILUTILS_HEADER_H
#include <sys/types.h>
#include <mailutils/mu_features.h>
#include <mailutils/types.h>
#include <mailutils/stream.h>
#ifdef __cplusplus
extern "C" {
#endif
#define MU_HEADER_UNIX_FROM "From "
#define MU_HEADER_RETURN_PATH "Return-Path"
#define MU_HEADER_RECEIVED "Received"
#define MU_HEADER_DATE "Date"
#define MU_HEADER_FROM "From"
#define MU_HEADER_SENDER "Sender"
#define MU_HEADER_RESENT_FROM "Resent-From"
#define MU_HEADER_SUBJECT "Subject"
#define MU_HEADER_SENDER "Sender"
#define MU_HEADER_RESENT_SENDER "Resent-SENDER"
#define MU_HEADER_TO "To"
#define MU_HEADER_RESENT_TO "Resent-To"
#define MU_HEADER_CC "Cc"
#define MU_HEADER_RESENT_CC "Resent-Cc"
#define MU_HEADER_BCC "Bcc"
#define MU_HEADER_RESENT_BCC "Resent-Bcc"
#define MU_HEADER_REPLY_TO "Reply-To"
#define MU_HEADER_RESENT_REPLY_TO "Resent-Reply-To"
#define MU_HEADER_MESSAGE_ID "Message-ID"
#define MU_HEADER_RESENT_MESSAGE_ID "Resent-Message-ID"
#define MU_HEADER_IN_REPLY_TO "In-Reply-To"
#define MU_HEADER_REFERENCE "Reference"
#define MU_HEADER_ENCRYPTED "Encrypted"
#define MU_HEADER_PRECEDENCE "Precedence"
#define MU_HEADER_STATUS "Status"
#define MU_HEADER_CONTENT_LENGTH "Content-Length"
#define MU_HEADER_CONTENT_LANGUAGE "Content-Language"
#define MU_HEADER_CONTENT_TRANSFER_ENCODING "Content-transfer-encoding"
#define MU_HEADER_CONTENT_ID "Content-ID"
#define MU_HEADER_CONTENT_TYPE "Content-Type"
#define MU_HEADER_CONTENT_DESCRIPTION "Content-Description"
#define MU_HEADER_CONTENT_DISPOSITION "Content-Disposition"
#define MU_HEADER_CONTENT_MD5 "Content-MD5"
#define MU_HEADER_MIME_VERSION "MIME-Version"
#define MU_HEADER_X_UIDL "X-UIDL"
#define MU_HEADER_X_UID "X-UID"
#define MU_HEADER_X_IMAPBASE "X-IMAPbase"
/* Mime support header attribute */
extern int header_ref __P ((header_t));
extern void header_destroy __P ((header_t *));
extern int header_is_modified __P ((header_t));
extern int header_clear_modified __P ((header_t));
extern int header_set_value __P ((header_t, const char *,
const char *, int));
extern int header_get_value __P ((header_t, const char *, char *,
size_t, size_t *));
extern int header_aget_value __P ((header_t, const char *, char **));
extern int header_get_field_count __P ((header_t, size_t *));
extern int header_get_field_value __P ((header_t, size_t, char *,
size_t, size_t *));
extern int header_aget_field_value __P ((header_t, size_t, char **));
extern int header_get_field_name __P ((header_t, size_t, char *,
size_t, size_t *));
extern int header_aget_field_name __P ((header_t, size_t, char **));
extern int header_get_stream __P ((header_t, stream_t *));
extern int header_set_stream __P ((header_t, stream_t, void *));
extern int header_get_size __P ((header_t, size_t *));
extern int header_get_lines __P ((header_t, size_t *));
extern int header_create __P ((header_t *, const char *, size_t));
#ifdef __cplusplus
}
#endif
#endif /* _MAILUTILS_HEADER_H */
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef _MAILUTILS_ITERATOR_H
#define _MAILUTILS_ITERATOR_H
#include <mailutils/mu_features.h>
#include <mailutils/types.h>
#ifdef __cplusplus
extern "C" {
#endif
extern int iterator_ref __P ((iterator_t));
extern void iterator_destroy __P ((iterator_t *));
extern int iterator_first __P ((iterator_t));
extern int iterator_next __P ((iterator_t));
extern int iterator_current __P ((iterator_t, void *));
extern int iterator_is_done __P ((iterator_t));
#ifdef __cplusplus
}
#endif
#endif /* _MAILUTILS_ITERATOR_H */
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef _MAILUTILS_LIST_H
#define _MAILUTILS_LIST_H
#include <sys/types.h>
#include <mailutils/mu_features.h>
#include <mailutils/types.h>
#include <mailutils/iterator.h>
#ifdef __cplusplus
extern "C" {
#endif
extern int mu_list_create __P ((mu_list_t *));
extern int mu_list_ref __P ((mu_list_t));
extern void mu_list_destroy __P ((mu_list_t *));
extern int mu_list_append __P ((mu_list_t, void *));
extern int mu_list_prepend __P ((mu_list_t, void *));
extern int mu_list_is_empty __P ((mu_list_t));
extern int mu_list_count __P ((mu_list_t, size_t *));
extern int mu_list_remove __P ((mu_list_t, void *));
extern int mu_list_get __P ((mu_list_t, size_t, void **));
extern int mu_list_get_iterator __P ((mu_list_t, iterator_t *));
#ifdef __cplusplus
}
#endif
#endif /* _MAILUTILS_LIST_H */
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef _MAILUTILS_LOCKFILE_H
#define _MAILUTILS_LOCKFILE_H
#include <sys/types.h>
#include <mailutils/mu_features.h>
#include <mailutils/types.h>
#ifdef __cplusplus
extern "C" {
#endif
extern int lockfile_ref __P ((lockfile_t));
extern void lockfile_destroy __P ((lockfile_t *));
extern int lockfile_lock __P ((lockfile_t));
extern int lockfile_touchlock __P ((lockfile_t));
extern int lockfile_unlock __P ((lockfile_t));
extern int lockfile_dotlock_create __P ((lockfile_t *, const char *filename));
extern int lockfile_nfslock_create __P ((lockfile_t *, const char *filename));
#ifdef __cplusplus
}
#endif
#endif /* _MAILUTILS_LOCKFILE_H */
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef _MAILUTILS_MAILBOX_H
#define _MAILUTILS_MAILBOX_H
#include <mailutils/mu_features.h>
#include <mailutils/types.h>
#include <mailutils/url.h>
#include <mailutils/observer.h>
#include <mailutils/debug.h>
#include <mailutils/property.h>
#include <mailutils/message.h>
#include <mailutils/authority.h>
#include <mailutils/stream.h>
#include <mailutils/folder.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Constructor/destructor and possible types. */
extern int mailbox_ref __P ((mailbox_t));
extern void mailbox_destroy __P ((mailbox_t *));
extern int mailbox_get_folder __P ((mailbox_t, folder_t *));
extern int mailbox_open __P ((mailbox_t, int));
extern int mailbox_close __P ((mailbox_t));
extern int mailbox_uidvalidity __P ((mailbox_t, unsigned long *));
extern int mailbox_uidnext __P ((mailbox_t, size_t *));
/* Messages. */
extern int mailbox_get_message __P ((mailbox_t, size_t, message_t *));
extern int mailbox_append_message __P ((mailbox_t, message_t));
extern int mailbox_messages_count __P ((mailbox_t, size_t *));
extern int mailbox_messages_recent __P ((mailbox_t, size_t *));
extern int mailbox_messages_unseen __P ((mailbox_t, size_t *));
extern int mailbox_expunge __P ((mailbox_t));
extern int mailbox_save_attributes __P ((mailbox_t));
/* Update and scanning. */
extern int mailbox_get_size __P ((mailbox_t, off_t *));
extern int mailbox_is_updated __P ((mailbox_t));
extern int mailbox_scan __P ((mailbox_t, size_t, size_t *));
/* Mailbox Stream. */
extern int mailbox_get_stream __P ((mailbox_t, stream_t *));
/* Authentication. */
extern int mailbox_get_authority __P ((mailbox_t, authority_t *));
extern int mailbox_set_authority __P ((mailbox_t, authority_t));
/* Property. */
extern int mailbox_get_property __P ((mailbox_t, property_t *));
/* URL. */
extern int mailbox_get_url __P ((mailbox_t, url_t *));
/* For any debuging */
extern int mailbox_get_debug __P ((mailbox_t, mu_debug_t *));
extern int mailbox_set_debug __P ((mailbox_t, mu_debug_t));
/* Events. */
extern int mailbox_get_observable __P ((mailbox_t, observable_t *));
extern int mailbox_create __P ((mailbox_t *, const char *));
extern int mailbox_create_default __P ((mailbox_t *, const char *));
#ifdef __cplusplus
}
#endif
#endif /* _MAILUTILS_MAILBOX_H */
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef _MAILUTILS_MBOX_H
#define _MAILUTILS_MBOX_H
#include <mailutils/mu_features.h>
#include <mailutils/types.h>
#include <mailutils/stream.h>
#include <mailutils/attribute.h>
#include <mailutils/debug.h>
#ifdef __cplusplus
extern "C" {
#endif
extern int mbox_create __P ((mbox_t *));
extern void mbox_destroy __P ((mbox_t *));
extern int mbox_get_uidvalidity __P ((mbox_t, unsigned long *));
extern int mbox_get_uidnext __P ((mbox_t, unsigned long *));
extern int mbox_open __P ((mbox_t, const char *, int));
extern int mbox_close __P ((mbox_t));
extern int mbox_get_hstream __P ((mbox_t, unsigned int, stream_t *));
extern int mbox_set_hstream __P ((mbox_t, unsigned int, stream_t));
extern int mbox_get_hsize __P ((mbox_t, unsigned int, unsigned int *));
extern int mbox_get_hlines __P ((mbox_t, unsigned int, unsigned int *));
extern int mbox_get_bstream __P ((mbox_t, unsigned int, stream_t *));
extern int mbox_set_bstream __P ((mbox_t, unsigned int, stream_t));
extern int mbox_get_bsize __P ((mbox_t, unsigned int, unsigned int *));
extern int mbox_get_blines __P ((mbox_t, unsigned int, unsigned int *));
extern int mbox_get_attribute __P ((mbox_t, unsigned int, attribute_t *));
extern int mbox_get_uid __P ((mbox_t, unsigned int, unsigned long *));
extern int mbox_get_size __P ((mbox_t, off_t *));
extern int mbox_get_separator __P ((mbox_t, unsigned int, char **));
extern int mbox_set_separator __P ((mbox_t, unsigned int, const char *));
extern int mbox_expunge __P ((mbox_t));
extern int mbox_save __P ((mbox_t));
extern int mbox_has_newmail __P ((mbox_t));
extern int mbox_set_progress_cb __P ((mbox_t,
int (*) __P ((int, void *)), void *));
extern int mbox_set_newmsg_cb __P ((mbox_t,
int (*) __P ((int, void *)), void *));
extern int mbox_set_error_cb __P ((mbox_t,
int (*) __P ((int, void *)), void *));
extern int mbox_scan __P ((mbox_t, unsigned int, unsigned int *));
extern int mbox_count __P ((mbox_t, unsigned int *));
extern int mbox_append __P ((mbox_t, const char *, attribute_t,
stream_t));
extern int mbox_append_hb __P ((mbox_t, const char *, attribute_t,
stream_t, stream_t));
extern int mbox_get_carrier __P ((mbox_t, stream_t *));
extern int mbox_set_carrier __P ((mbox_t, stream_t));
extern int mbox_set_hcache __P ((mbox_t, const char **, size_t));
extern int mbox_add_hcache __P ((mbox_t, const char **, size_t));
extern int mbox_value_hcache __P ((mbox_t, unsigned int, const char *,
char *, size_t, size_t *));
extern int mbox_get_debug __P ((mbox_t, mu_debug_t *));
extern int mbox_set_debug __P ((mbox_t, mu_debug_t));
#ifdef __cplusplus
}
#endif
#endif /* _MAILUTILS_MBOX_H */
/* MD5.H - header file for MD5C.C
*/
/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
rights reserved.
License to copy and use this software is granted provided that it
is identified as the "RSA Data Security, Inc. MD5 Message-Digest
Algorithm" in all material mentioning or referencing this software
or this function.
License is also granted to make and use derivative works provided
that such works are identified as "derived from the RSA Data
Security, Inc. MD5 Message-Digest Algorithm" in all material
mentioning or referencing the derived work.
RSA Data Security, Inc. makes no representations concerning either
the merchantability of this software or the suitability of this
software for any particular purpose. It is provided "as is"
without express or implied warranty of any kind.
These notices must be retained in any copies of any part of this
documentation and/or software.
*/
/* GLOBAL.H - RSAREF types and constants
*/
/* PROTOTYPES should be set to one if and only if the compiler supports
function argument prototyping.
The following makes PROTOTYPES default to 0 if it has not already
been defined with C compiler flags.
*/
#ifndef PROTOTYPES
#define PROTOTYPES 0
#endif
/* POINTER defines a generic pointer type */
typedef unsigned char *POINTER;
/* UINT2 defines a two byte word */
typedef unsigned short int UINT2;
/* UINT4 defines a four byte word */
typedef unsigned long int UINT4;
/* PROTO_LIST is defined depending on how PROTOTYPES is defined above.
If using PROTOTYPES, then PROTO_LIST returns the list, otherwise it
returns an empty list.
*/
#if __STDC__
#define PROTO_LIST(list) list
#else
#define PROTO_LIST(list) ()
#endif
/* MD5 context. */
typedef struct {
UINT4 state[4]; /* state (ABCD) */
UINT4 count[2]; /* number of bits, modulo 2^64 (lsb first) */
unsigned char buffer[64]; /* input buffer */
} MD5_CTX;
void MD5Init PROTO_LIST ((MD5_CTX *));
void MD5Update PROTO_LIST ((MD5_CTX *, unsigned char *, unsigned int));
void MD5Final PROTO_LIST ((unsigned char [16], MD5_CTX *));
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef _MAILUTILS_MESSAGE_H
#define _MAILUTILS_MESSAGE_H
#include <mailutils/mu_features.h>
#include <mailutils/types.h>
#include <mailutils/envelope.h>
#include <mailutils/header.h>
#include <mailutils/body.h>
#include <mailutils/stream.h>
#include <mailutils/attribute.h>
#include <mailutils/mailbox.h>
#ifdef __cplusplus
extern "C" {
#endif
/* A message is considered to be a container for:
header_t, body_t, and its attribute_t. */
extern int message_ref __P ((message_t));
extern void message_destroy __P ((message_t *));
extern int message_is_modified __P ((message_t));
extern int message_clear_modified __P ((message_t));
extern int message_get_mailbox __P ((message_t, mailbox_t *));
extern int message_get_envelope __P ((message_t, envelope_t *));
extern int message_get_header __P ((message_t, header_t *));
extern int message_get_body __P ((message_t, body_t *));
extern int message_get_attribute __P ((message_t, attribute_t *));
extern int message_get_stream __P ((message_t, stream_t *));
extern int message_get_property __P ((message_t, property_t *));
extern int message_is_multipart __P ((message_t, int *));
extern int message_get_size __P ((message_t, size_t *));
extern int message_get_lines __P ((message_t, size_t *));
extern int message_get_num_parts __P ((message_t, size_t *nparts));
extern int message_get_part __P ((message_t, size_t, message_t *));
extern int message_get_uidl __P ((message_t, char *, size_t, size_t *));
extern int message_get_uid __P ((message_t, size_t *));
/* misc functions */
extern int message_create_attachment __P ((const char *content_type,
const char *encoding,
const char *filename,
message_t *newmsg));
extern int message_save_attachment __P ((message_t msg,
const char *filename, void **data));
extern int message_encapsulate __P ((message_t msg, message_t *newmsg,
void **data));
extern int message_unencapsulate __P ((message_t msg, message_t *newmsg,
void **data));
#ifdef __cplusplus
}
#endif
#endif /* _MAILUTILS_MESSAGE_H */
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef _MAILUTILS_MONITOR_H
#define _MAILUTILS_MONITOR_H
#include <unistd.h>
#ifdef _POSIX_THREADS
# include <pthread.h>
#endif
#ifdef _POSIX_THREADS
# define monitor_t pthread_mutex_t
# define MU_MONITOR_INITIALIZER PTHREAD_MUTEX_INITIALIZER
# define monitor_create(m) pthread_mutex_init (m, NULL)
# define monitor_destroy(m) pthread_mutex_destroy (m)
# define monitor_cleanup_push(routine, arg) pthread_cleanup_push (routine, arg)
# define monitor_cleanup_pop(execute) pthread_cleanup_pop (execute)
# define monitor_lock(m) pthread_mutex_lock (&m)
# define monitor_unlock(m) pthread_mutex_unlock (&m)
#else
# define monitor_t int
# define MU_MONITOR_INITIALIZER 0
# define monitor_create(m) (*m = 0)
# define monitor_destroy(m) (*m = 0)
# define monitor_cleanup_push(routine, arg) {
# define monitor_cleanup_pop(execute) }
# define monitor_lock(m) (m = 1)
# define monitor_unlock(m) (m = 0)
#endif
#endif /* _MAILUTILS_MONITOR_H */
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef _MAILUTILS_FEATURES_H
#define _MAILUTILS_FEATURES_H
#ifndef __P
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
# define __P(Args) Args
# else
# define __P(Args) ()
# endif
#endif
#endif
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef _MAILUTILS_MUTIL_H
#define _MAILUTILS_MUTIL_H
/*
Collection of useful utility routines that are worth sharing,
but don't have a natural home somewhere else.
*/
#include <time.h>
#include <mailutils/mu_features.h>
#ifdef __cplusplus
extern "C" {
#endif
extern unsigned long mu_hex2ul __P ((char hex));
extern size_t mu_hexstr2ul __P ((unsigned long* ul, const char* hex, size_t len));
struct mu_timezone
{
int utc_offset;
/* Seconds east of UTC. */
const char *tz_name;
/* Nickname for this timezone, if known. It is always considered
* to be a pointer to static string, so will never be freed. */
};
typedef struct mu_timezone mu_timezone;
extern int mu_parse_imap_date_time __P ((const char **p, struct tm * tm,
mu_timezone * tz));
extern int mu_parse_ctime_date_time __P ((const char **p, struct tm * tm,
mu_timezone * tz));
extern time_t mu_utc_offset __P ((void));
extern time_t mu_tm2time __P ((struct tm * timeptr, mu_timezone * tz));
extern char * mu_get_homedir __P ((void));
extern char * mu_tilde_expansion __P ((const char *ref, const char *delim, const char *homedir));
extern size_t util_cpystr __P ((char *dst, const char *src, size_t size));
struct passwd;
extern void mu_register_getpwnam __P((struct passwd *(*fun) __P((const char *))));
extern struct passwd * mu_getpwnam __P((const char *name));
extern int mu_virtual_domain;
extern struct passwd * getpwnam_virtual __P((const char *u));
#ifdef __cplusplus
}
#endif
#endif /* _MAILUTILS_MUTIL_H */
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef _MAILUTILS_OBSERVABLE_H
#define _MAILUTILS_OBSERVABLE_H
#include <mailutils/mu_features.h>
#include <mailutils/types.h>
#include <mailutils/observer.h>
#ifdef __cplusplus
extern "C" {
#endif
extern int observable_create __P ((observable_t *));
extern void observable_destroy __P ((observable_t *));
extern int observable_attach __P ((observable_t, int, observer_t));
extern int observable_detach __P ((observable_t, observer_t));
extern int observable_notify_all __P ((observable_t, struct event));
#ifdef __cplusplus
}
#endif
#endif /* _MAILUTILS_OBSERVABLE_H */
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef _MAILUTILS_OBSERVER_H
#define _MAILUTILS_OBSERVER_H
#include <mailutils/mu_features.h>
#include <mailutils/types.h>
#ifdef __cplusplus
extern "C" {
#endif
struct event
{
int type;
union
{
void *mailbox; /* For corrupted mailbox. */
int msgno; /* For new message. */
int percentage; /* Scan progress. */
void *message; /* message sent. */
} data ;
};
#define MU_EVT_MESSAGE_ADD 0x010
#define MU_EVT_MAILBOX_PROGRESS 0x020
#define MU_EVT_AUTHORITY_FAILED 0x030
#define MU_EVT_MAILBOX_CORRUPT 0x040
#define MU_EVT_MAILER_MESSAGE_SENT 0x080
extern int observer_create __P ((observer_t *, int (*action)
__P ((void *, struct event)), void *));
extern int observer_ref __P ((observer_t));
extern void observer_destroy __P ((observer_t *));
extern int observer_action __P ((observer_t, struct event));
#ifdef __cplusplus
}
#endif
#endif /* _MAILUTILS_OBSERVER_H */
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/**
* Parses syntatic elements defined in RFC 822.
*/
#ifndef _MAILUTILS_PARSE822_H
#define _MAILUTILS_PARSE822_H
#include <mailutils/mu_features.h>
#include <mailutils/address.h>
#include <mailutils/mutil.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* Reads an RFC822 defined lexical token from an input. All names are
* as close as possible to those used in the extended BNF of the RFC.
*/
/* From RFC 822, 3.3 Lexical Tokens */
extern int parse822_is_char __P ((char c));
extern int parse822_is_digit __P ((char c));
extern int parse822_is_ctl __P ((char c));
extern int parse822_is_space __P ((char c));
extern int parse822_is_htab __P ((char c));
extern int parse822_is_lwsp_char __P ((char c));
extern int parse822_is_special __P ((char c));
extern int parse822_is_atom_char __P ((char c));
extern int parse822_is_q_text __P ((char c));
extern int parse822_is_d_text __P ((char c));
extern int parse822_is_smtp_q __P ((char c));
extern int parse822_skip_crlf __P ((const char** p, const char* e));
extern int parse822_skip_lwsp_char __P ((const char** p, const char* e));
extern int parse822_skip_lwsp __P ((const char** p, const char* e));
extern int parse822_skip_comments __P ((const char** p, const char* e));
extern int parse822_skip_nl __P ((const char** p, const char* e));
extern int parse822_digits __P ((const char** p, const char* e, int min, int max, int* digits));
extern int parse822_special __P ((const char** p, const char* e, char c));
extern int parse822_comment __P ((const char** p, const char* e, char** comment));
extern int parse822_atom __P ((const char** p, const char* e, char** atom));
extern int parse822_quoted_pair __P ((const char** p, const char* e, char** qpair));
extern int parse822_quoted_string __P ((const char** p, const char* e, char** qstr));
extern int parse822_word __P ((const char** p, const char* e, char** word));
extern int parse822_phrase __P ((const char** p, const char* e, char** phrase));
extern int parse822_d_text __P ((const char** p, const char* e, char** dtext));
/* From RFC 822, 6.1 Address Specification Syntax */
extern int parse822_address_list __P ((address_t* a, const char* s));
extern int parse822_mail_box __P ((const char** p, const char* e, address_t* a));
extern int parse822_group __P ((const char** p, const char* e, address_t* a));
extern int parse822_address __P ((const char** p, const char* e, address_t* a));
extern int parse822_route_addr __P ((const char** p, const char* e, address_t* a));
extern int parse822_route __P ((const char** p, const char* e, char** route));
extern int parse822_addr_spec __P ((const char** p, const char* e, address_t* a));
extern int parse822_unix_mbox __P ((const char** p, const char* e, address_t* a));
extern int parse822_local_part __P ((const char** p, const char* e, char** local_part));
extern int parse822_domain __P ((const char** p, const char* e, char** domain));
extern int parse822_sub_domain __P ((const char** p, const char* e, char** sub_domain));
extern int parse822_domain_ref __P ((const char** p, const char* e, char** domain_ref));
extern int parse822_domain_literal __P ((const char** p, const char* e, char** domain_literal));
/* RFC 822 Quoting Functions
* Various elements must be quoted if then contain non-safe characters. What
* characters are allowed depend on the element. The following functions will
* allocate a quoted version of the raw element, it may not actually be
* quoted if no unsafe characters were in the raw string.
*/
extern int parse822_quote_string __P ((char** quoted, const char* raw));
extern int parse822_quote_local_part __P ((char** quoted, const char* raw));
extern int parse822_field_body __P ((const char** p, const char *e, char** fieldbody));
extern int parse822_field_name __P ((const char** p, const char *e, char** fieldname));
/***** From RFC 822, 5.1 Date and Time Specification Syntax *****/
extern int parse822_day __P ((const char** p, const char* e, int* day));
extern int parse822_date __P ((const char** p, const char* e, int* day, int* mon, int* year));
extern int parse822_time __P ((const char** p, const char* e, int* h, int* m, int* s, int* tz, const char** tz_name));
extern int parse822_date_time __P ((const char** p, const char* e, struct tm* tm, mu_timezone* tz));
#ifdef __cplusplus
}
#endif
#endif /* _MAILUTILS_PARSE822_H */
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef _MAILUTILS_POP3_H
#define _MAILUTILS_POP3_H
#include <mailutils/mu_features.h>
#include <mailutils/types.h>
#include <mailutils/iterator.h>
#include <mailutils/debug.h>
#include <mailutils/stream.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef iterator_t pop3_capa_iterator_t;
typedef iterator_t pop3_list_iterator_t;
typedef iterator_t pop3_uidl_iterator_t;
extern int pop3_create __P ((pop3_t *));
extern void pop3_destroy __P ((pop3_t *));
extern int pop3_connect __P ((pop3_t, const char *, unsigned int));
extern int pop3_disconnect __P ((pop3_t));
extern int pop3_set_carrier __P ((pop3_t, stream_t));
extern int pop3_get_carrier __P ((pop3_t, stream_t *));
extern int pop3_set_timeout __P ((pop3_t, int));
extern int pop3_get_timeout __P ((pop3_t, int *));
extern int pop3_set_debug __P ((pop3_t, mu_debug_t));
extern int pop3_get_debug __P ((pop3_t, mu_debug_t *));
extern int pop3_apop __P ((pop3_t, const char *, const char *));
extern int pop3_capa __P ((pop3_t, iterator_t *));
extern int pop3_capa_first __P ((pop3_capa_iterator_t));
extern int pop3_capa_current __P ((pop3_capa_iterator_t, char **));
extern int pop3_capa_next __P ((pop3_capa_iterator_t));
extern int pop3_capa_is_done __P ((pop3_capa_iterator_t));
extern void pop3_capa_destroy __P ((pop3_capa_iterator_t *));
extern int pop3_dele __P ((pop3_t, unsigned int));
extern int pop3_list __P ((pop3_t, unsigned int, size_t *));
extern int pop3_list_all __P ((pop3_t, pop3_list_iterator_t *));
extern int pop3_list_first __P ((pop3_list_iterator_t));
extern int pop3_list_current __P ((pop3_list_iterator_t,
unsigned int *, size_t *));
extern int pop3_list_next __P ((pop3_list_iterator_t));
extern int pop3_list_is_done __P ((pop3_list_iterator_t));
extern void pop3_list_destroy __P ((pop3_list_iterator_t *));
extern int pop3_noop __P ((pop3_t));
extern int pop3_pass __P ((pop3_t, const char *));
extern int pop3_quit __P ((pop3_t));
extern int pop3_retr __P ((pop3_t, unsigned int, stream_t *));
extern int pop3_rset __P ((pop3_t));
extern int pop3_stat __P ((pop3_t, unsigned int *, size_t *));
extern int pop3_top __P ((pop3_t, unsigned int,
unsigned int, stream_t *));
extern int pop3_uidl __P ((pop3_t, unsigned int, char **));
extern int pop3_uidl_all __P ((pop3_t, pop3_uidl_iterator_t *));
extern int pop3_uidl_first __P ((pop3_uidl_iterator_t));
extern int pop3_uidl_is_done __P ((pop3_uidl_iterator_t));
extern int pop3_uidl_current __P ((pop3_uidl_iterator_t,
unsigned int *, char **));
extern int pop3_uidl_next __P ((pop3_uidl_iterator_t));
extern void pop3_uidl_destroy __P ((pop3_uidl_iterator_t *));
extern int pop3_user __P ((pop3_t, const char *));
extern int pop3_readline __P ((pop3_t, char *, size_t, size_t *));
extern int pop3_response __P ((pop3_t, char *, size_t, size_t *));
extern int pop3_writeline __P ((pop3_t, const char *, ...));
extern int pop3_sendline __P ((pop3_t, const char *));
extern int pop3_send __P ((pop3_t));
#ifdef __cplusplus
}
#endif
#endif /* _MAILUTILS_POP3_H */
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef _MAILUTILS_PROPERTY_H
#define _MAILUTILS_PROPERTY_H
#include <mailutils/mu_features.h>
#include <mailutils/types.h>
#ifdef __cplusplus
extern "C" {
#endif
extern int property_create __P ((property_t *));
extern void property_destroy __P ((property_t *));
extern int property_set_value __P ((property_t, const char *, const char *,
int));
extern int property_get_value __P ((property_t, const char *, char * const *));
/* Helper functions. */
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 *));
#ifdef __cplusplus
}
#endif
#endif /* _MAILUTILS_PROPERTY_H */
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef _MAILUTILS_REFCOUNT_H
#define _MAILUTILS_REFCOUNT_H
#include <mailutils/mu_features.h>
#include <mailutils/types.h>
#ifdef __cplusplus
extern "C" {
#endif
extern int mu_refcount_create __P ((mu_refcount_t *));
extern void mu_refcount_destroy __P ((mu_refcount_t *));
extern int mu_refcount_inc __P ((mu_refcount_t));
extern int mu_refcount_dec __P ((mu_refcount_t));
extern int mu_refcount_lock __P ((mu_refcount_t));
extern int mu_refcount_unlock __P ((mu_refcount_t));
#ifdef __cplusplus
}
#endif
#endif /* _MAILUTILS_REFCOUNT_H */
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef _MAILUTILS_STREAM_H
#define _MAILUTILS_STREAM_H
#include <stdio.h>
#include <mailutils/mu_features.h>
#include <mailutils/types.h>
#ifdef __cplusplus
extern "C" {
#endif
#define MU_STREAM_READ 0x00000001
#define MU_STREAM_WRITE 0x00000002
#define MU_STREAM_RDWR (MU_STREAM_READ|MU_STREAM_WRITE)
#define MU_STREAM_APPEND 0x00000004
#define MU_STREAM_CREAT 0x00000008
#define MU_STREAM_NONBLOCK 0x00000010
enum stream_state
{
MU_STREAM_NO_STATE,
MU_STREAM_STATE_OPEN,
MU_STREAM_STATE_READ,
MU_STREAM_STATE_WRITE,
MU_STREAM_STATE_CLOSE
};
extern int stream_ref __P ((stream_t));
extern void stream_destroy __P ((stream_t *));
extern int stream_open __P ((stream_t, const char *, int, int));
extern int stream_close __P ((stream_t));
extern int stream_read __P ((stream_t, void *, size_t, off_t, size_t *));
extern int stream_readline __P ((stream_t, char *, size_t, off_t, size_t *));
extern int stream_write __P ((stream_t, const void *, size_t, off_t, size_t*));
extern int stream_tell __P ((stream_t, off_t *));
extern int stream_get_size __P ((stream_t, off_t *));
extern int stream_truncate __P ((stream_t, off_t));
extern int stream_flush __P ((stream_t));
extern int stream_get_fd __P ((stream_t , int *));
extern int stream_get_flags __P ((stream_t, int *));
extern int stream_get_state __P ((stream_t, enum stream_state *));
extern int stream_is_seekable __P ((stream_t));
extern int stream_is_readready __P ((stream_t, int));
extern int stream_is_writeready __P ((stream_t, int));
extern int stream_is_exceptionpending __P ((stream_t, int));
extern int stream_is_open __P ((stream_t));
/* Misc. */
extern int stream_file_create __P ((stream_t *));
extern int stream_stdio_create __P ((stream_t *, FILE *));
extern int stream_mmap_create __P ((stream_t *));
extern int stream_memory_create __P ((stream_t *, size_t));
extern int stream_tcp_create __P ((stream_t *));
extern int stream_fd_create __P ((stream_t *, int));
extern int stream_buffer_create __P ((stream_t *, stream_t, size_t));
#ifdef __cplusplus
}
#endif
#endif /* _MAILUTILS_STREAM_H */
## Process this file with GNU Automake to create Makefile.in
## Copyright (C) 2001, 2002 Free Software Foundation, Inc.
##
## GNU Mailutils is free software; you can redistribute it and/or
## modify it under the terms of the GNU 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 General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
pkginclude_HEADERS = \
address.h \
attribute.h \
authority.h \
bstream.h \
dattribute.h \
debug.h \
envelope.h \
folder.h \
fstream.h \
header.h \
iterator.h \
list.h \
lockfile.h \
mailbox.h \
mbox.h \
mapstream.h \
memstream.h \
message.h \
observable.h \
observer.h \
pop3.h \
pticket.h \
refcount.h \
sdebug.h \
stream.h \
tcpstream.h \
ticket.h \
url.h
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef _ADDRESS0_H
#define _ADDRESS0_H
#ifdef DMALLOC
# include <dmalloc.h>
#endif
#include <mailutils/address.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* The data-structure representing an RFC822 MAILBOX. It may be
* one MAILBOX or a list of them, as found in an ADDRESS or
* a MAILBOX list (as found in a GROUP).
*
* Capitalized names are from RFC 822, section 6.1 (Address Syntax).
*/
struct _address
{
char *addr;
/* the original string that this list of addresses was created
* from, only present at the head of the list */
char *comments;
/* the collection of comments stripped during parsing this MAILBOX */
char *personal;
/* the PHRASE portion of a MAILBOX, called the DISPLAY-NAME in drums */
char *email;
/* the ADDR-SPEC, the LOCAL-PART@DOMAIN */
char *local_part;
/* the LOCAL-PART of a MAILBOX */
char *domain;
/* the DOMAIN of a MAILBOX */
char *route;
/* the optional ROUTE in the ROUTE-ADDR form of MAILBOX */
/* size_t num; this didn't appear to be used anywhere... so I commented
it out, is that ok? -sam */
struct _address *next;
};
#ifdef __cplusplus
}
#endif
#endif /* _ADDRESS0_H */
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef _MAILUTILS_SYS_ATTRIBUTE_H
# define _MAILUTILS_SYS_ATTRIBUTE_H
#ifdef DMALLOC
# include <dmalloc.h>
#endif
#include <mailutils/attribute.h>
#ifdef __cplusplus
extern "C" {
#endif
struct _attribute_vtable
{
int (*ref) __P ((attribute_t));
void (*destroy) __P ((attribute_t *));
int (*get_flags) __P ((attribute_t, int *));
int (*set_flags) __P ((attribute_t, int));
int (*unset_flags) __P ((attribute_t, int));
int (*clear_flags) __P ((attribute_t));
int (*get_userflags) __P ((attribute_t, int *));
int (*set_userflags) __P ((attribute_t, int));
int (*unset_userflags) __P ((attribute_t, int));
int (*clear_userflags) __P ((attribute_t));
};
struct _attribute
{
struct _attribute_vtable *vtable;
};
#ifdef __cplusplus
}
#endif
#endif /* _MAILUTILS_SYS_ATTRIBUTE_H */
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef _MAILUTILS_SYS_AUTHORITY_H
#define _MAILUTILS_SYS_AUTHORITY_H
#ifdef DMALLOC
#include <dmalloc.h>
#endif
#include <mailutils/authority.h>
#ifdef __cplusplus
extern "C" {
#endif
struct _authority_vtable
{
int (*ref) __P ((authority_t));
void (*destroy) __P ((authority_t *));
int (*set_ticket) __P ((authority_t, ticket_t));
int (*get_ticket) __P ((authority_t, ticket_t *));
int (*authenticate) __P ((authority_t));
};
struct _authority
{
struct _authority_vtable *vtable;
};
#ifdef __cplusplus
}
#endif
#endif /* _MAILUTILS_SYS_AUTHORITY_H */
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef MAILUTILS_SYS_BSTREAM_H
#define MAILUTILS_SYS_BSTREAM_H
#ifdef DMALLOC
# include <dmalloc.h>
#endif
#include <mailutils/sys/stream.h>
#include <mailutils/refcount.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Read buffer */
struct _rbuffer
{
char *base;
char *ptr;
int count;
off_t offset;
size_t bufsize;
};
struct _stream_buffer
{
struct _stream base;
mu_refcount_t refcount;
stream_t stream;
struct _rbuffer rbuffer;
};
extern int _stream_buffer_ctor __P ((struct _stream_buffer *, stream_t, size_t));
extern void _stream_buffer_dtor __P ((stream_t));
extern int _stream_buffer_ref __P ((stream_t));
extern void _stream_buffer_destroy __P ((stream_t *));
extern int _stream_buffer_open __P ((stream_t, const char *, int, int));
extern int _stream_buffer_close __P ((stream_t));
extern int _stream_buffer_read __P ((stream_t, void *, size_t, off_t, size_t *));
extern int _stream_buffer_readline __P ((stream_t, char *, size_t, off_t, size_t *));
extern int _stream_buffer_write __P ((stream_t, const void *, size_t, off_t, size_t *));
extern int _stream_buffer_get_fd __P ((stream_t, int *));
extern int _stream_buffer_get_flags __P ((stream_t, int *));
extern int _stream_buffer_get_size __P ((stream_t, off_t *));
extern int _stream_buffer_truncate __P ((stream_t, off_t));
extern int _stream_buffer_flush __P ((stream_t));
extern int _stream_buffer_get_state __P ((stream_t, enum stream_state *));
extern int _stream_buffer_tell __P ((stream_t, off_t *));
extern int _stream_buffer_is_seekable __P ((stream_t));
extern int _stream_buffer_is_readready __P ((stream_t, int ));
extern int _stream_buffer_is_writeready __P ((stream_t, int));
extern int _stream_buffer_is_exceptionpending __P ((stream_t, int));
extern int _stream_buffer_is_open __P ((stream_t));
#ifdef __cplusplus
}
#endif
#endif /* _MAILUTILS_SYS_BSTREAM_H */
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef _MAILUTILS_SYS_DATTRIBUTE_H
# define _MAILUTILS_SYS_DATTRIBUTE_H
#ifdef DMALLOC
# include <dmalloc.h>
#endif
#include <mailutils/sys/attribute.h>
#include <mailutils/refcount.h>
#ifdef __cplusplus
extern "C" {
#endif
/* A simple default attribute implementation. */
struct _attribute_default
{
struct _attribute base;
mu_refcount_t refcount;
int flags;
int userflags;
};
extern int _attribute_default_ctor __P ((struct _attribute_default *));
extern void _attribute_default_dtor __P ((attribute_t));
extern int _attribute_default_ref __P ((attribute_t));
extern void _attribute_default_destroy __P ((attribute_t *));
extern int _attribute_default_get_flags __P ((attribute_t, int *));
extern int _attribute_default_set_flags __P ((attribute_t, int));
extern int _attribute_default_unset_flags __P ((attribute_t, int));
extern int _attribute_default_clear_flags __P ((attribute_t));
extern int _attribute_default_get_userflags __P ((attribute_t, int *));
extern int _attribute_default_set_userflags __P ((attribute_t, int));
extern int _attribute_default_unset_userflags __P ((attribute_t, int));
extern int _attribute_default_clear_userflags __P ((attribute_t));
#ifdef __cplusplus
}
#endif
#endif /* _MAILUTILS_SYS_ATTRIBUTE_H */
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef _MAILUTILS_SYS_DEBUG_H
#define _MAILUTILS_SYS_DEBUG_H
#ifdef DMALLOC
#include <dmalloc.h>
#endif
#include <mailutils/debug.h>
#ifdef __cplusplus
extern "C" {
#endif
struct _mu_debug_vtable
{
int (*ref) __P ((mu_debug_t));
void (*destroy) __P ((mu_debug_t *));
int (*get_level) __P ((mu_debug_t, unsigned int *));
int (*set_level) __P ((mu_debug_t, unsigned int));
int (*print) __P ((mu_debug_t, unsigned int, const char *));
};
struct _mu_debug
{
struct _mu_debug_vtable *vtable;
};
#ifdef __cplusplus
}
#endif
#endif /* _MAILUTILS_SYS_DEBUG_H */
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef _MAILUTILS_SYS_DOTLOCK_H
#define _MAILUTILS_SYS_DOTLOCK_H
#ifdef DMALLOC
#include <dmalloc.h>
#endif
#include <mailutils/refcount.h>
#include <mailutils/sys/lockfile.h>
#ifdef __cplusplus
extern "C" {
#endif
/* locking flags */
#define MU_LOCKFILE_DOTLOCK_PID 1
#define MU_LOCKFILE_DOTLOCK_FCNTL 2
#define MU_LOCKFILE_DOTLOCK_TIME 4
#define MU_LOCKFILE_DOTLOCK_EXPIRE_TIME (5 * 60)
#define MU_LOCKFILE_DOTLOCK_ATTR 0444
struct _lockfile_dotlock
{
struct _lockfile base;
mu_refcount_t refcount;
int fd;
int refcnt; /* For recursive file locking. */
char *fname;
int flags;
};
extern int _lockfile_dotlock_ctor __P ((struct _lockfile_dotlock *, const char *));
extern void _lockfile_dotlock_dtor __P ((lockfile_t));
extern int _lockfile_dotlock_ref __P ((lockfile_t));
extern void _lockfile_dotlock_destroy __P ((lockfile_t *));
extern int _lockfile_dotlock_lock __P ((lockfile_t));
extern int _lockfile_dotlock_touchlock __P ((lockfile_t));
extern int _lockfile_dotlock_unlock __P ((lockfile_t));
#ifdef __cplusplus
}
#endif
#endif /* _MAILUTILS_SYS_DOTLOCK_H */
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef _MAILUTILS_SYS_ENVELOPE_H
#define _MAILUTILS_SYS_ENVELOPE_H
#ifdef DMALLOC
#include <dmalloc.h>
#endif
#include <mailutils/envelope.h>
#ifdef __cplusplus
extern "C" {
#endif
struct _envelope_vtable
{
int (*ref) __P ((envelope_t));
void (*destroy) __P ((envelope_t *));
int (*get_sender) __P ((envelope_t, address_t *));
int (*set_sender) __P ((envelope_t, address_t));
int (*get_recipient) __P ((envelope_t, address_t *));
int (*set_recipient) __P ((envelope_t, address_t));
int (*get_date) __P ((envelope_t, struct tm *, struct mu_timezone *));
int (*set_date) __P ((envelope_t, struct tm *, struct mu_timezone *));
};
struct _envelope
{
struct _envelope_vtable *vtable;
};
#ifdef __cplusplus
}
#endif
#endif /* _MAILUTILS_SYS_ENVELOPE_H */
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef MAILUTILS_SYS_FDSTREAM_H
#define MAILUTILS_SYS_FDSTREAM_H
#ifdef DMALLOC
# include <dmalloc.h>
#endif
#include <mailutils/refcount.h>
#include <mailutils/sys/stream.h>
#ifdef __cplusplus
extern "C" {
#endif
struct _stream_fd
{
struct _stream base;
mu_refcount_t refcount;
int fd;
int state;
int flags;
off_t offset;
};
int _stream_fd_ctor __P ((struct _stream_fd *, int));
void _stream_fd_dtor __P ((stream_t));
int _stream_fd_ref __P ((stream_t));
void _stream_fd_destroy __P ((stream_t *));
int _stream_fd_open __P ((stream_t, const char *, int, int));
int _stream_fd_close __P ((stream_t));
int _stream_fd_read __P ((stream_t, void *, size_t, off_t, size_t *));
int _stream_fd_readline __P ((stream_t, char *, size_t, off_t, size_t *));
int _stream_fd_write __P ((stream_t, const void *, size_t, off_t, size_t *));
int _stream_fd_get_fd __P ((stream_t, int *));
int _stream_fd_get_flags __P ((stream_t, int *));
int _stream_fd_get_size __P ((stream_t, off_t *));
int _stream_fd_truncate __P ((stream_t, off_t));
int _stream_fd_flush __P ((stream_t));
int _stream_fd_get_state __P ((stream_t, enum stream_state *));
int _stream_fd_tell __P ((stream_t, off_t *));
int _stream_fd_is_seekable __P ((stream_t));
int _stream_fd_is_readready __P ((stream_t, int));
int _stream_fd_is_writeready __P ((stream_t, int));
int _stream_fd_is_exceptionpending __P ((stream_t, int));
int _stream_fd_is_open __P ((stream_t));
#ifdef __cplusplus
}
#endif
#endif /* _MAILUTILS_SYS_FDSTREAM_H */
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef _MAILUTILS_SYS_FOLDER_H
#define _MAILUTILS_SYS_FOLDER_H
#ifdef DMALLOC
# include <dmalloc.h>
#endif
#include <mailutils/folder.h>
#ifdef __cplusplus
extern "C" {
#endif
struct _folder_vtable
{
int (*ref) __P ((folder_t));
void (*destroy) __P ((folder_t *));
int (*open) __P ((folder_t, int flag));
int (*close) __P ((folder_t));
int (*delete) __P ((folder_t, const char *));
int (*rename) __P ((folder_t, const char *, const char *));
int (*subscribe) __P ((folder_t, const char *));
int (*unsubscribe) __P ((folder_t, const char *));
int (*list) __P ((folder_t, const char *, const char *, iterator_t *));
int (*lsub) __P ((folder_t, const char *, const char *, iterator_t *));
/* Stream settings. */
int (*get_stream) __P ((folder_t, stream_t *));
int (*set_stream) __P ((folder_t, stream_t));
/* Notifications. */
int (*get_observable) __P ((folder_t, observable_t *));
int (*get_debug) __P ((folder_t, mu_debug_t *));
int (*set_debug) __P ((folder_t, mu_debug_t));
/* Authentication. */
int (*get_authority) __P ((folder_t, authority_t *));
int (*set_authority) __P ((folder_t, authority_t));
/* URL. */
int (*get_url) __P ((folder_t, url_t *));
};
struct _folder
{
struct _folder_vtable *vtable;
};
#ifdef __cplusplus
}
#endif
#endif /* _MAILUTILS_SYS_FOLDER_H */
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef MAILUTILS_SYS_FSTREAM_H
#define MAILUTILS_SYS_FSTREAM_H
#ifdef DMALLOC
# include <dmalloc.h>
#endif
#include <mailutils/sys/stream.h>
#include <mailutils/refcount.h>
#ifdef __cplusplus
extern "C" {
#endif
struct _stream_stdio
{
struct _stream base;
mu_refcount_t refcount;
int flags;
off_t offset;
FILE *file;
};
extern int _stream_stdio_ctor __P ((struct _stream_stdio *, FILE *));
extern void _stream_stdio_dtor __P ((stream_t));
extern int _stream_stdio_ref __P ((stream_t));
extern void _stream_stdio_destroy __P ((stream_t *));
extern int _stream_stdio_open __P ((stream_t, const char *, int, int));
extern int _stream_stdio_close __P ((stream_t));
extern int _stream_stdio_read __P ((stream_t, void *, size_t, off_t, size_t *));
extern int _stream_stdio_readline __P ((stream_t, char *, size_t, off_t, size_t *));
extern int _stream_stdio_write __P ((stream_t, const void *, size_t, off_t, size_t *));
extern int _stream_stdio_get_fd __P ((stream_t, int *));
extern int _stream_stdio_get_flags __P ((stream_t, int *));
extern int _stream_stdio_get_size __P ((stream_t, off_t *));
extern int _stream_stdio_truncate __P ((stream_t, off_t));
extern int _stream_stdio_flush __P ((stream_t));
extern int _stream_stdio_get_state __P ((stream_t, enum stream_state *));
extern int _stream_stdio_tell __P ((stream_t, off_t *));
extern int _stream_stdio_is_seekable __P ((stream_t));
extern int _stream_stdio_is_readready __P ((stream_t, int));
extern int _stream_stdio_is_writeready __P ((stream_t, int));
extern int _stream_stdio_is_exceptionpending __P ((stream_t, int));
extern int _stream_stdio_is_open __P ((stream_t));
#ifdef __cplusplus
}
#endif
#endif /* _MAILUTILS_SYS_FSTREAM_H */