Package org.jdesktop.wonderland.modules.presencemanager.common.messages

Examples of org.jdesktop.wonderland.modules.presencemanager.common.messages.ClientConnectResponseMessage


    @Override
    public void handleMessage(Message message) {
        logger.fine("got a message... " + message);

  if (message instanceof ClientConnectResponseMessage) {
      ClientConnectResponseMessage msg = (ClientConnectResponseMessage) message;

      CellCache cellCache = ClientContext.getCellCache(session);

      if (cellCache == null) {
    logger.warning("Can't find cellCache for session " + session);
    return;
      }

      ArrayList<String> nameTagList = new ArrayList();

      PresenceInfo[] presenceInfoList = msg.getPresenceInfoList();

      for (int i = 0; i < presenceInfoList.length; i++) {
    PresenceInfo presenceInfo = presenceInfoList[i];

    logger.fine("Client connected: " + presenceInfo);

    logger.fine("Got ClientConnectResponse:  adding pi " + presenceInfo);
    pm.presenceInfoAdded(presenceInfo);

    String username = presenceInfo.getUserID().getUsername();

    if (presenceInfo.getCellID() == null) {
        logger.warning("CellID is null for " + presenceInfo);
        continue;
    }

    Cell cell = cellCache.getCell(presenceInfo.getCellID());

    if (cell == null) {
        logger.warning("Unable to find cell for " + presenceInfo.getCellID());
        continue;
    }

    NameTagComponent nameTag = cell.getComponent(NameTagComponent.class);

    if (presenceInfo.getUsernameAlias().equals(username) == false) {
         pm.changeUsernameAlias(presenceInfo, presenceInfo.getUsernameAlias());
     }

    if (nameTag == null) {
        continue;
    }

    nameTag.updateLabel(presenceInfo.getUsernameAlias(),
                                    presenceInfo.isInConeOfSilence(),
                                    presenceInfo.isSpeaking(),
                                    presenceInfo.isMuted());
      }

//      if (nameTagList.size() > 0) {
//    new NameTagUpdater(nameTagList);
//      }

            // connection is complete
            setConnectionComplete(true);

      return;
  }

        // Issue #1113: if the connection is not complete, ignore messages
        if (!isConnectionComplete()) {
            return;
        }

        if (message instanceof PlayerInRangeMessage) {
      PlayerInRangeMessage msg = (PlayerInRangeMessage) message;

      PresenceInfo info = pm.getPresenceInfo(msg.getCallID());

      if (info == null) {
    logger.fine("no presence info for callID " + msg.getCallID());
    return;
      }

      pm.playerInRange(info, msg.isInRange());
      return;
  }

        if (message instanceof PresenceInfoAddedMessage) {
            PresenceInfoAddedMessage m = (PresenceInfoAddedMessage) message;
View Full Code Here


        // make sure to broadcase in-range notificaitons to the player
        pm.enableInRangeNotification(clientID.getID(), clientID);

        // Send back all of the PresenceInfo data to the new client
        Collection<PresenceInfo> allInfo = pm.getAllPresenceInfo();
        sender.send(clientID, new ClientConnectResponseMessage(message.getMessageID(),
                    allInfo.toArray(new PresenceInfo[0])));
    }
View Full Code Here

TOP

Related Classes of org.jdesktop.wonderland.modules.presencemanager.common.messages.ClientConnectResponseMessage

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.