[dovecot-cvs] dovecot/src/plugins/trash trash-plugin.c,1.5,1.5.2.1
cras at dovecot.org
cras at dovecot.org
Sat Jun 17 18:06:21 EEST 2006
Update of /var/lib/cvs/dovecot/src/plugins/trash
In directory talvi:/tmp/cvs-serv26909/src/plugins/trash
Modified Files:
Tag: branch_1_0
trash-plugin.c
Log Message:
Removed hardcoded trash plugin configuration paths. Added information about
it to dovecot-example.conf
Index: trash-plugin.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/plugins/trash/trash-plugin.c,v
retrieving revision 1.5
retrieving revision 1.5.2.1
diff -u -d -r1.5 -r1.5.2.1
--- trash-plugin.c 1 Mar 2006 09:15:04 -0000 1.5
+++ trash-plugin.c 17 Jun 2006 15:06:19 -0000 1.5.2.1
@@ -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;
- 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;
+ 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(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;
}
More information about the dovecot-cvs
mailing list