Add null checks throughout mailimap_print.

This fixes various opportunities to crash if you try to enable the
mailimap_response_print call in mailimap_parse_response.