struct acl_backend *backend;
unsigned int i, group_count;
- if (user->mail_debug) {
- i_debug("acl: initializing backend with data: %s", data);
- i_debug("acl: acl username = %s", acl_username);
- i_debug("acl: owner = %d", owner ? 1 : 0);
- }
+ e_debug(user->event, "acl: initializing backend with data: %s", data);
+ e_debug(user->event, "acl: acl username = %s", acl_username);
+ e_debug(user->event, "acl: owner = %d", owner ? 1 : 0);
group_count = str_array_length(groups);
p_new(backend->pool, const char *, group_count);
for (i = 0; i < group_count; i++) {
backend->groups[i] = p_strdup(backend->pool, groups[i]);
- if (user->mail_debug)
- i_debug("acl: group added: %s", groups[i]);
+ e_debug(user->event, "acl: group added: %s", groups[i]);
}
i_qsort(backend->groups, group_count, sizeof(const char *),
i_strcmp_p);
dict_set.base_dir = user->set->base_dir;
if (dict_init(uri, &dict_set, &dict->dict, &error) < 0)
i_error("acl: dict_init(%s) failed: %s", uri, error);
- } else if (user->mail_debug) {
- i_debug("acl: No acl_shared_dict setting - "
+ } else {
+ e_debug(user->event, "acl: No acl_shared_dict setting - "
"shared mailbox listing is disabled");
}
return dict;
if (ctx->lookup_boxes == NULL ||
mailbox_tree_lookup(ctx->lookup_boxes, info->vname) != NULL)
break;
- if (_ctx->list->ns->user->mail_debug) {
- i_debug("acl: Mailbox not in dovecot-acl-list: %s",
- info->vname);
- }
+ e_debug(_ctx->list->ns->user->event,
+ "acl: Mailbox not in dovecot-acl-list: %s", info->vname);
}
return info;
return NULL;
}
/* skip to next one */
- if (_ctx->list->ns->user->mail_debug) {
- i_debug("acl: No lookup right to mailbox: %s",
- info->vname);
- }
+ e_debug(_ctx->list->ns->user->event,
+ "acl: No lookup right to mailbox: %s", info->vname);
}
return info == NULL ? NULL : &ctx->info;
}
if (env != NULL && *env != '\0')
acl_mail_user_create(user, env);
else {
- if (user->mail_debug)
- i_debug("acl: No acl setting - ACLs are disabled");
+ e_debug(user->event, "acl: No acl setting - ACLs are disabled");
}
}
static void apparmor_log_current_context(struct mail_user *user)
{
char *con, *mode;
- if (!user->mail_debug)
- return;
if (aa_getcon(&con, &mode) < 0) {
- i_debug("aa_getcon() failed: %m");
+ e_debug(user->event, "aa_getcon() failed: %m");
} else {
- i_debug("apparmor: Current context=%s, mode=%s",
+ e_debug(user->event, "apparmor: Current context=%s, mode=%s",
con, mode);
free(con);
}
continue;
}
if (strcasecmp(key, value) != 0) {
- if (user->mail_debug)
- i_debug("charset_alias: add charset-alias %s for %s", value, key);
+ e_debug(user->event, "charset_alias: add charset-alias %s for %s", value, key);
alias.charset = p_strdup(pool, t_str_lcase(key));
alias.alias = p_strdup(pool, value);
array_append(&charset_aliases, &alias, 1);
expire_mailbox_transaction_commit(struct mailbox_transaction_context *t,
struct mail_transaction_commit_changes *changes_r)
{
- struct mail_user *user = t->box->storage->user;
struct expire_mailbox *xpr_box = EXPIRE_CONTEXT_REQUIRE(t->box);
struct expire_transaction_context *xt = EXPIRE_CONTEXT_REQUIRE(t);
struct mailbox *box = t->box;
transaction a new message was saved */
new_stamp = ioloop_time;
}
- if (user->mail_debug) {
- i_debug("expire: Expunging first message in %s, "
- "updating timestamp to %ld",
- box->vname, (long)new_stamp);
- }
+ e_debug(box->event, "expire: Expunging first message, "
+ "updating timestamp to %ld", (long)new_stamp);
update_dict = TRUE;
}
} else {
/* already exists */
}
- if (user->mail_debug && update_dict) {
- i_debug("expire: Saving first message to %s, "
- "updating timestamp to %ld",
- box->vname, (long)new_stamp);
+ if (update_dict) {
+ e_debug(box->event, "expire: Saving first message, "
+ "updating timestamp to %ld", (long)new_stamp);
}
}
const char *dict_uri, *error;
if (!mail_user_plugin_getenv_bool(user, "expire")) {
- if (user->mail_debug)
- i_debug("expire: No expire setting - plugin disabled");
+ e_debug(user->event, "expire: No expire setting - plugin disabled");
return;
}
case 204: /* empty response */
case 415: /* Unsupported Media Type */
case 422: /* Unprocessable Entity */
- if (parser->user->mail_debug) {
- i_debug("fts_tika: PUT %s failed: %s",
- mail_user_plugin_getenv(parser->user, "fts_tika"),
- http_response_get_message(response));
- }
+ e_debug(parser->user->event, "fts_tika: PUT %s failed: %s",
+ mail_user_plugin_getenv(parser->user, "fts_tika"),
+ http_response_get_message(response));
parser->payload = i_stream_create_from_data("", 0);
break;
default:
const char *path;
if (name == NULL || name[0] == '\0') {
- if (list->mail_set->mail_debug)
- i_debug("fts: No fts setting - plugin disabled");
+ e_debug(list->ns->user->event,
+ "fts: No fts setting - plugin disabled");
return;
}
if (!mailbox_list_get_root_path(list, MAILBOX_LIST_PATH_TYPE_INDEX, &path)) {
- if (list->mail_set->mail_debug) {
- i_debug("fts: Indexes disabled for namespace '%s'",
- list->ns->prefix);
- }
+ e_debug(list->ns->user->event,
+ "fts: Indexes disabled for namespace '%s'",
+ list->ns->prefix);
return;
}
mail_user_plugin_getenv_bool(user, "lazy_expunge_only_last_instance");
MODULE_CONTEXT_SET(user, lazy_expunge_mail_user_module, luser);
- } else if (user->mail_debug) {
- i_debug("lazy_expunge: No lazy_expunge setting - "
+ } else {
+ e_debug(user->event, "lazy_expunge: No lazy_expunge setting - "
"plugin disabled");
}
}
const char *curve = mail_user_plugin_getenv(user, "mail_crypt_curve");
buffer_t *tmp = t_str_new(64);
if (curve == NULL || *curve == '\0') {
- if (user->mail_debug) {
- i_debug("mail_crypt_plugin: mail_crypt_curve setting "
- "missing - generating EC keys disabled");
- }
+ e_debug(user->event, "mail_crypt_plugin: mail_crypt_curve setting "
+ "missing - generating EC keys disabled");
} else if (!dcrypt_name2oid(curve, tmp, &error)) {
user->error = p_strdup_printf(user->pool,
"mail_crypt_plugin: "
error_r) < 0) {
/* skip this key */
if (ignore_errors) {
- if (user->namespaces->mail_set->mail_debug)
- i_debug("mail-crypt-plugin: "
- "mail_crypt_load_global_private_key failed: %s",
- *error_r);
+ e_debug(user->event, "mail-crypt-plugin: "
+ "mail_crypt_load_global_private_key failed: %s",
+ *error_r);
*error_r = NULL;
continue;
}
*socket_path_r = p_strdup_printf(user->pool, "%s/%s",
user->set->base_dir, *socket_path_r);
}
- if (user->mail_debug) {
- i_debug("mail_filter: Filtering %s via socket %s",
- name, *socket_path_r);
- }
+ e_debug(user->event, "mail_filter: Filtering %s via socket %s",
+ name, *socket_path_r);
}
static void mail_filter_mail_user_created(struct mail_user *user)
&muser->socket_path, &muser->args);
mail_filter_parse_setting(user, "mail_filter_out",
&muser->out_socket_path, &muser->out_args);
- if (user->mail_debug && muser->socket_path == NULL &&
+ if (muser->socket_path == NULL &&
muser->out_socket_path == NULL) {
- i_debug("mail_filter and mail_filter_out settings missing, "
+ e_debug(user->event, "mail_filter and mail_filter_out settings missing, "
"ignoring mail_filter plugin");
}
struct dict_transaction_context *t;
struct mailbox_status status;
- if (user->mail_debug)
- i_debug("notify-status: Updating mailbox %s status",
- mailbox_get_vname(box));
+ e_debug(box->event, "notify-status: Updating mailbox status");
box = mailbox_alloc(mailbox_get_namespace(box)->list,
mailbox_get_vname(box), MAILBOX_FLAG_READONLY);
i_assert(nuser != NULL);
struct dict_transaction_context *t;
- if (user->mail_debug)
- i_debug("notify-status: Removing mailbox %s status",
- mailbox_get_vname(box));
+ e_debug(box->event, "notify-status: Removing mailbox status");
const char *key =
t_strdup_printf(NOTIFY_STATUS_KEY, mailbox_get_vname(box));
return;
if (uri == NULL || *uri == '\0') {
- if (user->mail_debug)
- i_debug("notify-status: Disabled - Missing plugin/"
- NOTIFY_STATUS_SETTING_DICT_URI" setting");
+ e_debug(user->event, "notify-status: Disabled - Missing plugin/"
+ NOTIFY_STATUS_SETTING_DICT_URI" setting");
return;
}
imap_map[i].pop3_seq = pop3_map[i].pop3_seq;
}
mbox->first_unfound_idx = i;
- if (box->storage->user->mail_debug) {
- i_debug("pop3_migration: cached uidls=%u, size matches=%u, total=%u",
- uidl_match, size_match, count);
- }
+ e_debug(box->event, "pop3_migration: cached uidls=%u, size matches=%u, total=%u",
+ uidl_match, size_match, count);
return i == count && imap_count == pop3_count;
}
return -1;
}
i_warning("%s", str_c(str));
- } else if (box->storage->user->mail_debug) {
- i_debug("pop3_migration: %u mails matched by headers", pop3_count);
- }
+ } else
+ e_debug(box->event, "pop3_migration: %u mails matched by headers", pop3_count);
array_sort(&mstorage->pop3_uidl_map, pop3_uidl_map_pop3_seq_cmp);
array_sort(&mbox->imap_msg_map, imap_msg_map_uid_cmp);
return 0;
pop3_box_vname = mail_user_plugin_getenv(storage->user,
"pop3_migration_mailbox");
if (pop3_box_vname == NULL) {
- if (storage->user->mail_debug)
- i_debug("pop3_migration: No pop3_migration_mailbox setting - disabled");
+ e_debug(storage->user->event, "pop3_migration: No pop3_migration_mailbox setting - disabled");
return;
}
{
va_list args;
- if (user->mail_debug) T_BEGIN {
+ T_BEGIN {
va_start(args, fmt);
- i_debug("%s%s", label, t_strdup_vprintf(fmt, args));
+ e_debug(user->event, "%s%s", label, t_strdup_vprintf(fmt, args));
va_end(args);
} T_END;
}
uri = mail_user_plugin_getenv(user, "quota_clone_dict");
if (uri == NULL || uri[0] == '\0') {
- if (user->mail_debug) {
- i_debug("The quota_clone_dict setting is missing from configuration");
- }
+ e_debug(user->event, "The quota_clone_dict setting is missing from configuration");
return;
}
quser->quota = quota;
MODULE_CONTEXT_SET(user, quota_user_module, quser);
- } else if (user->mail_debug) {
- i_debug("quota: No quota setting - plugin disabled");
+ } else {
+ e_debug(user->event, "quota: No quota setting - plugin disabled");
}
}
if (ruser == NULL)
return;
- if (ns->user->mail_debug) {
- i_debug("replication: Replication requested by '%s', priority=%d",
- event, priority);
- }
+ e_debug(ns->user->event,
+ "replication: Replication requested by '%s', priority=%d",
+ event, priority);
if (priority == REPLICATION_PRIORITY_SYNC) {
if (replication_notify_sync(ns->user) == 0) {
value = mail_user_plugin_getenv(user, "mail_replica");
if (value == NULL || value[0] == '\0') {
- if (user->mail_debug)
- i_debug("replication: No mail_replica setting - replication disabled");
+ e_debug(user->event, "replication: No mail_replica setting - replication disabled");
return;
}
if (user->dsyncing) {
/* we're running dsync, which means that the remote is telling
us about a change. don't trigger a replication back to it */
- if (user->mail_debug)
- i_debug("replication: We're running dsync - replication disabled");
+ e_debug(user->event, "replication: We're running dsync - replication disabled");
return;
}
}
if (size_expunged < size_needed) {
- if (ctx->quota->user->mail_debug) {
- i_debug("trash plugin: Failed to remove enough messages "
- "(needed %"PRIu64" bytes, expunged only %"PRIu64" bytes)",
- size_needed, size_expunged);
- }
+ e_debug(ctx->quota->user->event,
+ "trash plugin: Failed to remove enough messages "
+ "(needed %"PRIu64" bytes, expunged only %"PRIu64" bytes)",
+ size_needed, size_expunged);
return 0;
}
if (expunged_count < count_needed) {
- if (ctx->quota->user->mail_debug) {
- i_debug("trash plugin: Failed to remove enough messages "
- "(needed %u messages, expunged only %u messages)",
- count_needed, expunged_count);
- }
+ e_debug(ctx->quota->user->event,
+ "trash plugin: Failed to remove enough messages "
+ "(needed %u messages, expunged only %u messages)",
+ count_needed, expunged_count);
return 0;
}
ret = -1;
}
- if (user->mail_debug) {
- i_debug("trash plugin: Added '%s' with priority %d",
- trash->name, trash->priority);
- }
+ e_debug(user->event, "trash plugin: Added '%s' with priority %d",
+ trash->name, trash->priority);
}
i_stream_destroy(&input);
i_close_fd(&fd);
env = mail_user_plugin_getenv(user, "trash");
if (env == NULL) {
- if (user->mail_debug)
- i_debug("trash: No trash setting - plugin disabled");
+ e_debug(user->event, "trash: No trash setting - plugin disabled");
} else if (quser == NULL) {
i_error("trash plugin: quota plugin not initialized");
} else {
}
if (existence != MAILBOX_EXISTENCE_SELECT) {
/* ignore this. it could be intentional. */
- if (mbox->storage->storage.user->mail_debug) {
- i_debug("virtual mailbox %s: "
- "Skipping non-existing mailbox %s",
- mbox->box.vname, bbox->box->vname);
- }
+ e_debug(mbox->box.event,
+ "Skipping non-existing mailbox %s",
+ bbox->box->vname);
mailbox_free(&bbox->box);
return 0;
}
char buf[1024];
int fd, ret;
- if (user->mail_debug)
- i_debug("welcome: Executing %s (wait=%d)", cmd, wait ? 1 : 0);
+ e_debug(user->event, "welcome: Executing %s (wait=%d)", cmd, wait ? 1 : 0);
args = t_strsplit_spaces(cmd, " ");
socket_path = args[0];