g_imap_connect() should return an error code in case of failure.

Instead of simplying exiting with failure code, return an error code to
the clients indicating that an error happened.

Signed-off-by: Thiago Farina <tfarina@chromium.org>