imap: Adjusted SELECT and FETCH state order in imap_statemach_act()

Exchanged the position of these states in the switch statements to
match the state enum, execution and function order.
imap: Adjusted SELECT and FETCH function order

Moved imap_select() and imap_fetch() to be grouped with the other
perform functions.
imap: Removed bytecountp from the per-request structure

Removed this pointer to a downloaded bytes counter because it was set in
imap_init() to point to the same variable the transfer functions keep
the count in (k->bytecount), effectively making the code in transfer.c
"*k->bytecountp = k->bytecount" a no-op.
pop3: Removed bytecountp from the per-request structure

Removed this pointer to a downloaded bytes counter because it was set in
pop3_init() to point to the same variable the transfer functions keep
the count in (k->bytecount), effectively making the code in transfer.c
"*k->bytecountp = k->bytecount" a no-op.
smtp: Removed bytecountp from the per-request structure

Removed this pointer to a downloaded bytes counter because it was set in
smtp_init() to point to the same variable the transfer functions keep
the count in (k->bytecount), effectively making the code in transfer.c
"*k->bytecountp = k->bytecount" a no-op.
email: Small tidy up following recent changes
Remove unused variable in smtp_state_data_resp()
imap: Moved CAPABILITY response handling to imap_state_capability_resp()

Introduced similar handling to the FETCH responses, where even the
untagged data responses are handled by the response handler of the
individual state.
imap: Added a helper function for upcoming untagged response filtering

RFC 3501 states that "the client MUST be prepared to accept any response
at all times" yet we assume anything received with "* " at the beginning
is the untagged response we want.

Introduced a helper function that checks whether the input looks like a
response to specified command, so that we may filter the ones we are
interested in according to the current state.
imap: Added filtering of CAPABILITY and FETCH untagged responses

Only responses that contain "CAPABILITY" and "FETCH", respectively,
will be sent to their response handler.
imap: Corrected whitespace
imap: Corrected comment in imap_endofresp()
imap: Introduced the mailbox_uidvalidity variable

Added the mailbox_uidvalidity variable to the per-connection structure
in preparation for checking the UIDVALIDITY mailbox attribute.
imap: Added support for parsing the UIDVALIDITY property

Added support for parsing the UIDVALIDITY property from the SELECT
response and storing it in the per-connection structure.
imap: Added verification of UIDVALIDITY mailbox attribute

Added support for checking the UIDVALIDITY, and aborting the request, if
it has been specified in the URL and the server response is different.
DOCS: Added the IMAP UIDVALIDITY property to the CURLOPT_URL section
imap: Tidied up comments for connection based variables
email: Slight reordering of connection based variables

Reordered the state and ssl_done variables in order to provide more
consistency between the email protocols as well as for for an upcoming
change.
imap: Introduced the mailbox variable

Added the mailbox variable to the per-connection structure in
preparation for checking for an already selected mailbox.
imap: Added skipping of SELECT command if already in the same mailbox

Added storage and checking of the last mailbox userd to prevent
unnecessary switching.