/* Copyright (c) 2007-2018 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "array.h"
#include "llist.h"
#include "str.h"
#include "str-sanitize.h"
#include "imap-util.h"
#include "mail-user.h"
#include "mail-storage-private.h"
#include "notify-plugin.h"
#include "mail-log-plugin.h"
enum mail_log_field {
};
#define MAIL_LOG_DEFAULT_FIELDS \
enum mail_log_event {
};
#define MAIL_LOG_DEFAULT_EVENTS \
static const char *field_names[] = {
"uid",
"box",
"msgid",
"size",
"vsize",
"flags",
"from",
"subject",
};
static const char *event_names[] = {
"delete",
"undelete",
"expunge",
"save",
"copy",
"mailbox_create",
"mailbox_delete",
"mailbox_rename",
"flag_change",
};
struct mail_log_user {
bool cached_only;
};
struct mail_log_message {
bool ignore;
};
struct mail_log_mail_txn_context {
};
{
unsigned int i;
for (i = 0; field_names[i] != NULL; i++) {
return 1 << i;
}
return 0;
}
{
unsigned int i;
/* v1.x backwards compatibility */
name = "save";
}
for (i = 0; event_names[i] != NULL; i++) {
return 1 << i;
}
return 0;
}
{
const char *const *tmp;
if (field == 0)
}
return fields;
}
{
const char *const *tmp;
if (event == 0)
}
return events;
}
{
const char *str;
muser->cached_only =
}
{
const char *mailbox_str;
}
static void
{
const char *value;
value = "";
}
static void
{
if (uid != 0)
else {
/* we don't know the uid yet, assign it later */
str_truncate(str, 0);
}
}
static void
{
unsigned int hdr_idx = 0;
if ((fields & MAIL_LOG_FIELD_MSGID) != 0)
if ((fields & MAIL_LOG_FIELD_FROM) != 0)
if ((fields & MAIL_LOG_FIELD_SUBJECT) != 0)
if (hdr_idx > 0) {
}
if ((fields & MAIL_LOG_FIELD_PSIZE) != 0)
if ((fields & MAIL_LOG_FIELD_VSIZE) != 0)
}
static void
const char *desc)
{
/* avoid parsing through the message multiple times */
}
if (event != MAIL_LOG_EVENT_SAVE &&
else {
/* with mbox mail->uid contains the uid, but handle
this consistently with all mailbox formats */
}
/* make sure UID is assigned to this mail */
}
}
else
}
else
}
}
}
}
}
enum mail_log_event event)
{
}
static void
const char *desc)
{
if (event == MAIL_LOG_EVENT_SAVE ||
return;
}
T_BEGIN {
} T_END;
}
static void *
{
return ctx;
}
{
(struct mail_log_mail_txn_context *)txn;
}
{
(struct mail_log_mail_txn_context *)txn;
const char *desc;
/* copying a mail from virtual storage. src points to the
backend mail, but we want to log the virtual mailbox name. */
}
}
{
(struct mail_log_mail_txn_context *)txn;
}
enum mail_flags old_flags)
{
(struct mail_log_mail_txn_context *)txn;
"flag_change");
} else if ((old_flags & MAIL_DELETED) == 0) {
"delete");
} else {
"undelete");
}
}
static void
const char *const *old_keywords ATTR_UNUSED)
{
(struct mail_log_mail_txn_context *)txn;
"flag_change");
}
{
else if (uid != 0)
else
}
static void
struct mail_transaction_commit_changes *changes)
{
(struct mail_log_mail_txn_context *)txn;
unsigned int n = 0;
uid = 0;
} else {
}
}
}
{
(struct mail_log_mail_txn_context *)txn;
}
static void
{
return;
i_info("Mailbox created: %s",
}
static void
{
return;
i_info("Mailbox deleted: %s",
}
static void
{
return;
i_info("Mailbox renamed: %s -> %s",
}
};
};
{
}
void mail_log_plugin_deinit(void)
{
}