Mercurial > dovecot > original-hg > dovecot-1.2
diff src/plugins/trash/trash-plugin.c @ 4400:593523f53500 HEAD
Removed hardcoded trash plugin configuration paths. Added information about
it to dovecot-example.conf
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sat, 17 Jun 2006 18:06:20 +0300 |
parents | 51306837698b |
children | 1a35d53c18fc |
line wrap: on
line diff
--- a/src/plugins/trash/trash-plugin.c Sat Jun 17 17:45:54 2006 +0300 +++ b/src/plugins/trash/trash-plugin.c Sat Jun 17 18:06:20 2006 +0300 @@ -13,9 +13,6 @@ #include <unistd.h> #include <fcntl.h> -#define LOCAL_CONFIG_FILE "~/.dovecot.trash.conf" -#define GLOBAL_CONFIG_FILE "/etc/dovecot-trash.conf" - #define MAX_RETRY_COUNT 3 #define TRASH_CONTEXT(obj) \ @@ -233,8 +230,7 @@ fd = open(path, O_RDONLY); if (fd == -1) { - if (errno != ENOENT) - i_error("open(%s) failed: %m", path); + i_error("open(%s) failed: %m", path); return -1; } @@ -263,19 +259,30 @@ void trash_plugin_init(void) { + const char *env; + trash_next_hook_quota_root_created = hook_quota_root_created; + env = getenv("TRASH"); + if (env == NULL) + return; + + if (quota == NULL) { + i_error("trash plugin: quota plugin not initialized"); + return; + } + config_pool = pool_alloconly_create("trash config", 1024); - if (read_configuration(home_expand(LOCAL_CONFIG_FILE)) < 0) { - if (read_configuration(GLOBAL_CONFIG_FILE) < 0) - return; - } + if (read_configuration(env) < 0) + return; hook_quota_root_created = trash_quota_root_created; } void trash_plugin_deinit(void) { - pool_unref(config_pool); + if (config_pool != NULL) + pool_unref(config_pool); + hook_quota_root_created = trash_next_hook_quota_root_created; }