diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java index 32faaaf6d..e3337a1f4 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java @@ -485,6 +485,8 @@ private void connectAndLogin(SecurityAuthority authority, loadProxy(); Roster.setDefaultSubscriptionMode(Roster.SubscriptionMode.manual); + ConnectState state; + // try connecting with auto-detection if enabled boolean isServerOverriden = getAccountID().getAccountPropertyBoolean( @@ -492,58 +494,11 @@ private void connectAndLogin(SecurityAuthority authority, if(!isServerOverriden) { - // check to see is there SRV records for this server domain - SRVRecord srvRecords[] = null; - try - { - srvRecords = NetworkUtils - .getSRVRecords("xmpp-client", "tcp", serviceName); - } - catch (ParseException e) - { - logger.error("SRV record not resolved", e); - } - - if(srvRecords != null) - { - for(SRVRecord srv : srvRecords) - { - InetSocketAddress[] addrs = null; - try - { - addrs = - NetworkUtils.getAandAAAARecords( - srv.getTarget(), - srv.getPort() - ); - } - catch (ParseException e) - { - logger.error("Invalid SRV record target", e); - } - if (addrs == null) - continue; - - for (InetSocketAddress isa : addrs) - { - try - { - ConnectState state - = connectAndLogin(isa, - password, serviceName); - if(state == ConnectState.ABORT_CONNECTING - || state == ConnectState.STOP_TRYING) - return; - } - catch(XMPPException ex) - { - disconnectAndCleanConnection(); - if(isAuthenticationFailed(ex)) - throw ex; - } - } - } - } + state = connectUsingSRVRecords( + serviceName, password, serviceName); + if(state == ConnectState.ABORT_CONNECTING + || state == ConnectState.STOP_TRYING) + return; } // connect with specified server name @@ -554,6 +509,20 @@ private void connectAndLogin(SecurityAuthority authority, int serverPort = getAccountID().getAccountPropertyInt( ProtocolProviderFactory.SERVER_PORT, 5222); + // check for custom xmpp domain which we will check for + // SRV records for server addresses + String customXMPPDomain = getAccountID() + .getAccountPropertyString("CUSTOM_XMPP_DOMAIN"); + + if(customXMPPDomain != null) + { + state = connectUsingSRVRecords( + customXMPPDomain, password, serviceName); + if(state == ConnectState.ABORT_CONNECTING + || state == ConnectState.STOP_TRYING) + return; + } + InetSocketAddress[] addrs = null; try { @@ -573,9 +542,7 @@ private void connectAndLogin(SecurityAuthority authority, { try { - ConnectState state - = connectAndLogin(isa, - password, serviceName); + state = connectAndLogin(isa, password, serviceName); if(state == ConnectState.ABORT_CONNECTING || state == ConnectState.STOP_TRYING) return; @@ -620,6 +587,70 @@ private void connectAndLogin(SecurityAuthority authority, } } + /** + * Connects using the domain specified and its SRV records. + * @param domain the domain to use + * @param password the password of the user + * @param serviceName the domain name of the user's login + * @return whether to continue trying or stop. + */ + private ConnectState connectUsingSRVRecords( + String domain, + String password, + String serviceName) + throws XMPPException + { + // check to see is there SRV records for this server domain + SRVRecord srvRecords[] = null; + try + { + srvRecords = NetworkUtils + .getSRVRecords("xmpp-client", "tcp", domain); + } + catch (ParseException e) + { + logger.error("SRV record not resolved", e); + } + + if(srvRecords != null) + { + for(SRVRecord srv : srvRecords) + { + InetSocketAddress[] addrs = null; + try + { + addrs = + NetworkUtils.getAandAAAARecords( + srv.getTarget(), + srv.getPort() + ); + } + catch (ParseException e) + { + logger.error("Invalid SRV record target", e); + } + if (addrs == null) + continue; + + for (InetSocketAddress isa : addrs) + { + try + { + return connectAndLogin(isa, password, serviceName); + } + catch(XMPPException ex) + { + disconnectAndCleanConnection(); + if(isAuthenticationFailed(ex)) + throw ex; + } + } + } + } + + return ConnectState.CONTINUE_TRYING; + } + /** * Tries to login to the XMPP server with the supplied user ID. If the * protocol is Google Talk, the user ID including the service name is used. diff --git a/src/net/java/sip/communicator/plugin/defaultresourcepack/DefaultLanguagePackImpl.java b/src/net/java/sip/communicator/plugin/defaultresourcepack/DefaultLanguagePackImpl.java index 3422796c1..5645bc9fa 100644 --- a/src/net/java/sip/communicator/plugin/defaultresourcepack/DefaultLanguagePackImpl.java +++ b/src/net/java/sip/communicator/plugin/defaultresourcepack/DefaultLanguagePackImpl.java @@ -40,20 +40,23 @@ public DefaultLanguagePackImpl() Enumeration fsEnum = DefaultResourcePackActivator.bundleContext.getBundle(). findEntries("/resources/languages", "*.properties", false); - while (fsEnum.hasMoreElements()) + if(fsEnum != null) { - String fileName = ((URL)fsEnum.nextElement()).getFile(); - int localeIndex = fileName.indexOf('_'); - - if(localeIndex != -1) + while (fsEnum.hasMoreElements()) { - String localeId = - fileName.substring( - localeIndex + 1, - fileName.indexOf('.', localeIndex)); - - availableLocales.add( - ResourceManagementServiceUtils.getLocale(localeId)); + String fileName = ((URL)fsEnum.nextElement()).getFile(); + int localeIndex = fileName.indexOf('_'); + + if(localeIndex != -1) + { + String localeId = + fileName.substring( + localeIndex + 1, + fileName.indexOf('.', localeIndex)); + + availableLocales.add( + ResourceManagementServiceUtils.getLocale(localeId)); + } } } } diff --git a/src/net/java/sip/communicator/plugin/provisioning/ProvisioningActivator.java b/src/net/java/sip/communicator/plugin/provisioning/ProvisioningActivator.java index 382f62f6a..6736fa7c9 100644 --- a/src/net/java/sip/communicator/plugin/provisioning/ProvisioningActivator.java +++ b/src/net/java/sip/communicator/plugin/provisioning/ProvisioningActivator.java @@ -437,6 +437,10 @@ private File retrieveConfigurationFile(String url) byte hw[] = getNetworkAddressManagerService(). getHardwareAddress(iface); + + if(hw == null) + continue; + StringBuffer buf = new StringBuffer();