I was trying to figure out why, using my new Dovecot install, I was not getting UIDPLUS or QRESYNC capabilities. I found out that it was because the capabilities were determined at connection time, and the set of advertised capabilities changes between connection and login. Upon login on Dovecot, an updated set of capabilities may be advertised. I was able to account for that using the included patch. A perhaps-better method might be to re-run CAPABILITY after logging in.