diff options
author | slewis | 2008-09-08 23:11:31 +0000 |
---|---|---|
committer | slewis | 2008-09-08 23:11:31 +0000 |
commit | d4df9f9f0d5b1242aad46b17f9159b940dfb3e1d (patch) | |
tree | d9b491df3f93aa0618e84ea0a8496f364b50066b /providers/bundles | |
parent | 2e3f15edc111d24708aa49399516a2ce8e6823eb (diff) | |
download | org.eclipse.ecf-d4df9f9f0d5b1242aad46b17f9159b940dfb3e1d.tar.gz org.eclipse.ecf-d4df9f9f0d5b1242aad46b17f9159b940dfb3e1d.tar.xz org.eclipse.ecf-d4df9f9f0d5b1242aad46b17f9159b940dfb3e1d.zip |
Fixes for bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=246155
Diffstat (limited to 'providers/bundles')
3 files changed, 27 insertions, 11 deletions
diff --git a/providers/bundles/org.eclipse.ecf.provider.xmpp/META-INF/MANIFEST.MF b/providers/bundles/org.eclipse.ecf.provider.xmpp/META-INF/MANIFEST.MF index 60b433f8c..bfad57c30 100644 --- a/providers/bundles/org.eclipse.ecf.provider.xmpp/META-INF/MANIFEST.MF +++ b/providers/bundles/org.eclipse.ecf.provider.xmpp/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.ecf.provider.xmpp;singleton:=true -Bundle-Version: 2.0.0.qualifier +Bundle-Version: 2.0.100.qualifier Bundle-Activator: org.eclipse.ecf.internal.provider.xmpp.XmppPlugin Bundle-Vendor: %providerName Bundle-Localization: plugin diff --git a/providers/bundles/org.eclipse.ecf.provider.xmpp/src/org/eclipse/ecf/internal/provider/xmpp/smack/ECFConnection.java b/providers/bundles/org.eclipse.ecf.provider.xmpp/src/org/eclipse/ecf/internal/provider/xmpp/smack/ECFConnection.java index e55ecde8d..08a951e45 100644 --- a/providers/bundles/org.eclipse.ecf.provider.xmpp/src/org/eclipse/ecf/internal/provider/xmpp/smack/ECFConnection.java +++ b/providers/bundles/org.eclipse.ecf.provider.xmpp/src/org/eclipse/ecf/internal/provider/xmpp/smack/ECFConnection.java @@ -47,8 +47,8 @@ public class ECFConnection implements ISynchAsynchConnection { * */ private static final String GOOGLE_TALK_HOST = "talk.google.com"; - public static final String CLIENT_TYPE = "ECF_XMPP"; - public static final boolean DEBUG = Boolean.getBoolean(System.getProperty("smack.debug", "false")); + public static final String CLIENT_TYPE = "ecf."; + public static final boolean DEBUG = Boolean.getBoolean("smack.debug"); protected static final String STRING_ENCODING = "UTF-8"; public static final String OBJECT_PROPERTY_NAME = ECFConnection.class.getName() + ".object"; @@ -60,6 +60,7 @@ public class ECFConnection implements ISynchAsynchConnection { private boolean isStarted = false; private String serverName; private int serverPort = -1; + private String serverResource; private final Map properties = null; private boolean isConnected = false; private Namespace namespace = null; @@ -115,6 +116,8 @@ public class ECFConnection implements ISynchAsynchConnection { this.namespace = ns; this.google = google; this.secure = secure; + if (DEBUG) + XMPPConnection.DEBUG_ENABLED = true; } public ECFConnection(boolean google, Namespace ns, IAsynchEventHandler h) { @@ -152,6 +155,11 @@ public class ECFConnection implements ISynchAsynchConnection { final String username = jabberURI.getUsername(); serverName = jabberURI.getHostname(); serverPort = jabberURI.getPort(); + serverResource = jabberURI.getResourceName(); + if (serverResource == null || serverResource.equals(XMPPID.PATH_DELIMITER)) { + serverResource = getClientIdentifier(); + jabberURI.setResourceName(serverResource); + } try { if (google) { if (secure) { @@ -181,7 +189,7 @@ public class ECFConnection implements ISynchAsynchConnection { connection.addPacketListener(packetListener, null); connection.addConnectionListener(connectionListener); // Login - connection.login(username, (String) data, CLIENT_TYPE); + connection.login(username, (String) data, serverResource); isConnected = true; } catch (final XMPPException e) { if (e.getMessage().equals("(401)")) @@ -191,6 +199,10 @@ public class ECFConnection implements ISynchAsynchConnection { return null; } + private String getClientIdentifier() { + return CLIENT_TYPE + handler.getEventHandlerID().getName(); + } + public void sendPacket(Packet packet) throws XMPPException { if (connection != null) connection.sendPacket(packet); diff --git a/providers/bundles/org.eclipse.ecf.provider.xmpp/src/org/eclipse/ecf/provider/xmpp/identity/XMPPID.java b/providers/bundles/org.eclipse.ecf.provider.xmpp/src/org/eclipse/ecf/provider/xmpp/identity/XMPPID.java index deb1e6917..d11c0dde5 100644 --- a/providers/bundles/org.eclipse.ecf.provider.xmpp/src/org/eclipse/ecf/provider/xmpp/identity/XMPPID.java +++ b/providers/bundles/org.eclipse.ecf.provider.xmpp/src/org/eclipse/ecf/provider/xmpp/identity/XMPPID.java @@ -16,20 +16,20 @@ import java.net.URISyntaxException; import org.eclipse.ecf.core.identity.BaseID; import org.eclipse.ecf.core.identity.Namespace; import org.eclipse.ecf.internal.provider.xmpp.Messages; -import org.eclipse.ecf.internal.provider.xmpp.smack.ECFConnection; +import org.eclipse.ecf.presence.IFQID; import org.eclipse.ecf.presence.im.IChatID; -public class XMPPID extends BaseID implements IChatID { +public class XMPPID extends BaseID implements IChatID, IFQID { private static final long serialVersionUID = 3257289140701049140L; public static final char USER_HOST_DELIMITER = '@'; public static final char PORT_DELIMITER = ':'; - public static final char PATH_DELIMITER = '/'; + public static final String PATH_DELIMITER = "/"; URI uri; String username; String hostname; - String resourcename = ECFConnection.CLIENT_TYPE; + String resourcename; int port = -1; protected static String fixEscape(String src) { @@ -69,7 +69,7 @@ public class XMPPID extends BaseID implements IChatID { hostname = remainder.substring(0, atIndex); resourcename = PATH_DELIMITER + remainder.substring(atIndex + 1); } else { - resourcename = PATH_DELIMITER + ECFConnection.CLIENT_TYPE; + resourcename = PATH_DELIMITER + ""; } if (hostname == null) hostname = remainder; @@ -115,16 +115,20 @@ public class XMPPID extends BaseID implements IChatID { return resourcename; } + public void setResourceName(String resourceName) { + this.resourcename = resourceName; + } + public int getPort() { return port; } public String getUsernameAtHost() { - return getUsername() + USER_HOST_DELIMITER + getHostname(); + return getUsername() + USER_HOST_DELIMITER + getHostname() + ((getPort() == -1) ? "" : ":" + getPort()); } public String getFQName() { - return getUsernameAtHost() + ((getPort() == -1) ? "" : ":" + getPort()) + getResourceName(); + return getUsernameAtHost() + getResourceName(); } public String toString() { |