dovecot: Fixed to use hook_mail_namespaces_created so we work al...

dovecot at dovecot.org dovecot at dovecot.org
Wed Aug 8 15:49:18 EEST 2007


details:   http://hg.dovecot.org/dovecot/rev/ea9604a6cfd6
changeset: 6237:ea9604a6cfd6
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Aug 08 15:49:12 2007 +0300
description:
Fixed to use hook_mail_namespaces_created so we work also with pop3.

diffstat:

2 files changed, 15 insertions(+), 13 deletions(-)
src/plugins/lazy-expunge/Makefile.am           |    1 
src/plugins/lazy-expunge/lazy-expunge-plugin.c |   27 +++++++++++++-----------

diffs (92 lines):

diff -r aca5c234b71a -r ea9604a6cfd6 src/plugins/lazy-expunge/Makefile.am
--- a/src/plugins/lazy-expunge/Makefile.am	Wed Aug 08 15:48:18 2007 +0300
+++ b/src/plugins/lazy-expunge/Makefile.am	Wed Aug 08 15:49:12 2007 +0300
@@ -6,7 +6,6 @@ AM_CPPFLAGS = \
 	-I$(top_srcdir)/src/lib-storage/index \
 	-I$(top_srcdir)/src/lib-storage/index/maildir \
 	-I$(top_srcdir)/src/lib-imap \
-	-I$(top_srcdir)/src/imap \
 	-I$(top_srcdir)/src/plugins/quota
 
 lib02_lazy_expunge_plugin_la_LDFLAGS = -module -avoid-version
diff -r aca5c234b71a -r ea9604a6cfd6 src/plugins/lazy-expunge/lazy-expunge-plugin.c
--- a/src/plugins/lazy-expunge/lazy-expunge-plugin.c	Wed Aug 08 15:48:18 2007 +0300
+++ b/src/plugins/lazy-expunge/lazy-expunge-plugin.c	Wed Aug 08 15:49:12 2007 +0300
@@ -1,12 +1,11 @@
 /* Copyright (C) 2006 Timo Sirainen */
 
-#include "common.h"
+#include "lib.h"
 #include "ioloop.h"
 #include "array.h"
 #include "str.h"
 #include "seq-range-array.h"
 #include "maildir-storage.h"
-#include "client.h"
 #include "mail-namespace.h"
 #include "lazy-expunge-plugin.h"
 
@@ -50,7 +49,8 @@ struct lazy_expunge_transaction {
 
 const char *lazy_expunge_plugin_version = PACKAGE_VERSION;
 
-static void (*lazy_expunge_next_hook_client_created)(struct client **client);
+static void (*lazy_expunge_next_hook_mail_namespaces_created)
+	(struct mail_namespace *namespaces);
 static void (*lazy_expunge_next_hook_mail_storage_created)
 	(struct mail_storage *storage);
 static void (*lazy_expunge_next_hook_mailbox_list_created)
@@ -501,16 +501,16 @@ static void lazy_expunge_mailbox_list_cr
 	MODULE_CONTEXT_SET(list, lazy_expunge_mailbox_list_module, llist);
 }
 
-static void lazy_expunge_hook_client_created(struct client **client)
+static void
+lazy_expunge_hook_mail_namespaces_created(struct mail_namespace *namespaces)
 {
 	struct lazy_expunge_mail_storage *lstorage;
 	const char *const *p;
 	int i;
 
-	if (lazy_expunge_next_hook_client_created != NULL)
-		lazy_expunge_next_hook_client_created(client);
-
-	/* FIXME: this works only as long as there's only one client. */
+	if (lazy_expunge_next_hook_mail_namespaces_created != NULL)
+		lazy_expunge_next_hook_mail_namespaces_created(namespaces);
+
 	t_push();
 	p = t_strsplit(getenv("LAZY_EXPUNGE"), " ");
 	for (i = 0; i < LAZY_NAMESPACE_COUNT; i++, p++) {
@@ -520,7 +520,7 @@ static void lazy_expunge_hook_client_cre
 			i_fatal("lazy_expunge: Missing namespace #%d", i + 1);
 
 		lazy_namespaces[i] =
-			mail_namespace_find_prefix((*client)->namespaces, name);
+			mail_namespace_find_prefix(namespaces, name);
 		if (lazy_namespaces[i] == NULL)
 			i_fatal("lazy_expunge: Unknown namespace: '%s'", name);
 		if (strcmp(lazy_namespaces[i]->storage->name, "maildir") != 0) {
@@ -541,8 +541,10 @@ void lazy_expunge_plugin_init(void)
 	if (getenv("LAZY_EXPUNGE") == NULL)
 		return;
 
-	lazy_expunge_next_hook_client_created = hook_client_created;
-	hook_client_created = lazy_expunge_hook_client_created;
+	lazy_expunge_next_hook_mail_namespaces_created =
+		hook_mail_namespaces_created;
+	hook_mail_namespaces_created =
+		lazy_expunge_hook_mail_namespaces_created;
 
 	lazy_expunge_next_hook_mail_storage_created =
 		hook_mail_storage_created;
@@ -557,7 +559,8 @@ void lazy_expunge_plugin_deinit(void)
 	if (getenv("LAZY_EXPUNGE") == NULL)
 		return;
 
-	hook_client_created = lazy_expunge_hook_client_created;
+	hook_mail_namespaces_created =
+		lazy_expunge_hook_mail_namespaces_created;
 	hook_mail_storage_created = lazy_expunge_next_hook_mail_storage_created;
 	hook_mailbox_list_created = lazy_expunge_next_hook_mailbox_list_created;
 }


More information about the dovecot-cvs mailing list