changeset 6237:ea9604a6cfd6 HEAD

Fixed to use hook_mail_namespaces_created so we work also with pop3.
author Timo Sirainen <tss@iki.fi>
date Wed, 08 Aug 2007 15:49:12 +0300
parents aca5c234b71a
children 458aa25822fb
files src/plugins/lazy-expunge/Makefile.am src/plugins/lazy-expunge/lazy-expunge-plugin.c
diffstat 2 files changed, 14 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- 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 @@
 	-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
--- 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 @@
 
 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 @@
 	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);
+	if (lazy_expunge_next_hook_mail_namespaces_created != NULL)
+		lazy_expunge_next_hook_mail_namespaces_created(namespaces);
 
-	/* FIXME: this works only as long as there's only one client. */
 	t_push();
 	p = t_strsplit(getenv("LAZY_EXPUNGE"), " ");
 	for (i = 0; i < LAZY_NAMESPACE_COUNT; i++, p++) {
@@ -520,7 +520,7 @@
 			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 @@
 	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 @@
 	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;
 }