zlib-plugin.c revision f052a448696b1246ee9fc36b7c727237aed56058
/* Copyright (c) 2005-2012 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "array.h"
#include "istream.h"
#include "ostream.h"
#include "mail-user.h"
#include "dbox-single/sdbox-storage.h"
#include "dbox-multi/mdbox-storage.h"
#include "maildir/maildir-storage.h"
#include "index-storage.h"
#include "index-mail.h"
#include "compression.h"
#include "zlib-plugin.h"
#include <stdlib.h>
#include <fcntl.h>
#define ZLIB_PLUGIN_DEFAULT_LEVEL 6
#define ZLIB_CONTEXT(obj) \
#define ZLIB_MAIL_CONTEXT(obj) \
#define ZLIB_USER_CONTEXT(obj) \
struct zlib_transaction_context {
};
struct zlib_user {
const struct compression_handler *save_handler;
unsigned int save_level;
};
const char *zlib_plugin_version = DOVECOT_VERSION;
{
const struct compression_handler *handler;
/* don't uncompress input when we are reading a mail that we're just
in the middle of saving, and we didn't do the compression ourself.
in such situation we're probably checking if the user-given input
looks compressed */
"zlib plugin: Detected %s compression "
return -1;
}
}
}
{
union mail_module_context *zmail;
return;
}
static struct mailbox_transaction_context *
{
struct mailbox_transaction_context *t;
struct zlib_transaction_context *zt;
return t;
}
static void
{
}
static int
struct mail_transaction_commit_changes *changes_r)
{
int ret;
return ret;
}
static int
{
NULL);
}
}
}
{
return -1;
return -1;
"Saving mails compressed by client isn't supported");
return -1;
}
return 0;
}
static int
{
return -1;
zuser->save_level);
return 0;
}
static void
{
} else {
}
}
{
const struct compression_handler *handler;
int fd;
return 0;
/* looks like a compressed single file mailbox. we should be
able to handle this. */
if (fd == -1) {
/* let the standard handler figure out what to do
with the failure */
return 0;
}
i_close_fd(&fd);
return 0;
}
}
return 0;
}
{
MAIL_STORAGE_CLASS_FLAG_OPEN_STREAMS) != 0) {
if (zlib_mailbox_open_input(box) < 0)
return -1;
}
}
{
union mailbox_module_context *zbox;
v->open = zlib_mailbox_open;
}
{
const char *name;
}
i_error("zlib_save_level: Level must be between 1..9");
zuser->save_level = 0;
}
}
if (zuser->save_level == 0)
}
static struct mail_storage_hooks zlib_mail_storage_hooks = {
};
{
}
void zlib_plugin_deinit(void)
{
}