Add IMAP capabilities instead of overwriting them
I wanted to add COMPRESS=DEFLATE,
but it should be added only for sessions
that are logged in because COMPRESS
command does not work before logging in.
Dovecot already does it correctly if we don't overwrite the capability string.
This is how IMAP session looks like with this change, I don't think this is a significant network overhead compared to TLS hello messages and actual mails:
* OK [CAPABILITY IMAP4rev1 SASL-IR LOGIN-REFERRALS ID ENABLE IDLE XDELTAPUSH XCHATMAIL LITERAL+ AUTH=PLAIN] Dovecot (Debian) ready.
? LOGIN [email protected] ...
? OK [CAPABILITY IMAP4rev1 SASL-IR LOGIN-REFERRALS ID ENABLE IDLE SORT SORT=DISPLAY THREAD=REFERENCES THREAD=REFS THREAD=ORDEREDSUBJECT MULTIAPPEND URL-PARTIAL CATENATE UNSELECT CHILDREN NAMESPACE UIDPLUS LIST-EXTENDED I18NLEVEL=1 CONDSTORE QRESYNC ESEARCH ESORT SEARCHRES WITHIN CONTEXT=SEARCH LIST-STATUS BINARY MOVE SNIPPET=FUZZY PREVIEW=FUZZY PREVIEW STATUS=SIZE SAVEDATE XDELTAPUSH XCHATMAIL LITERAL+ NOTIFY METADATA SPECIAL-USE COMPRESS=DEFLATE QUOTA] Logged in
This also enables ID capability which Delta Chat uses to display server ID in connectivity view when it is available.
I'd prefer if we only list the capabilities we need for a smooth functioning with DC as there is no point sending unused garbage if we control both sides.
The other option is adding COMPRESS=DEFLATE to the list, but this is incorrect because COMPRESS is not actually available before login.
the overhead seems to be roughly 350 bytes -- it's not super-huge i agree, but also i don't see the point of adding ~300 bytes unneccessarily for each imap connection.