Add support for CAPA command
This adds support for asking a POP server about its capabilities (RFC2449).
- Adds Net::POP3Command#capa, which issues the CAPA command and encodes the result as a hash of {tag => params for tag, *params in each_list_item}. Tags and params are both upcased, to simplify case insensitive matching.
- Adds Net::POP3#capabilities, which caches the result from
command.capa. - Adds Net::POP3#capable?, which returns whether #capabilities includes a specific
tagandparam. - Adds Net::POP3#clear_cached_capabilities, which clears the capabilities cache.
- Adds Net::POP3#sasl_capable? and Net::POP3#sasl_mechanisms, which query support of the "SASL" capabability.
Note that the STLS extension modifies the CAPA requirements. If support is added for STLS, the capabilities cache must be reset.
This is needed in order to properly support SASL authentication using the AUTH command (RFC5034).
And a basic SASL implementation should be the basis for supporting OAuth2 (whether via the non-standard XOAUTH2 SASL mechanism or the standard OAUTHBEARER SASL mechanism). Therefore, CAPA is a requirement for proper implementation of OAuth2.
I rebased this and changed it a little. Now it only add the #capa method to POP3Command, and the other methods are implemented directly on POP3.