Package org.eclipse.ecf.provider.xmpp.identity

Examples of org.eclipse.ecf.provider.xmpp.identity.XMPPID


      adapter = (IRemoteServiceContainerAdapter) container
          .getAdapter(IRemoteServiceContainerAdapter.class);
      assertNotNull(adapter);

      clientID = new XMPPID(container.getConnectNamespace(), username);
      assertNotNull(clientID);

      connectContext = ConnectContextFactory
          .createUsernamePasswordConnectContext(username, password);
      assertNotNull(connectContext);
View Full Code Here


  }

  protected ID createUserIDFromName(String name) {
    ID result = null;
    try {
      result = new XMPPID(connectNamespace, name);
      return result;
    } catch (final Exception e) {
      return null;
    }
  }
View Full Code Here

      // XMPP server returns the same length for both
      while (jids.hasNext() && names.hasNext()) {
        try {
          jid = (String) jids.next();
          name = (String) names.next();
          IUser user = new User(new XMPPID(connectNamespace, jid),
              name);
          result.add(new XMPPResultItem(user));
        } catch (URISyntaxException e) {
          throw new RuntimeException(
              "cannot create connect id for client " + jid //$NON-NLS-1$
View Full Code Here

    }
    return password;
  }

  private XMPPID getXMPPID(ID remote) throws ECFException {
    XMPPID jabberID = null;
    try {
      jabberID = (XMPPID) remote;
    } catch (final ClassCastException e) {
      throw new ECFException(e);
    }
View Full Code Here

      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,
View Full Code Here

      try {
        if (receiver == null)
          throw new IOException(
              "receiver cannot be null for xmpp instant messaging");
        else if (receiver instanceof XMPPID) {
          final XMPPID rcvr = (XMPPID) receiver;
          aMsg.setType(Message.Type.chat);
          final String receiverName = rcvr.getFQName();
          final Chat localChat = connection.getChatManager()
              .createChat(receiverName, new MessageListener() {
                public void processMessage(Chat chat,
                    Message message) {
                }
View Full Code Here

  }

  private void resetTargetResource(ID originalTarget, Object serverData) {
    // Reset resource to that given by server
    if (originalTarget instanceof XMPPID) {
      XMPPID xmppOriginalTarget = (XMPPID) originalTarget;
      if (serverData != null && serverData instanceof String) {
        String jid = (String) serverData;
        String jidResource = trimResourceFromJid(jid);
        if (jidResource != null) {
          xmppOriginalTarget.setResourceName(jidResource);
        }
      }
    }
  }
View Full Code Here

    return new ECFConnection(google, getConnectNamespace(), receiver);
  }

  protected boolean isGoogle(ID remoteSpace) {
    if (remoteSpace instanceof XMPPID) {
      final XMPPID theID = (XMPPID) remoteSpace;
      final String host = theID.getHostname();
      if (host == null)
        return false;
      return googleNames.contains(host.toLowerCase());
    }
    return false;
View Full Code Here

    final IChatManager chatManager = presenceContainerAdapter.getChatManager();
    final IRosterManager rosterManager = presenceContainerAdapter.getRosterManager();
    if (chatManager != null && rosterManager != null) {
      try {
        // get local ID
        final XMPPID localID = (XMPPID) rosterManager.getRoster().getUser().getID();
        final Namespace ns = container.getConnectNamespace();
        // create target ID
        final XMPPID targetID = (isXMPPS) ? new XMPPSID(ns, getURI().getAuthority()) : new XMPPID(ns, getURI().getAuthority());
        // If they are same, just tell user and return
        if (localID.equals(targetID)) {
          MessageDialog.openError(null, Messages.XMPPHyperlink_MESSAGING_ERROR_TITLE, Messages.XMPPHyperlink_MESSAGING_ERROR_MESSAGE);
          return;
        } else {
          final String localHost = localID.getHostname();
          final String targetHost = targetID.getHostname();
          // If the hosts are the same for the target and local
          // accounts,
          // it's pretty obvious that we wish to message to them
          if (localHost.equals(targetHost)) {
            openMessagesView(chatManager, localID, targetID);
          } else {
            // Otherwise, ask the user whether messaging, or
            // connecting is desired
            final MessageDialog messageDialog = new MessageDialog(null, Messages.XMPPHyperlink_SELECT_ACTION_DIALOG_TITLE, null, NLS.bind(Messages.XMPPHyperlink_SELECT_ACTION_DIALOG_MESSAGE, new Object[] {targetHost, localHost, targetID.getName(), localID.getName()}), MessageDialog.QUESTION, new String[] {Messages.XMPPHyperlink_SELECT_ACTION_DIALOG_BUTTON_SEND_MESSAGE, Messages.XMPPHyperlink_SELECT_ACTION_DIALOG_BUTTON_CONNECT, Messages.XMPPHyperlink_SELECT_ACTION_DIALOG_BUTTON_CANCEL}, 2);
            final int selected = messageDialog.open();
            switch (selected) {
              case 0 :
                openMessagesView(chatManager, localID, targetID);
                return;
View Full Code Here

        });
  }

  private XMPPID createIDFromName(String uname) {
    try {
      return new XMPPID(container.getConnectNamespace(), uname);
    } catch (final Exception e) {
      return null;
    }
  }
View Full Code Here

TOP

Related Classes of org.eclipse.ecf.provider.xmpp.identity.XMPPID

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.