The IMAP4 specification is quite clear on this.
The text after "* OK" in the greeting is freeform (other than any
<resp_text_code> elements). The appearance of "IMAP4" or "IMAP4rev1"
there is meaningless when determining which version of IMAP4 is
supported.
You discover the level of IMAP4 the server supports by issing a
CAPABILITY request. If the CAPABILITY list includes "IMAP4rev1"
the server supports the protocol defined in RFC2060. If the CAPABILITY
list includes "IMAP4" the server supports the protocol defined in
RFC1730. If the CAPABILITY response includes both "IMAP4" and
"IMAP4rev1" the server supports the protocol defined in both
documents (with RFC2060 behaviour overriding RFC1730 where there
are conflicts).
--lyndon