Package: dovecot
Version: 1:1.1.0-1
Severity: normal

Hi,

Timo created a plugin to "snarf" mails from one inbox to another.
More details about this can be found here:
http://dovecot.org/list/dovecot/2007-May/022803.html

Attached you will find a patch for the Debian package to include this patch into the dovecot-common.deb package. The patch has to be applied after dovecot_1.0.10-1.diff.gz is applied to the original source.
I hope this is the correct way of submitting this patch.

Please include this patch in a forthcoming version of the Dovecot-1.0 Debian package. In Dovecot 1.1 this plugin is already part of the sourcecode.

Greetings, Bernd Kuhls
diff -uwNr dovecot-1.0.10.debian.orig/debian/patches/00list 
dovecot-1.0.10.debian.patched/debian/patches/00list
--- dovecot-1.0.10.debian.orig/debian/patches/00list    2008-01-23 
23:07:54.000000000 +0100
+++ dovecot-1.0.10.debian.patched/debian/patches/00list 2008-01-23 
23:08:11.000000000 +0100
@@ -8,3 +8,4 @@
 protocols_none_by_default
 dovecot-ssl
 pam-error-information
+mbox_snarf
diff -uwNr dovecot-1.0.10.debian.orig/debian/patches/mbox_snarf.dpatch 
dovecot-1.0.10.debian.patched/debian/patches/mbox_snarf.dpatch
--- dovecot-1.0.10.debian.orig/debian/patches/mbox_snarf.dpatch 1970-01-01 
01:00:00.000000000 +0100
+++ dovecot-1.0.10.debian.patched/debian/patches/mbox_snarf.dpatch      
2008-01-23 23:08:11.000000000 +0100
@@ -0,0 +1,860 @@
+#! /bin/sh -e
+
+## DP: Hack to support mbox snarfing, Based heavily on email found here:
+## DP: http://dovecot.org/list/dovecot/2007-May/022803.html
+## DP: Author: Timo Sirainen
+
+. $(dirname $0)/DPATCH
+
+exit 0
[EMAIL PROTECTED]@
+diff -uwNr ./dovecot_patched/dovecot-1.0.10/configure 
./dovecot_compile/dovecot-1.0.10/configure
+--- dovecot-1.0.10/configure   2007-12-29 07:06:47.000000000 +0100
++++ dovecot-1.0.10/configure   2008-01-23 22:26:00.000000000 +0100
+@@ -32010,7 +32010,7 @@
+ 
+ ac_config_headers="$ac_config_headers config.h"
+ 
+-ac_config_files="$ac_config_files Makefile doc/Makefile doc/wiki/Makefile 
src/Makefile src/lib/Makefile src/lib-sql/Makefile src/lib-auth/Makefile 
src/lib-charset/Makefile src/lib-dict/Makefile src/lib-imap/Makefile 
src/lib-index/Makefile src/lib-mail/Makefile src/lib-ntlm/Makefile 
src/lib-settings/Makefile src/lib-storage/Makefile 
src/lib-storage/index/Makefile src/lib-storage/index/maildir/Makefile 
src/lib-storage/index/mbox/Makefile src/lib-storage/index/dbox/Makefile 
src/lib-storage/subscription-file/Makefile src/lib-storage/register/Makefile 
src/auth/Makefile src/deliver/Makefile src/dict/Makefile src/imap/Makefile 
src/imap-login/Makefile src/login-common/Makefile src/master/Makefile 
src/pop3/Makefile src/pop3-login/Makefile src/util/Makefile 
src/plugins/Makefile src/plugins/acl/Makefile src/plugins/convert/Makefile 
src/plugins/quota/Makefile src/plugins/imap-quota/Makefile 
src/plugins/lazy-expunge/Makefile src/plugins/mail-log/Makefile 
src/plugins/trash/Makefile src/plugins/zlib/Makefile stamp.h dovecot-config.in"
++ac_config_files="$ac_config_files Makefile doc/Makefile doc/wiki/Makefile 
src/Makefile src/lib/Makefile src/lib-sql/Makefile src/lib-auth/Makefile 
src/lib-charset/Makefile src/lib-dict/Makefile src/lib-imap/Makefile 
src/lib-index/Makefile src/lib-mail/Makefile src/lib-ntlm/Makefile 
src/lib-settings/Makefile src/lib-storage/Makefile 
src/lib-storage/index/Makefile src/lib-storage/index/maildir/Makefile 
src/lib-storage/index/mbox/Makefile src/lib-storage/index/dbox/Makefile 
src/lib-storage/subscription-file/Makefile src/lib-storage/register/Makefile 
src/auth/Makefile src/deliver/Makefile src/dict/Makefile src/imap/Makefile 
src/imap-login/Makefile src/login-common/Makefile src/master/Makefile 
src/pop3/Makefile src/pop3-login/Makefile src/util/Makefile 
src/plugins/Makefile src/plugins/acl/Makefile src/plugins/convert/Makefile 
src/plugins/quota/Makefile src/plugins/imap-quota/Makefile 
src/plugins/lazy-expunge/Makefile src/plugins/mail-log/Makefile 
src/plugins/mbox-snarf/Makefile src/plugins/trash/Makefile 
src/plugins/zlib/Makefile stamp.h dovecot-config.in"
+ 
+ 
+ cat >confcache <<\_ACEOF
+@@ -32685,6 +32685,7 @@
+     "src/plugins/imap-quota/Makefile") CONFIG_FILES="$CONFIG_FILES 
src/plugins/imap-quota/Makefile" ;;
+     "src/plugins/lazy-expunge/Makefile") CONFIG_FILES="$CONFIG_FILES 
src/plugins/lazy-expunge/Makefile" ;;
+     "src/plugins/mail-log/Makefile") CONFIG_FILES="$CONFIG_FILES 
src/plugins/mail-log/Makefile" ;;
++    "src/plugins/mbox-snarf/Makefile") CONFIG_FILES="$CONFIG_FILES 
src/plugins/mbox-snarf/Makefile" ;;
+     "src/plugins/trash/Makefile") CONFIG_FILES="$CONFIG_FILES 
src/plugins/trash/Makefile" ;;
+     "src/plugins/zlib/Makefile") CONFIG_FILES="$CONFIG_FILES 
src/plugins/zlib/Makefile" ;;
+     "stamp.h") CONFIG_FILES="$CONFIG_FILES stamp.h" ;;
+diff -uwNr ./dovecot_patched/dovecot-1.0.10/configure.in 
./dovecot_compile/dovecot-1.0.10/configure.in
+--- dovecot-1.0.10/configure.in        2007-12-29 07:06:24.000000000 +0100
++++ dovecot-1.0.10/configure.in        2008-01-23 22:25:54.000000000 +0100
+@@ -1854,6 +1854,7 @@
+ src/plugins/imap-quota/Makefile
+ src/plugins/lazy-expunge/Makefile
+ src/plugins/mail-log/Makefile
++src/plugins/mbox-snarf/Makefile
+ src/plugins/trash/Makefile
+ src/plugins/zlib/Makefile
+ stamp.h
+diff -uwNr ./dovecot_patched/dovecot-1.0.10/src/plugins/Makefile.am 
./dovecot_compile/dovecot-1.0.10/src/plugins/Makefile.am
+--- dovecot-1.0.10/src/plugins/Makefile.am     2007-12-11 19:52:09.000000000 
+0100
++++ dovecot-1.0.10/src/plugins/Makefile.am     2008-01-23 22:23:48.000000000 
+0100
+@@ -2,4 +2,4 @@
+ ZLIB = zlib
+ endif
+ 
+-SUBDIRS = acl convert quota imap-quota lazy-expunge mail-log trash $(ZLIB)
++SUBDIRS = acl convert quota imap-quota lazy-expunge mail-log mbox-snarf trash 
$(ZLIB)
+diff -uwNr ./dovecot_patched/dovecot-1.0.10/src/plugins/Makefile.in 
./dovecot_compile/dovecot-1.0.10/src/plugins/Makefile.in
+--- dovecot-1.0.10/src/plugins/Makefile.in     2007-12-29 07:06:51.000000000 
+0100
++++ dovecot-1.0.10/src/plugins/Makefile.in     2008-01-23 22:48:50.000000000 
+0100
+@@ -55,7 +55,7 @@
+ ETAGS = etags
+ CTAGS = ctags
+ DIST_SUBDIRS = acl convert quota imap-quota lazy-expunge mail-log \
+-      trash zlib
++      mbox-snarf trash zlib
+ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ ACLOCAL = @ACLOCAL@
+ AMDEP_FALSE = @AMDEP_FALSE@
+@@ -192,7 +192,7 @@
+ sysconfdir = @sysconfdir@
+ target_alias = @target_alias@
+ @[EMAIL PROTECTED] = zlib
+-SUBDIRS = acl convert quota imap-quota lazy-expunge mail-log trash $(ZLIB)
++SUBDIRS = acl convert quota imap-quota lazy-expunge mail-log mbox-snarf trash 
$(ZLIB)
+ all: all-recursive
+ 
+ .SUFFIXES:
+diff -uwNr ./dovecot_patched/dovecot-1.0.10/src/plugins/mbox-snarf/Makefile.am 
./dovecot_compile/dovecot-1.0.10/src/plugins/mbox-snarf/Makefile.am
+--- dovecot-1.0.10/src/plugins/mbox-snarf/Makefile.am  1970-01-01 
01:00:00.000000000 +0100
++++ dovecot-1.0.10/src/plugins/mbox-snarf/Makefile.am  2008-01-23 
22:48:34.000000000 +0100
+@@ -0,0 +1,24 @@
++AM_CPPFLAGS = \
++      -I$(top_srcdir)/src/lib \
++      -I$(top_srcdir)/src/lib-mail \
++      -I$(top_srcdir)/src/lib-storage \
++      -I$(top_srcdir)/src/lib-imap
++
++lib20_mbox_snarf_plugin_la_LDFLAGS = -module -avoid-version
++
++module_LTLIBRARIES = \
++      lib20_mbox_snarf_plugin.la
++
++lib20_mbox_snarf_plugin_la_SOURCES = \
++      mbox-snarf-plugin.c
++
++noinst_HEADERS = \
++      mbox-snarf-plugin.h
++
++install-exec-local:
++      for d in imap pop3 lda; do \
++        $(mkdir_p) $(DESTDIR)$(moduledir)/$$d; \
++        rm -f $(DESTDIR)$(moduledir)/$$d/lib20_mbox_snarf_plugin.so; \
++        $(LN_S) ../lib20_mbox_snarf_plugin.so $(DESTDIR)$(moduledir)/$$d; \
++      done
++
+diff -uwNr ./dovecot_patched/dovecot-1.0.10/src/plugins/mbox-snarf/Makefile.in 
./dovecot_compile/dovecot-1.0.10/src/plugins/mbox-snarf/Makefile.in
+--- dovecot-1.0.10/src/plugins/mbox-snarf/Makefile.in  1970-01-01 
01:00:00.000000000 +0100
++++ dovecot-1.0.10/src/plugins/mbox-snarf/Makefile.in  2008-01-23 
22:48:51.000000000 +0100
+@@ -0,0 +1,511 @@
++# Makefile.in generated by automake 1.9.6 from Makefile.am.
++# @configure_input@
++
++# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
++# 2003, 2004, 2005  Free Software Foundation, Inc.
++# This Makefile.in is free software; the Free Software Foundation
++# gives unlimited permission to copy and/or distribute it,
++# with or without modifications, as long as this notice is preserved.
++
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
++# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
++# PARTICULAR PURPOSE.
++
[EMAIL PROTECTED]@
++
++
++srcdir = @srcdir@
++top_srcdir = @top_srcdir@
++VPATH = @srcdir@
++pkgdatadir = $(datadir)/@PACKAGE@
++pkglibdir = $(libdir)/@PACKAGE@
++pkgincludedir = $(includedir)/@PACKAGE@
++top_builddir = ../../..
++am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
++INSTALL = @INSTALL@
++install_sh_DATA = $(install_sh) -c -m 644
++install_sh_PROGRAM = $(install_sh) -c
++install_sh_SCRIPT = $(install_sh) -c
++INSTALL_HEADER = $(INSTALL_DATA)
++transform = $(program_transform_name)
++NORMAL_INSTALL = :
++PRE_INSTALL = :
++POST_INSTALL = :
++NORMAL_UNINSTALL = :
++PRE_UNINSTALL = :
++POST_UNINSTALL = :
++build_triplet = @build@
++host_triplet = @host@
++subdir = src/plugins/mbox-snarf
++DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
++      $(srcdir)/Makefile.in
++ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
++am__aclocal_m4_deps = $(top_srcdir)/configure.in
++am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
++      $(ACLOCAL_M4)
++mkinstalldirs = $(install_sh) -d
++CONFIG_HEADER = $(top_builddir)/config.h
++CONFIG_CLEAN_FILES =
++am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
++am__vpath_adj = case $$p in \
++    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
++    *) f=$$p;; \
++  esac;
++am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
++am__installdirs = "$(DESTDIR)$(moduledir)"
++moduleLTLIBRARIES_INSTALL = $(INSTALL)
++LTLIBRARIES = $(module_LTLIBRARIES)
++lib20_mbox_snarf_plugin_la_LIBADD =
++am_lib20_mbox_snarf_plugin_la_OBJECTS = mbox-snarf-plugin.lo
++lib20_mbox_snarf_plugin_la_OBJECTS =  \
++      $(am_lib20_mbox_snarf_plugin_la_OBJECTS)
++DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
++depcomp = $(SHELL) $(top_srcdir)/depcomp
++am__depfiles_maybe = depfiles
++COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
++      $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
++LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
++      $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
++      $(AM_CFLAGS) $(CFLAGS)
++CCLD = $(CC)
++LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
++      $(AM_LDFLAGS) $(LDFLAGS) -o $@
++SOURCES = $(lib20_mbox_snarf_plugin_la_SOURCES)
++DIST_SOURCES = $(lib20_mbox_snarf_plugin_la_SOURCES)
++HEADERS = $(noinst_HEADERS)
++ETAGS = etags
++CTAGS = ctags
++DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
++ACLOCAL = @ACLOCAL@
++AMDEP_FALSE = @AMDEP_FALSE@
++AMDEP_TRUE = @AMDEP_TRUE@
++AMTAR = @AMTAR@
++AR = @AR@
++AUTH_CFLAGS = @AUTH_CFLAGS@
++AUTH_LIBS = @AUTH_LIBS@
++AUTOCONF = @AUTOCONF@
++AUTOHEADER = @AUTOHEADER@
++AUTOMAKE = @AUTOMAKE@
++AWK = @AWK@
++BUILD_DELIVER_FALSE = @BUILD_DELIVER_FALSE@
++BUILD_DELIVER_TRUE = @BUILD_DELIVER_TRUE@
++BUILD_DOCS_FALSE = @BUILD_DOCS_FALSE@
++BUILD_DOCS_TRUE = @BUILD_DOCS_TRUE@
++BUILD_POP3D_FALSE = @BUILD_POP3D_FALSE@
++BUILD_POP3D_TRUE = @BUILD_POP3D_TRUE@
++BUILD_ZLIB_FALSE = @BUILD_ZLIB_FALSE@
++BUILD_ZLIB_TRUE = @BUILD_ZLIB_TRUE@
++CC = @CC@
++CCDEPMODE = @CCDEPMODE@
++CFLAGS = @CFLAGS@
++CPP = @CPP@
++CPPFLAGS = @CPPFLAGS@
++CXX = @CXX@
++CXXCPP = @CXXCPP@
++CXXDEPMODE = @CXXDEPMODE@
++CXXFLAGS = @CXXFLAGS@
++CYGPATH_W = @CYGPATH_W@
++DEFS = @DEFS@
++DEPDIR = @DEPDIR@
++ECHO = @ECHO@
++ECHO_C = @ECHO_C@
++ECHO_N = @ECHO_N@
++ECHO_T = @ECHO_T@
++EGREP = @EGREP@
++EXEEXT = @EXEEXT@
++F77 = @F77@
++FFLAGS = @FFLAGS@
++GREP = @GREP@
++INSTALL_DATA = @INSTALL_DATA@
++INSTALL_HEADERS_FALSE = @INSTALL_HEADERS_FALSE@
++INSTALL_HEADERS_TRUE = @INSTALL_HEADERS_TRUE@
++INSTALL_PROGRAM = @INSTALL_PROGRAM@
++INSTALL_SCRIPT = @INSTALL_SCRIPT@
++INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
++KRB5CONFIG = @KRB5CONFIG@
++LDFLAGS = @LDFLAGS@
++LIBICONV = @LIBICONV@
++LIBOBJS = @LIBOBJS@
++LIBS = @LIBS@
++LIBTOOL = @LIBTOOL@
++LN_S = @LN_S@
++LTLIBICONV = @LTLIBICONV@
++LTLIBOBJS = @LTLIBOBJS@
++MAINT = @MAINT@
++MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
++MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
++MAKEINFO = @MAKEINFO@
++MODULE_LIBS = @MODULE_LIBS@
++OBJEXT = @OBJEXT@
++PACKAGE = @PACKAGE@
++PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
++PACKAGE_NAME = @PACKAGE_NAME@
++PACKAGE_STRING = @PACKAGE_STRING@
++PACKAGE_TARNAME = @PACKAGE_TARNAME@
++PACKAGE_VERSION = @PACKAGE_VERSION@
++PATH_SEPARATOR = @PATH_SEPARATOR@
++PKG_CONFIG = @PKG_CONFIG@
++RAND_LIBS = @RAND_LIBS@
++RANLIB = @RANLIB@
++SED = @SED@
++SET_MAKE = @SET_MAKE@
++SHELL = @SHELL@
++SQL_CFLAGS = @SQL_CFLAGS@
++SQL_LIBS = @SQL_LIBS@
++SSL_CFLAGS = @SSL_CFLAGS@
++SSL_LIBS = @SSL_LIBS@
++STORAGE_LIBS = @STORAGE_LIBS@
++STRIP = @STRIP@
++VERSION = @VERSION@
++ac_ct_CC = @ac_ct_CC@
++ac_ct_CXX = @ac_ct_CXX@
++ac_ct_F77 = @ac_ct_F77@
++am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
++am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
++am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
++am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
++am__include = @am__include@
++am__leading_dot = @am__leading_dot@
++am__quote = @am__quote@
++am__tar = @am__tar@
++am__untar = @am__untar@
++bindir = @bindir@
++build = @build@
++build_alias = @build_alias@
++build_cpu = @build_cpu@
++build_os = @build_os@
++build_vendor = @build_vendor@
++datadir = @datadir@
++datarootdir = @datarootdir@
++docdir = @docdir@
++dvidir = @dvidir@
++exec_prefix = @exec_prefix@
++host = @host@
++host_alias = @host_alias@
++host_cpu = @host_cpu@
++host_os = @host_os@
++host_vendor = @host_vendor@
++htmldir = @htmldir@
++includedir = @includedir@
++infodir = @infodir@
++install_sh = @install_sh@
++libdir = @libdir@
++libexecdir = @libexecdir@
++localedir = @localedir@
++localstatedir = @localstatedir@
++mail_storages = @mail_storages@
++mandir = @mandir@
++mkdir_p = @mkdir_p@
++moduledir = @moduledir@
++oldincludedir = @oldincludedir@
++pdfdir = @pdfdir@
++prefix = @prefix@
++program_transform_name = @program_transform_name@
++psdir = @psdir@
++rundir = @rundir@
++sbindir = @sbindir@
++sharedstatedir = @sharedstatedir@
++sql_drivers = @sql_drivers@
++ssldir = @ssldir@
++statedir = @statedir@
++sysconfdir = @sysconfdir@
++target_alias = @target_alias@
++AM_CPPFLAGS = \
++      -I$(top_srcdir)/src/lib \
++      -I$(top_srcdir)/src/lib-mail \
++      -I$(top_srcdir)/src/lib-storage \
++      -I$(top_srcdir)/src/lib-imap
++
++lib20_mbox_snarf_plugin_la_LDFLAGS = -module -avoid-version
++module_LTLIBRARIES = \
++      lib20_mbox_snarf_plugin.la
++
++lib20_mbox_snarf_plugin_la_SOURCES = \
++      mbox-snarf-plugin.c
++
++noinst_HEADERS = \
++      mbox-snarf-plugin.h
++
++all: all-am
++
++.SUFFIXES:
++.SUFFIXES: .c .lo .o .obj
++$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  
$(am__configure_deps)
++      @for dep in $?; do \
++        case '$(am__configure_deps)' in \
++          *$$dep*) \
++            cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
++              && exit 0; \
++            exit 1;; \
++        esac; \
++      done; \
++      echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  
src/plugins/mbox-snarf/Makefile'; \
++      cd $(top_srcdir) && \
++        $(AUTOMAKE) --gnu  src/plugins/mbox-snarf/Makefile
++.PRECIOUS: Makefile
++Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
++      @case '$?' in \
++        *config.status*) \
++          cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
++        *) \
++          echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ 
$(am__depfiles_maybe)'; \
++          cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ 
$(am__depfiles_maybe);; \
++      esac;
++
++$(top_builddir)/config.status: $(top_srcdir)/configure 
$(CONFIG_STATUS_DEPENDENCIES)
++      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
++
++$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
++      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
++$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
++      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
++install-moduleLTLIBRARIES: $(module_LTLIBRARIES)
++      @$(NORMAL_INSTALL)
++      test -z "$(moduledir)" || $(mkdir_p) "$(DESTDIR)$(moduledir)"
++      @list='$(module_LTLIBRARIES)'; for p in $$list; do \
++        if test -f $$p; then \
++          f=$(am__strip_dir) \
++          echo " $(LIBTOOL) --mode=install $(moduleLTLIBRARIES_INSTALL) 
$(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(moduledir)/$$f'"; \
++          $(LIBTOOL) --mode=install $(moduleLTLIBRARIES_INSTALL) 
$(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(moduledir)/$$f"; \
++        else :; fi; \
++      done
++
++uninstall-moduleLTLIBRARIES:
++      @$(NORMAL_UNINSTALL)
++      @set -x; list='$(module_LTLIBRARIES)'; for p in $$list; do \
++        p=$(am__strip_dir) \
++        echo " $(LIBTOOL) --mode=uninstall rm -f 
'$(DESTDIR)$(moduledir)/$$p'"; \
++        $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(moduledir)/$$p"; \
++      done
++
++clean-moduleLTLIBRARIES:
++      -test -z "$(module_LTLIBRARIES)" || rm -f $(module_LTLIBRARIES)
++      @list='$(module_LTLIBRARIES)'; for p in $$list; do \
++        dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
++        test "$$dir" != "$$p" || dir=.; \
++        echo "rm -f \"$${dir}/so_locations\""; \
++        rm -f "$${dir}/so_locations"; \
++      done
++lib20_mbox_snarf_plugin.la: $(lib20_mbox_snarf_plugin_la_OBJECTS) 
$(lib20_mbox_snarf_plugin_la_DEPENDENCIES) 
++      $(LINK) -rpath $(moduledir) $(lib20_mbox_snarf_plugin_la_LDFLAGS) 
$(lib20_mbox_snarf_plugin_la_OBJECTS) $(lib20_mbox_snarf_plugin_la_LIBADD) 
$(LIBS)
++
++mostlyclean-compile:
++      -rm -f *.$(OBJEXT)
++
++distclean-compile:
++      -rm -f *.tab.c
++
[EMAIL PROTECTED]@@am__include@ @[EMAIL PROTECTED]/$(DEPDIR)/[EMAIL PROTECTED]@
++
++.c.o:
[EMAIL PROTECTED]@      if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c 
-o $@ $<; \
[EMAIL PROTECTED]@      then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else 
rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
[EMAIL PROTECTED]@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no 
@AMDEPBACKSLASH@
[EMAIL PROTECTED]@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) 
$(depcomp) @AMDEPBACKSLASH@
[EMAIL PROTECTED]@      $(COMPILE) -c $<
++
++.c.obj:
[EMAIL PROTECTED]@      if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c 
-o $@ `$(CYGPATH_W) '$<'`; \
[EMAIL PROTECTED]@      then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else 
rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
[EMAIL PROTECTED]@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no 
@AMDEPBACKSLASH@
[EMAIL PROTECTED]@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) 
$(depcomp) @AMDEPBACKSLASH@
[EMAIL PROTECTED]@      $(COMPILE) -c `$(CYGPATH_W) '$<'`
++
++.c.lo:
[EMAIL PROTECTED]@      if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" 
-c -o $@ $<; \
[EMAIL PROTECTED]@      then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else 
rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
[EMAIL PROTECTED]@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes 
@AMDEPBACKSLASH@
[EMAIL PROTECTED]@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) 
$(depcomp) @AMDEPBACKSLASH@
[EMAIL PROTECTED]@      $(LTCOMPILE) -c -o $@ $<
++
++mostlyclean-libtool:
++      -rm -f *.lo
++
++clean-libtool:
++      -rm -rf .libs _libs
++
++distclean-libtool:
++      -rm -f libtool
++uninstall-info-am:
++
++ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
++      list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
++      unique=`for i in $$list; do \
++          if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
++        done | \
++        $(AWK) '    { files[$$0] = 1; } \
++             END { for (i in files) print i; }'`; \
++      mkid -fID $$unique
++tags: TAGS
++
++TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
++              $(TAGS_FILES) $(LISP)
++      tags=; \
++      here=`pwd`; \
++      list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
++      unique=`for i in $$list; do \
++          if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
++        done | \
++        $(AWK) '    { files[$$0] = 1; } \
++             END { for (i in files) print i; }'`; \
++      if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
++        test -n "$$unique" || unique=$$empty_fix; \
++        $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
++          $$tags $$unique; \
++      fi
++ctags: CTAGS
++CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
++              $(TAGS_FILES) $(LISP)
++      tags=; \
++      here=`pwd`; \
++      list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
++      unique=`for i in $$list; do \
++          if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
++        done | \
++        $(AWK) '    { files[$$0] = 1; } \
++             END { for (i in files) print i; }'`; \
++      test -z "$(CTAGS_ARGS)$$tags$$unique" \
++        || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
++           $$tags $$unique
++
++GTAGS:
++      here=`$(am__cd) $(top_builddir) && pwd` \
++        && cd $(top_srcdir) \
++        && gtags -i $(GTAGS_ARGS) $$here
++
++distclean-tags:
++      -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
++
++distdir: $(DISTFILES)
++      @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
++      topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
++      list='$(DISTFILES)'; for file in $$list; do \
++        case $$file in \
++          $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
++          $(top_srcdir)/*) file=`echo "$$file" | sed 
"s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
++        esac; \
++        if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
++        dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
++        if test "$$dir" != "$$file" && test "$$dir" != "."; then \
++          dir="/$$dir"; \
++          $(mkdir_p) "$(distdir)$$dir"; \
++        else \
++          dir=''; \
++        fi; \
++        if test -d $$d/$$file; then \
++          if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
++            cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
++          fi; \
++          cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
++        else \
++          test -f $(distdir)/$$file \
++          || cp -p $$d/$$file $(distdir)/$$file \
++          || exit 1; \
++        fi; \
++      done
++check-am: all-am
++check: check-am
++all-am: Makefile $(LTLIBRARIES) $(HEADERS)
++installdirs:
++      for dir in "$(DESTDIR)$(moduledir)"; do \
++        test -z "$$dir" || $(mkdir_p) "$$dir"; \
++      done
++install: install-am
++install-exec: install-exec-am
++install-data: install-data-am
++uninstall: uninstall-am
++
++install-am: all-am
++      @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
++
++installcheck: installcheck-am
++install-strip:
++      $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
++        install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
++        `test -z '$(STRIP)' || \
++          echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
++mostlyclean-generic:
++
++clean-generic:
++
++distclean-generic:
++      -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
++
++maintainer-clean-generic:
++      @echo "This command is intended for maintainers to use"
++      @echo "it deletes files that may require special tools to rebuild."
++clean: clean-am
++
++clean-am: clean-generic clean-libtool clean-moduleLTLIBRARIES \
++      mostlyclean-am
++
++distclean: distclean-am
++      -rm -rf ./$(DEPDIR)
++      -rm -f Makefile
++distclean-am: clean-am distclean-compile distclean-generic \
++      distclean-libtool distclean-tags
++
++dvi: dvi-am
++
++dvi-am:
++
++html: html-am
++
++info: info-am
++
++info-am:
++
++install-data-am: install-moduleLTLIBRARIES
++
++install-exec-am: install-exec-local
++
++install-info: install-info-am
++
++install-man:
++
++installcheck-am:
++
++maintainer-clean: maintainer-clean-am
++      -rm -rf ./$(DEPDIR)
++      -rm -f Makefile
++maintainer-clean-am: distclean-am maintainer-clean-generic
++
++mostlyclean: mostlyclean-am
++
++mostlyclean-am: mostlyclean-compile mostlyclean-generic \
++      mostlyclean-libtool
++
++pdf: pdf-am
++
++pdf-am:
++
++ps: ps-am
++
++ps-am:
++
++uninstall-am: uninstall-info-am uninstall-moduleLTLIBRARIES
++
++.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
++      clean-libtool clean-moduleLTLIBRARIES ctags distclean \
++      distclean-compile distclean-generic distclean-libtool \
++      distclean-tags distdir dvi dvi-am html html-am info info-am \
++      install install-am install-data install-data-am install-exec \
++      install-exec-am install-exec-local install-info \
++      install-info-am install-man install-moduleLTLIBRARIES \
++      install-strip installcheck installcheck-am installdirs \
++      maintainer-clean maintainer-clean-generic mostlyclean \
++      mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
++      pdf pdf-am ps ps-am tags uninstall uninstall-am \
++      uninstall-info-am uninstall-moduleLTLIBRARIES
++
++
++install-exec-local:
++      for d in imap pop3 lda; do \
++        $(mkdir_p) $(DESTDIR)$(moduledir)/$$d; \
++        rm -f $(DESTDIR)$(moduledir)/$$d/lib20_mbox_snarf_plugin.so; \
++        $(LN_S) ../lib20_mbox_snarf_plugin.so $(DESTDIR)$(moduledir)/$$d; \
++      done
++# Tell versions [3.59,3.63) of GNU make to not export all variables.
++# Otherwise a system limit (for SysV at least) may be exceeded.
++.NOEXPORT:
+diff -uwNr 
./dovecot_patched/dovecot-1.0.10/src/plugins/mbox-snarf/mbox-snarf-plugin.c 
./dovecot_compile/dovecot-1.0.10/src/plugins/mbox-snarf/mbox-snarf-plugin.c
+--- dovecot-1.0.10/src/plugins/mbox-snarf/mbox-snarf-plugin.c  1970-01-01 
01:00:00.000000000 +0100
++++ dovecot-1.0.10/src/plugins/mbox-snarf/mbox-snarf-plugin.c  2007-06-05 
20:15:47.000000000 +0200
+@@ -0,0 +1,231 @@
++/* Copyright (C) 2007 Timo Sirainen */
++
++/*
++   export DOVECOT=~/src/dovecot-1.0.0
++   gcc -fPIC -shared -Wall -I$DOVECOT -I$DOVECOT/src/lib \
++     -I$DOVECOT/src/lib-storage -I$DOVECOT/src/lib-mail \
++     -I$DOVECOT/src/lib-imap -DHAVE_CONFIG_H \
++     mbox-snarf-plugin.c -o mbox_snarf_plugin.so
++*/
++
++#include "lib.h"
++#include "array.h"
++#include "home-expand.h"
++#include "mail-search.h"
++#include "mail-storage-private.h"
++
++#include <stdlib.h>
++#include <sys/stat.h>
++
++#define MBOX_SNARF_CONTEXT(obj) \
++      *((void **)array_idx_modifyable(&(obj)->module_contexts, \
++                                      mbox_snarf_storage_module_id))
++
++struct mbox_snarf_mail_storage {
++      struct mail_storage_vfuncs super;
++      bool internal_namespace;
++
++      const char *snarf_inbox_path;
++      bool open_spool_inbox;
++};
++
++struct mbox_snarf_mailbox {
++      struct mailbox_vfuncs super;
++
++      struct mailbox *spool_mbox;
++};
++
++/* defined by imap, pop3, lda */
++extern void (*hook_mail_storage_created)(struct mail_storage *storage);
++
++const char *mbox_snarf_plugin_version = PACKAGE_VERSION;
++
++static void (*mbox_snarf_next_hook_mail_storage_created)
++      (struct mail_storage *storage);
++
++static unsigned int mbox_snarf_storage_module_id = 0;
++static bool mbox_snarf_storage_module_id_set = FALSE;
++
++static int sync_mailbox(struct mailbox *box)
++{
++      struct mailbox_sync_context *ctx;
++        struct mailbox_sync_rec sync_rec;
++      struct mailbox_status status;
++
++      ctx = mailbox_sync_init(box, MAILBOX_SYNC_FLAG_FULL_READ);
++      while (mailbox_sync_next(ctx, &sync_rec) > 0)
++              ;
++      return mailbox_sync_deinit(&ctx, &status);
++}
++
++static int mbox_snarf(struct mailbox *srcbox, struct mailbox *destbox)
++{
++      struct mail_search_arg search_arg;
++      struct mail_search_context *search_ctx;
++        struct mailbox_transaction_context *src_trans, *dest_trans;
++      struct mail *mail;
++      int ret;
++
++      if (sync_mailbox(srcbox) < 0)
++              return -1;
++
++      memset(&search_arg, 0, sizeof(search_arg));
++      search_arg.type = SEARCH_ALL;
++
++      src_trans = mailbox_transaction_begin(srcbox, 0);
++      dest_trans = mailbox_transaction_begin(destbox,
++                                      MAILBOX_TRANSACTION_FLAG_EXTERNAL);
++      search_ctx = mailbox_search_init(src_trans, NULL, &search_arg, NULL);
++
++      mail = mail_alloc(src_trans, MAIL_FETCH_STREAM_HEADER |
++                        MAIL_FETCH_STREAM_BODY, NULL);
++      while ((ret = mailbox_search_next(search_ctx, mail)) > 0) {
++              if (mail->expunged)
++                      continue;
++
++              if (mailbox_copy(dest_trans, mail, 0, NULL, NULL) < 0) {
++                      if (!mail->expunged)
++                              break;
++              }
++              mail_expunge(mail);
++      }
++      mail_free(&mail);
++
++      if (mailbox_search_deinit(&search_ctx) < 0)
++              ret = -1;
++
++      /* commit the copied messages to the destination mailbox. if we crash
++         between that and between expunging the messages from the source
++         mailbox, we're left with duplicates. */
++      if (ret < 0)
++              mailbox_transaction_rollback(&dest_trans);
++      else if (mailbox_transaction_commit(&dest_trans, 0) < 0)
++              ret = -1;
++
++      if (ret < 0)
++              mailbox_transaction_rollback(&src_trans);
++      else {
++              if (mailbox_transaction_commit(&src_trans, 0) < 0)
++                      ret = -1;
++      }
++      return ret;
++}
++
++static struct mailbox_sync_context *
++mbox_snarf_sync_init(struct mailbox *box, enum mailbox_sync_flags flags)
++{
++      struct mbox_snarf_mail_storage *mstorage =
++              MBOX_SNARF_CONTEXT(box->storage);
++      struct mbox_snarf_mailbox *mbox = MBOX_SNARF_CONTEXT(box);
++
++      if (mbox->spool_mbox == NULL) {
++              /* try to open the spool mbox */
++              mstorage->open_spool_inbox = TRUE;
++              mbox->spool_mbox =
++                      mailbox_open(box->storage, "INBOX", NULL,
++                                   MAILBOX_OPEN_KEEP_RECENT |
++                                   MAILBOX_OPEN_NO_INDEX_FILES);
++              mstorage->open_spool_inbox = FALSE;
++      }
++
++      if (mbox->spool_mbox != NULL)
++              mbox_snarf(mbox->spool_mbox, box);
++
++      return mbox->super.sync_init(box, flags);
++}
++
++static int mbox_snarf_close(struct mailbox *box)
++{
++      struct mbox_snarf_mailbox *mbox = MBOX_SNARF_CONTEXT(box);
++
++      if (mbox->spool_mbox != NULL)
++              mailbox_close(&mbox->spool_mbox);
++
++      return mbox->super.close(box);
++}
++
++static struct mailbox *
++mbox_snarf_mailbox_open(struct mail_storage *storage, const char *name,
++                      struct istream *input, enum mailbox_open_flags flags)
++{
++      struct mbox_snarf_mail_storage *mstorage =
++              MBOX_SNARF_CONTEXT(storage);
++      struct mailbox *box;
++      struct mbox_snarf_mailbox *mbox;
++      struct stat st;
++      enum mail_storage_flags old_flags = storage->flags;
++      bool use_snarfing = FALSE;
++
++      if (strcasecmp(name, "INBOX") == 0 && !mstorage->open_spool_inbox) {
++              if (stat(mstorage->snarf_inbox_path, &st) == 0) {
++                      /* use ~/mbox as the INBOX */
++                      name = mstorage->snarf_inbox_path;
++                      use_snarfing = TRUE;
++                      storage->flags |= MAIL_STORAGE_FLAG_FULL_FS_ACCESS;
++              } else if (errno != ENOENT) {
++                      mail_storage_set_critical(storage,
++                                                "stat(%s) failed: %m",
++                                                mstorage->snarf_inbox_path);
++              }
++      }
++
++      box = mstorage->super.mailbox_open(storage, name, input, flags);
++      storage->flags = old_flags;
++
++      if (box == NULL || !use_snarfing)
++              return box;
++
++      mbox = p_new(box->pool, struct mbox_snarf_mailbox, 1);
++      mbox->super = box->v;
++
++      box->v.sync_init = mbox_snarf_sync_init;
++      box->v.close = mbox_snarf_close;
++      array_idx_set(&box->module_contexts,
++                    mbox_snarf_storage_module_id, &mbox);
++      return box;
++}
++
++static void mbox_snarf_mail_storage_created(struct mail_storage *storage)
++{
++      struct mbox_snarf_mail_storage *mstorage;
++
++      if (mbox_snarf_next_hook_mail_storage_created != NULL)
++              mbox_snarf_next_hook_mail_storage_created(storage);
++
++      mstorage = p_new(storage->pool, struct mbox_snarf_mail_storage, 1);
++      mstorage->snarf_inbox_path =
++              p_strdup(storage->pool, home_expand(getenv("MBOX_SNARF")));
++      mstorage->super = storage->v;
++      storage->v.mailbox_open = mbox_snarf_mailbox_open;
++
++      if (!mbox_snarf_storage_module_id_set) {
++              mbox_snarf_storage_module_id = mail_storage_module_id++;
++              mbox_snarf_storage_module_id_set = TRUE;
++      }
++
++      array_idx_set(&storage->module_contexts,
++                    mbox_snarf_storage_module_id, &mstorage);
++}
++
++void mbox_snarf_plugin_init(void);
++void mbox_snarf_plugin_deinit(void);
++
++void mbox_snarf_plugin_init(void)
++{
++      const char *path;
++
++      path = getenv("MBOX_SNARF");
++      if (path != NULL) {
++              mbox_snarf_next_hook_mail_storage_created =
++                      hook_mail_storage_created;
++              hook_mail_storage_created = mbox_snarf_mail_storage_created;
++      }
++}
++
++void mbox_snarf_plugin_deinit(void)
++{
++      if (getenv("MBOX_SNARF") != NULL) {
++              hook_mail_storage_created =
++                      mbox_snarf_next_hook_mail_storage_created;
++      }
++}
+diff -uwNr 
./dovecot_patched/dovecot-1.0.10/src/plugins/mbox-snarf/mbox-snarf-plugin.h 
./dovecot_compile/dovecot-1.0.10/src/plugins/mbox-snarf/mbox-snarf-plugin.h
+--- dovecot-1.0.10/src/plugins/mbox-snarf/mbox-snarf-plugin.h  1970-01-01 
01:00:00.000000000 +0100
++++ dovecot-1.0.10/src/plugins/mbox-snarf/mbox-snarf-plugin.h  2008-01-23 
22:41:03.000000000 +0100
+@@ -0,0 +1,7 @@
++#ifndef __MBOX_SNARF_PLUGIN_H
++#define __MBOX_SNARF_PLUGIN_H
++
++void mbox_snarf_plugin_init(void);
++void mbox_snarf_plugin_deinit(void);
++
++#endif

Reply via email to