%global commit 	713e9e9ffd4adfcc58c6e12470e87c9fd1b8af44
%global shortcommit %(c=%{commit}; echo ${c:0:7})

Name:           dovecot-antispam
Version:        2.0
Release:        4.20171228git%{shortcommit}%{?dist}
Summary:        The dovecot antispam plugin

Group:          System Environment/Libraries
License:        GPLv2
URL:            http://johannes.sipsolutions.net/Projects/%{name}
Source0:        http://git.sipsolutions.net/?p=%{name}.git;a=snapshot;h=%{shortcommit};sf=tgz#/%{name}-%{shortcommit}.tar.gz

Requires:       dovecot
BuildRequires:  dovecot-devel

%description
The dovecot antispam plugin watches a defined spam folder (defaults to "SPAM").
It works together with a spam system that classifies each message as it is
delivered. When the message is classified as spam, it shall be delivered to the
spam folder, otherwise via the regular filtering file the user may have
(maildrop, sieve, ...). Now the user has everything classified as spam in the
special spam folder, everything else where it should be sorted to.

This is not enough because our spam scanner needs training. We'll occasionally
have false positives and false negatives. Now this is the point where the
dovecot antispam plugin comes into play. Instead of moving mail into special
folders or forwarding them to special mail addresses for retraining, the plugin
offers two actions for the user: 

  1. moving mail out of the SPAM folder and 
  2. moving mail into the SPAM folder. 

The dovecot plugin watches these actions (and additionally prohibits APPENDs to
the SPAM folder, more for technical reasons than others) and tells the spam
classifier that it made an error and needs to re-classify the message (as
spam/not spam depending on which way it was moved.) 

%prep
%setup -qn %{name}-%{shortcommit}

%build
CFLAGS="${CFLAGS:-%optflags}" make %{?_smp_mflags}

%install
install -d %{buildroot}%{_libdir}/dovecot/imap
make %{?_smp_mflags} install DESTDIR=%{buildroot} moduledir=%{_libdir}/dovecot
install -m0644 -p -D antispam.7 %{buildroot}%{_mandir}/man7/antispam.7

%files
%doc NOTES README
%license COPYING
%{_libdir}/dovecot/imap/lib90_antispam_plugin.so
%{_mandir}/man7/antispam.7.gz

%changelog
* Fri Mar 15 2019 Martin Milata <martin@martinmilata.cz> - 2.0-4.20171228git713e9e9
- Bump

* Wed Nov 25 2015 Martin Milata <mmilata@redhat.com> - 2.0-3.20150222git963c046
- Install plugin into /usr/lib64/dovecot

* Sun Nov 15 2015 Martin Milata <mmilata@redhat.com> - 2.0-2.20150222git963c046
- Update to current git snapshot

* Mon Oct 26 2015 Scott K Logan <logans@cottsay.net> - 2.0-1
- Initial package