Heartbleed - Add autodetection of XMPP hostname

Add the ability to scrape the hostname from the XMPP error message when connecting to an XMPP (Jabber) server.  This allows the connection to get far enough to negotiate a TLS tunnel with STARTTLS.  The manually specified domain, if present, will be used first and then the hostname autodetection will kick in if that fails.
Heartbleed - Add autodetection of XMPP hostname (round 2)

Add the ability to scrape the hostname from the XMPP error message when connecting to an XMPP (Jabber) server. This allows the connection to get far enough to negotiate a TLS tunnel with STARTTLS. The manually specified domain, if present, will be used first and then the hostname autodetection will kick in if that fails.

This version addresses issues that FireFart (Thanks!) brought up about code quality and connection reliability.
Attribution addition

Per comment from Firefart
Whitespace fix

Removing extra line feeds
Additional cleanup

Whitespace cleanup
Code cleanup

Changes requested by wvu-R7
Land #3259, XMPP Hostname autodetect by @TomSellers