mail-storage-hooks.c revision 2999c50f9ee8cbbfcb7c4a88c43cad3c6a5a5ff6
/* Copyright (c) 2009-2010 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "array.h"
#include "llist.h"
#include "module-dir.h"
#include "mail-user.h"
#include "mail-namespace.h"
#include "mail-storage-private.h"
#include "mailbox-list-private.h"
struct mail_storage_module_hooks {
const struct mail_storage_hooks *hooks;
};
struct hook_stack {
/* Pointer to vfuncs struct. This assumes that a struct containing
function pointers equals to an array of function pointers. Not
ANSI-C, but should work in all OSes supported by Dovecot. Much
easier anyway than doing this work manually.. */
void (**vfuncs)();
/* nonzero in the areas where vfuncs has been changed */
void (**mask)();
};
struct hook_build_context {
/* size of the vfuncs struct */
/* number of function pointers in the struct */
unsigned int count;
};
static ARRAY_DEFINE(module_hooks,
struct mail_storage_module_hooks) = ARRAY_INIT;
static ARRAY_DEFINE(internal_hooks,
const struct mail_storage_hooks *) = ARRAY_INIT;
void mail_storage_hooks_init(void)
{
}
void mail_storage_hooks_deinit(void)
{
}
const struct mail_storage_hooks *hooks)
{
struct mail_storage_module_hooks new_hook;
}
{
const struct mail_storage_module_hooks *module_hook;
unsigned int idx = -1U;
break;
}
}
}
{
}
{
const struct mail_storage_hooks *const *old_hooks;
unsigned int idx = -1U;
break;
}
}
}
static int
const struct mail_storage_module_hooks *h2)
{
s1 += 3;
s2 += 3;
}
{
const struct mail_storage_module_hooks *module_hook;
/* first get all hooks wanted by the user */
}
/* next we have to sort them by the modules' priority (based on name) */
/* now that we have them in order, save them to user's hooks */
}
{
struct hook_stack *stack;
}
static struct hook_build_context *
{
struct hook_build_context *ctx;
return ctx;
}
static void
void (**vlast)())
{
unsigned int i;
}
}
static void
{
unsigned int i;
}
}
}
{
struct hook_stack *stack;
/* ctx->vfuncs_stack->vfuncs points to the root vfuncs,
ctx->vfuncs_stack->next->vfuncs points to the first super function
that is being called, and so on.
the previous plugin added its vfuncs to the stack tail.
vlast contains the previous plugin's super vfuncs, which is where
the next plugin should put its own vfuncs.
first we'll need to figure out what vfuncs the previous plugin
changed and update the mask */
/* now go up in the stack as long as the mask isn't set,
and update the vfuncs */
/* add vlast to stack */
}
{
const struct mail_storage_hooks *const *hooks;
struct hook_build_context *ctx;
}
}
}
{
const struct mail_storage_hooks *const *hooks;
}
}
{
const struct mail_storage_hooks *const *hooks;
}
}
{
const struct mail_storage_hooks *const *hooks;
struct hook_build_context *ctx;
}
}
}
{
const struct mail_storage_hooks *const *hooks;
struct hook_build_context *ctx;
}
}
}
{
const struct mail_storage_hooks *const *hooks;
struct hook_build_context *ctx;
}
}
}
{
const struct mail_storage_hooks *const *hooks;
}
}
{
const struct mail_storage_hooks *const *hooks;
struct hook_build_context *ctx;
}
}
}