--- dovecot-antispam-1.2+20090702.orig/antispam-plugin.c
+++ dovecot-antispam-1.2+20090702/antispam-plugin.c
@@ -96,8 +96,8 @@
 	}
 }
 
-static bool mailbox_patternmatch(struct mailbox *box,
-				 struct mail_storage *storage,
+static bool mailbox_patternmatch(const struct mailbox *box,
+				 const struct mail_storage *storage,
 				 const char *name,
 				 bool lowercase)
 {
@@ -134,21 +134,21 @@
 	return rc;
 }
 
-static bool mailbox_patternmatch_case(struct mailbox *box,
-				      struct mail_storage *storage,
+static bool mailbox_patternmatch_case(const struct mailbox *box,
+				      const struct mail_storage *storage,
 				      const char *name)
 {
 	return mailbox_patternmatch(box, storage, name, FALSE);
 }
 
-static bool mailbox_patternmatch_icase(struct mailbox *box,
-				       struct mail_storage *storage,
+static bool mailbox_patternmatch_icase(const struct mailbox *box,
+				       const struct mail_storage *storage,
 				       const char *name)
 {
 	return mailbox_patternmatch(box, storage, name, TRUE);
 }
 
-typedef bool (*match_fn_t)(struct mailbox *, struct mail_storage *,
+typedef bool (*match_fn_t)(const struct mailbox *, const struct mail_storage *,
 			   const char *);
 
 /* match information */
--- dovecot-antispam-1.2+20090702.orig/antispam-plugin.h
+++ dovecot-antispam-1.2+20090702/antispam-plugin.h
@@ -8,6 +8,7 @@
 #include "dict.h"
 #include "imap-search.h"
 #include "dovecot-version.h"
+#include <stdlib.h>
 
 #define __stringify_1(x)	#x
 #define stringify(x)		__stringify_1(x)
--- dovecot-antispam-1.2+20090702.orig/debian/copyright
+++ dovecot-antispam-1.2+20090702/debian/copyright
@@ -0,0 +1,33 @@
+This package was debianized by Jonny Lamb <jonny@debian.org> on
+Wed, 18 Feb 2009 15:07:27 +0000.
+
+A tarball was created from a git snapshot of:
+ http://git.sipsolutions.net/dovecot-antispam.git
+
+Upstream Author:
+ Johannes Berg <johannes@sipsolutions.net>
+ Frank Cusack
+ Benedikt Boehm
+ Andreas Schneider
+
+Files: *
+Copyright:
+ Copyright 2004-2008 Johannes Berg <johannes@sipsolutions.net>
+ Copyright 2006 Frank Cusack
+License: GPL-2
+ On Debian systems, the complete text of the GNU General Public
+ License can be found in the file `/usr/share/common-licenses/GPL-2'.
+
+Files: antispam-storage-*
+Copyright:
+ Copyright 2007-2008 Johannes Berg <johannes@sipsolutions.net>
+ Copyright (C) 2005 Timo Sirainen
+License: GPL-2
+ On Debian systems, the complete text of the GNU General Public
+ License can be found in the file `/usr/share/common-licenses/GPL-2'.
+
+Files: debian/*
+Copyright: Copyright 2009 Jonny Lamb <jonny@debian.org>
+License: GPL-2
+ On Debian systems, the complete text of the GNU General Public
+ License can be found in the file `/usr/share/common-licenses/GPL-2'.
--- dovecot-antispam-1.2+20090702.orig/debian/dovecot-antispam-config
+++ dovecot-antispam-1.2+20090702/debian/dovecot-antispam-config
@@ -0,0 +1,50 @@
+# Example plugin build time configuration
+#
+# This file lists the configuration options that are used when building the
+# antispam plugin. All lines starting with # are ignored. Configuration option
+# lines must be commented out completely, if they are not to be included,
+# i.e. just setting VARIABLE=n is not disabling that variable.
+#
+# This file is included in Makefile, so variables like CFLAGS and LIBS can also
+# be modified from here. In most cases, these lines should use += in order not
+# to override previous values of the variables.
+
+# backend (select exactly one)
+#  dspam-exec		- direct dspam training by calling dspam executable
+#  signature-log	- signature logging using dovecot's dict API
+#  mailtrain		- send mail to special addresses for training
+#  crm114-exec		- direct crm114 training by calling mailreaver.crm
+#BACKEND=dspam-exec
+#BACKEND=signature-log
+BACKEND=mailtrain
+#BACKEND=crm114-exec
+
+# Dovecot build/header directory
+# Building the plugin requires configured dovecot sources or having
+# configured it with --enable-header-install in which case you can
+# point DOVECOT= to the installed headers too.
+#DOVECOT=../dovecot-1.0.5
+#DOVECOT=../dovecot-1.1
+DOVECOT=/usr/include/dovecot
+
+# install directory for 'make install'
+# NB no need for a final '/'
+INSTALLDIR=/usr/lib/dovecot/modules/imap
+# The user and group for the installed plugin
+USER=root
+GROUP=root
+
+# enable debugging to syslog or stderr
+#DEBUG=stderr
+#DEBUG=syslog
+
+# verbose debugging (lots of output!)
+#DEBUG_VERBOSE=1
+
+# plugin name, change only if you need to rename the plugin
+# (because, for example, you need two instances for different
+# spam filters installed)
+PLUGINNAME=antispam
+
+# extra CFLAGS
+# CFLAGS += -g3
--- dovecot-antispam-1.2+20090702.orig/debian/control
+++ dovecot-antispam-1.2+20090702/debian/control
@@ -0,0 +1,29 @@
+Source: dovecot-antispam
+Section: mail
+Priority: optional
+Maintainer: Ron Lee <ron@debian.org>
+Build-Depends: debhelper (>= 5), dovecot-dev
+Standards-Version: 3.8.2.0
+Homepage: http://johannes.sipsolutions.net/Projects/dovecot-antispam
+Vcs-Git: git://git.debian.org/users/ron/dovecot-antispam.git
+Vcs-Browser: http://git.debian.org/?p=users/ron/dovecot-antispam.git;a=summary
+
+Package: dovecot-antispam
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, dovecot-imapd
+Description: a Dovecot plugin that helps train spam filters
+ dovecot-antispam provides a plugin for the Dovecot IMAP server that
+ helps train spam filters. It watches designated spam folders and
+ trains mail as spam or non-spam when it moves in or out of those
+ folders respectively.  This avoids the problem of needing additional
+ folders to track correctly and incorrectly classified spam and non-spam.
+ .
+ dovecot-antispam supports dspam, crm114, and generic training by
+ mailing spam and non-spam to training addresses.  For crm114, it
+ supports folders for the additional "unsure" classification, and
+ trains when moving from there to spam or normal folders.
+ .
+ Note that dovecot-antispam needs the type of spam filter configured at
+ compile time.  It supports building with a custom name, specifically
+ to allow installing multiple variations simultaneously.  This package
+ is built to use the mailtrain backend.
--- dovecot-antispam-1.2+20090702.orig/debian/rules
+++ dovecot-antispam-1.2+20090702/debian/rules
@@ -0,0 +1,44 @@
+#!/usr/bin/make -f
+
+build: build-stamp
+
+build-stamp:
+	dh_testdir
+	cp debian/dovecot-antispam-config .config
+	$(MAKE)
+	touch $@
+
+clean:
+	dh_testdir
+	dh_testroot
+	rm -f build-stamp
+	$(MAKE) clean	
+	$(RM) .config dovecot-antispam.7
+	dh_clean
+
+install: build
+	dh_testdir
+	dh_testroot
+	dh_clean -k
+	dh_install lib90_antispam_plugin.so usr/lib/dovecot/modules/imap
+	ln -sf antispam.7 dovecot-antispam.7
+	dh_installman dovecot-antispam.7
+
+binary-indep: build install
+
+binary-arch: build install
+	dh_testdir
+	dh_testroot
+	dh_installdocs
+	dh_installchangelogs
+	dh_strip
+	dh_compress
+	dh_fixperms
+	dh_installdeb
+	dh_shlibdeps
+	dh_gencontrol
+	dh_md5sums
+	dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install
--- dovecot-antispam-1.2+20090702.orig/debian/changelog
+++ dovecot-antispam-1.2+20090702/debian/changelog
@@ -0,0 +1,65 @@
+dovecot-antispam (1.2+20090702-1~bpo50+3) lenny-backports; urgency=low
+
+  * Rebuild for new lenny-backports dovecot. (no changes to package)
+
+ -- Jonny Lamb <jonny@debian.org>  Fri, 02 Oct 2009 10:39:58 +0100
+
+dovecot-antispam (1.2+20090702-1~bpo50+2) lenny-backports; urgency=low
+
+  * Rebuild with lenny-backports dovecot. (no changes to package)
+
+ -- Jonny Lamb <jonny@debian.org>  Sun, 30 Aug 2009 20:33:58 +0100
+
+dovecot-antispam (1.2+20090702-1~bpo50+1) lenny-backports; urgency=low
+
+  * Backport to lenny. (no changes)
+
+ -- Jonny Lamb <jonny@debian.org>  Sun, 30 Aug 2009 20:33:58 +0100
+
+dovecot-antispam (1.2+20090702-1) unstable; urgency=low
+
+  * Adopt this one officially now with the maintainer's blessing. Thanks Jonny!
+  * Update the Vcs-* URLs to point at the repo this was prepared from.
+
+ -- Ron Lee <ron@debian.org>  Sat, 25 Jul 2009 04:45:14 +0930
+
+dovecot-antispam (1.2+20090702-0.2) unstable; urgency=low
+
+  * Include stdlib.h for the getenv prototype.  Closes: #537765
+  * Fix the match_fn_t prototype for dovecot 1.2 which makes more parameters
+    to it const.
+
+ -- Ron Lee <ron@debian.org>  Wed, 22 Jul 2009 23:14:52 +0930
+
+dovecot-antispam (1.2+20090702-0.1) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Import upstream fix af0f8f8de27901e2efb9560a1fc66c7af3cd810b, required to
+    build this with dovecot 1.2 now in unstable.  Closes: #537077
+
+ -- Ron Lee <ron@debian.org>  Fri, 17 Jul 2009 08:36:46 +0930
+
+dovecot-antispam (1.2-0.1) unstable; urgency=low
+
+  * Non-maintainer upload.  (Pulling in new upstream source)
+  * Rebuild to suit dovecot 1.1.16 currently in unstable.
+  * Note in the description this package is built using the mailtrain backend.
+    half- Closes: #532605, it probably still would be nice to build for all of
+    the backends, but I only need this one too, so add others as people to test
+    them put their hands up.
+  * Tidy up a little in debian/rules.
+
+ -- Ron Lee <ron@debian.org>  Sun, 12 Jul 2009 21:19:58 +0930
+
+dovecot-antispam (1.1+20090218.git.g28075fa-2) unstable; urgency=low
+
+  * debian/gbp.conf: Removed no-create-orig line.
+  * Rebuilding with newer dovecot. (Closes: #521643)
+
+ -- Jonny Lamb <jonny@debian.org>  Wed, 08 Apr 2009 09:43:38 +0100
+
+dovecot-antispam (1.1+20090218.git.g28075fa-1) unstable; urgency=low
+
+  * Initial release.
+
+ -- Jonny Lamb <jonny@debian.org>  Wed, 04 Mar 2009 16:06:42 +0000
--- dovecot-antispam-1.2+20090702.orig/debian/compat
+++ dovecot-antispam-1.2+20090702/debian/compat
@@ -0,0 +1 @@
+5
--- dovecot-antispam-1.2+20090702.orig/debian/README.Debian
+++ dovecot-antispam-1.2+20090702/debian/README.Debian
@@ -0,0 +1,6 @@
+dovecot-antispam
+================
+
+Read dovecot-antispam(7).
+
+ -- Jonny Lamb <jonny@debian.org>  Wed, 18 Feb 2009 15:02:42 +0000
