Examples of XMPPID


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

      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

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

  }

  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

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

    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

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

    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

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

        });
  }

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

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

    if (i1 instanceof IRosterEntry) {
      IRosterEntry re1 = (IRosterEntry) i1;
      if (!(i2 instanceof IRosterEntry))
        return false;
      IRosterEntry re2 = (IRosterEntry) i2;
      XMPPID id1 = (XMPPID) re1.getUser().getID();
      XMPPID id2 = (XMPPID) re2.getUser().getID();
      String jid1 = id1.getUsernameAtHost();
      String jid2 = id2.getUsernameAtHost();
      if (jid1.equals(jid2)) {
        String r1 = id1.getResourceName();
        String r2 = id2.getResourceName();
        if (r1 == null && r2 != null)
          return true;
      }
    }
    return false;
View Full Code Here

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

  protected String getUserNameFromXMPPAddress(XMPPID userID) {
    return userID.getUsername();
  }

  protected IRosterEntry createRosterEntry(RosterEntry entry) {
    XMPPID xmppid = createIDFromName(entry.getUser());
    return createRosterEntry(xmppid, getEntryName(xmppid, entry.getName()),
        entry.getGroups().iterator());
  }
View Full Code Here

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

          || rosterPacket.getType() == IQ.Type.RESULT) {
        for (final Iterator i = rosterPacket.getRosterItems()
            .iterator(); i.hasNext();) {
          final RosterPacket.Item item = (RosterPacket.Item) i.next();
          final RosterPacket.ItemType itemType = item.getItemType();
          XMPPID newID = createIDFromName(item.getUser());
          boolean remove = false;
          if (itemType == RosterPacket.ItemType.none
              || itemType == RosterPacket.ItemType.remove) {
            removeItemFromRoster(roster.getItems(),
                createIDFromName(item.getUser()));
View Full Code Here

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

  protected void handlePresenceEvent(PresenceEvent evt) {
    final Presence xmppPresence = evt.getPresence();
    final String from = xmppPresence.getFrom();
    final IPresence newPresence = createIPresence(xmppPresence);
    final XMPPID fromID = createIDFromName(from);
    if (newPresence.getType().equals(IPresence.Type.SUBSCRIBE)
        || newPresence.getType().equals(IPresence.Type.UNSUBSCRIBE)
        || newPresence.getType().equals(IPresence.Type.SUBSCRIBED)
        || newPresence.getType().equals(IPresence.Type.UNSUBSCRIBED)) {
      rosterManager.notifySubscriptionListener(fromID, newPresence);
View Full Code Here

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

  }

  protected ID createUserIDFromName(String name) {
    ID result = null;
    try {
      result = new XMPPID(usernamespace, name);
      return result;
    } catch (final Exception e) {
      return null;
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.