quota-storage.c revision 2ebeb22b9a8a8bb7fbe2f2e2908478a220792b87
/* Copyright (C) 2005 Timo Sirainen */
#include "lib.h"
#include "array.h"
#include "istream.h"
#include "mail-storage-private.h"
#include "quota-private.h"
#include "quota-plugin.h"
#define QUOTA_CONTEXT(obj) \
struct quota_mail_storage {
struct mail_storage_vfuncs super;
/* List of quota roots this storage belongs to. */
};
struct quota_mailbox {
struct mailbox_vfuncs super;
unsigned int save_hack:1;
};
struct quota_mail {
struct mail_vfuncs super;
};
static unsigned int quota_storage_module_id = 0;
static bool quota_storage_module_id_set = FALSE;
{
struct quota_transaction_context *qt =
return -1;
return 0;
}
static struct mailbox_transaction_context *
{
struct mailbox_transaction_context *t;
struct quota_transaction_context *qt;
return t;
}
static int
enum mailbox_sync_flags flags)
{
return -1;
} else {
(void)quota_transaction_commit(qt);
return 0;
}
}
static void
{
}
static struct mail *
quota_mail_alloc(struct mailbox_transaction_context *t,
struct mailbox_header_lookup_ctx *wanted_headers)
{
struct quota_mail *qmail;
struct mail_private *mail;
return _mail;
}
{
int ret;
bool too_large;
if (ret > 0)
return 0;
else if (ret == 0) {
return -1;
} else {
return -1;
}
}
static int
{
/* we always want to know the mail size */
NULL);
}
}
return -1;
/* if copying used saving internally, we already checked the quota
and set qbox->save_hack = TRUE. */
}
static int
quota_save_init(struct mailbox_transaction_context *t,
{
int ret;
/* Input size is known, check for quota immediately. This
check isn't perfect, especially because input stream's
linefeeds may contain CR+LFs while physical message would
only contain LFs. With mbox some headers might be skipped
entirely.
I think these don't really matter though compared to the
benefit of giving "out of quota" error before sending the
full mail. */
bool too_large;
if (ret == 0) {
"Quota exceeded");
return -1;
} else if (ret < 0) {
return -1;
}
}
/* we always want to know the mail size */
NULL);
}
}
}
{
return -1;
}
static struct mailbox *
{
struct quota_mailbox *qbox;
return NULL;
return box;
}
{
struct quota_root *const *roots;
struct mail_storage *const *storages;
unsigned int i, j, root_count, storage_count;
/* remove the storage from all roots' storages list */
for (i = 0; i < root_count; i++) {
for (j = 0; j < storage_count; j++) {
break;
}
}
i_assert(j != storage_count);
}
}
{
struct quota_mail_storage *qstorage;
if (!quota_storage_module_id_set) {
}
/* register to user's quota roots */
}
}
struct quota_root *root)
{
return FALSE;
return TRUE;
}
struct quota_root *root)
{
struct mail_storage *const *storages;
struct quota_root *const *roots;
unsigned int i, count;
for (i = 0; i < count; i++) {
break;
}
}
for (i = 0; i < count; i++) {
break;
}
}
}
{
struct quota_root_iter *iter;
return iter;
}
{
struct quota_root *const *roots;
unsigned int count;
return NULL;
}
{
}