Changes to work with 2.2.5.

I couldn't get the current version to build with Dovecot 2.2.5 so I've had a poke around the header and made some changes.  I have tested these in my (single user) environment and they seem to working as expected.  I'm pretty sure they are not backwards compatible so a more complete version may need some #ifdefs which check the Dovecot version.