mdq(3)

NAME

mdq_open, mdq_add, mdq_test, mdq_close

LIBRARY

libmdq (-lmdq)

SYNOPSIS

#include <mdq.h>
MDQ *mdq_open(char *dir, char *quotastr);
void mdq_add(MDQ *q, long bytes, long files);
int mdq_test(MDQ *q, long bytes, long files);
long mdq_get(MDQ *q, int what)
void mdq_close(MDQ *q);
extern int mdq_trash_quota;
const char *mdq_version;
#include <stdarg.h>
void (*mdq_error)(const char *format, va_list args);

DESCRIPTION

The mdq_open function open Maildir++ soft quota informa tions for the mail box or mail folder in the directory dir
and with quota definition quotastr. If quotastr is NULL, the quota definition will be read from maildir.

The quota definition is a list, separate by commas. Each
member of the list consists of an integer followed by a
letter, specifying the nature of the quota. Currently
defined quota types are 'S' - total size of all messages,
and 'C' - the maximum count of messages in the maildir.
For example, 10000000S,1000C specifies a quota of
10,000,000 bytes or 1,000 messages, whichever comes first.

The mdq_add add (or remove with negative arguments) bytes bytes and files message to the current maildir quota sta
tus.

The mdq_test checks if theyre is enough space to keep cur rent ammount of space and files, added with bytes bytes of
messages and files messages.

The mdq_get may be used to retrieve the current values of the mailbox quota cache according the second argument
MDQ_BYTES_CURRENT
return the number of bytes used
MDQ_BYTES_MAX
return the maximum number of bytes
MDQ_FILES_CURRENT
return the number of files used
MDQ_FILES_MAX
return the maximum number of files
On error or undefined value, a negative value is returned.
The mdq_close function flush the modifications and free any resources associated with q.
The NULL MDQ pointer is a special quota information who
has no limit. mdq_open may returns NULL and mdq_add, mdq_test, mdq_close may take NULL as first argument.
It the mdq_trash_quota int is set to 0 (default), the mes sages in Trash folder and trashed message in other folders
are not counted in the quota. If set to 1, all messages
are counted. It must be defined before call to mdq_open.

RETURN VALUES

mdq_open returns a MDQ pointer or NULL if an error occurs or if all quotas are non positive. mdq_test returns 0 if theyre is enough space left or -1 if not. Other functions
returns no value.

DIAGNOSTIC MESSAGES

If the mdq_error function pointer is set, all diagnostic messages will be send to the function to be displayed. All
diagnostic messages begin by the string "[mdq]".

AUTHOR

Laurent Wacrenier <lwa@teaser.fr>
Copyright © 2010-2025 Platon Technologies, s.r.o.           Home | Man pages | tLDP | Documents | Utilities | About
Design by styleshout