diff options
-rw-r--r-- | Makefile | 9 | ||||
-rw-r--r-- | README | 14 | ||||
-rw-r--r-- | antispam-plugin.c | 6 | ||||
-rw-r--r-- | defconfig | 3 |
4 files changed, 20 insertions, 12 deletions
@@ -39,19 +39,22 @@ CFLAGS += -fPIC -shared -Wall CC ?= "gcc" objs += antispam-plugin.o $(BACKEND).o -ALL = antispam +ALL = lib90_antispam_plugin.so all: verify_config $(ALL) %.o: %.c .config antispam-plugin.h $(CC) -c $(CFLAGS) -o $@ $< -antispam: $(objs) - $(CC) $(CFLAGS) $(objs) -o $@.so $(LDFLAGS) +%.so: $(objs) + $(CC) $(CFLAGS) $(objs) -o $@ $(LDFLAGS) clean: rm -f *.so *.o *~ +install: all + install -o root -g root -m 0660 lib90_antispam_plugin.so $(INSTALLDIR)/ + verify_config: @if [ ! -r .config ]; then \ echo -e "\nBuilding the plugin requires a configuration file"; \ @@ -32,12 +32,14 @@ INSTALLATION First copy the 'defconfig' file to '.config' and edit it as necessary. You need to have the dovecot headers installed and possibly other things - depending on the backend you choose. Then simply run 'make'. - - Copy the plugin antispam.so to your dovecot imap plugin directory. - Depending on your installation it could be /usr/lib/dovecot/modules/imap/ - or wherever you have it configured (look for the mail_plugin_dir - configuration directive.) + depending on the backend you choose. Then, assuming you have configured + the INSTALLDIR correctly, simply run 'make install'. + + If you do not wish to use the install target, simply copy the plugin + (that is, the file lib90_antispam_plugin.so) to your dovecot imap plugin + directory; by default this is /usr/lib/dovecot/modules/imap/ or any dir + you have configured (look for the mail_plugin_dir configuration + directive.) Open your dovecot configuration file (usually /etc/dovecot/dovecot.conf) and add the antispam plugin to the imap protocol section: diff --git a/antispam-plugin.c b/antispam-plugin.c index 993c8c1..9a84c07 100644 --- a/antispam-plugin.c +++ b/antispam-plugin.c @@ -72,7 +72,7 @@ bool mailbox_is_trash(struct mailbox *box) return mailbox_in_list(box, trash_folders); } -void antispam_init(void) +void antispam_plugin_init(void) { char *tmp, **iter; @@ -112,7 +112,7 @@ void antispam_init(void) hook_mail_storage_created = antispam_mail_storage_created; } -void antispam_deinit(void) +void antispam_plugin_deinit(void) { hook_mail_storage_created = antispam_next_hook_mail_storage_created; backend_exit(); @@ -120,4 +120,4 @@ void antispam_deinit(void) } /* put dovecot version we built against into plugin for checking */ -const char *antispam_version = PACKAGE_VERSION; +const char *antispam_plugin_version = PACKAGE_VERSION; @@ -28,6 +28,9 @@ DOVECOT_VERSION=1.0 BACKEND=dspam-exec +# install directory for 'make install' +INSTALLDIR=/usr/lib/dovecot/modules/imap/ + # enable debugging to syslog or stderr #DEBUG=stderr #DEBUG=syslog |