On 5.3.2012, at 14.35, Jan-Frode Myklebust wrote: > On Mon, Mar 05, 2012 at 12:45:26PM +0200, Timo Sirainen wrote: >>> >>> So, ideally (for us), dovecot should keep a log over which accounts are >>> active (has received or checked mail), and only sync users that has been >>> active for the last $timeperiode on startup. >> >> Well, all of this could be done already, although not very automatically.. >> Whenever a new mail is delivered or user is logged in, the user's last-login >> timestamp in SQL could be updated. And replicator's userdb iterate_query >> could return only users whose last-login timestamp is new enough. The SQL >> userdb could be used only by replicator, everything else could keep using >> LDAP. >> > > .. or we could keep touching /activemailaccounts/$address in post-login > scripts, and run "doveadm sync" for any user updated the last $timeperiode > and avoid the need for SQL-userdatabase. But we still don't have a > last-login update on lmtp delivery... or has this changed?
It would be pretty simple to write such a plugin that globally does it for all imap/pop3/lmtp. Here, works for v2.0 and v2.1: http://dovecot.org/patches/2.1/lastaccess-plugin.c