Accept conn_failed as valid state on timeouts

When the internet connection is lost, in some cases libpurple can return a file descriptor without any error that is still not writable or readable. In that case, the connection would remain in the state conn_error until the next ping timeout, which has been causing an assertion error until now.
Prevent infinite loop on lost network connection

Increase the timeout exponentially on failed connections to prevent an infinite loop of reconnects.
Add "image" flag to all picture messages
Unescape HTML special chars on outgoing messages