throw new ECFException("already connected");
if (timeout > 0)
SmackConfiguration.setPacketReplyTimeout(timeout);
Roster.setDefaultSubscriptionMode(Roster.SubscriptionMode.manual);
final XMPPID jabberURI = getXMPPID(remote);
String username = jabberURI.getNodename();
String hostname = jabberURI.getHostname();
String hostnameOverride = null;
// Check for the URI form of "joe@bloggs.org;talk.google.com", which
// would at this point would have
// - username = "joe"
// - hostname = "blogs.org;talk.google.com"
// - hostnameOverride = null
//
// We need to turn this into:
// - username = "joe"
// - hostname = "bloggs.org"
// - hostnameOverride = "talk.google.com"
int semiColonIdx = hostname.lastIndexOf(';');
if (semiColonIdx != -1) {
hostnameOverride = hostname.substring(semiColonIdx + 1);
hostname = hostname.substring(0, semiColonIdx);
}
if (google && hostnameOverride == null) {
hostnameOverride = GOOGLE_TALK_HOST;
}
final String serviceName = hostname;
serverPort = jabberURI.getPort();
serverResource = jabberURI.getResourceName();
if (serverResource == null
|| serverResource.equals(XMPPID.PATH_DELIMITER)) {
serverResource = getClientIdentifier();
jabberURI.setResourceName(serverResource);
}
try {
ConnectionConfiguration config;
if (hostnameOverride != null) {
config = new ConnectionConfiguration(hostnameOverride,