Package org.apache.openmeetings.db.entity.room

Examples of org.apache.openmeetings.db.entity.room.Client


      String swfURL = "";
      if (conn.getConnectParams().get("swfUrl") != null) {
        swfURL = conn.getConnectParams().get("swfUrl").toString();
      }

      Client rcm = this.sessionManager.addClientListItem(streamId,
          conn.getScope().getName(), conn.getRemotePort(),
          conn.getRemoteAddress(), swfURL, isAVClient, null);
     
      SessionVariablesUtil.initClient(conn.getClient(), isAVClient, rcm.getPublicSID());

      // Log the User
      conferenceLogDao.addConferenceLog("ClientConnect",
          rcm.getUser_id(), streamId, null, rcm.getUserip(),
          rcm.getScope(), rcm.getExternalUserId(),
          rcm.getExternalUserType(), rcm.getMail(),
          rcm.getFirstname(), rcm.getLastname());
    } catch (Exception err) {
      log.error("roomJoin", err);
    }
    return true;
  }
View Full Code Here


  //FIXME copy/past need to be removed
  @SuppressWarnings("unchecked")
  public int sendMessageWithClientByPublicSID(Object newMessage, String publicSID) {
    try {
      IConnection current = Red5.getConnectionLocal();
      Client currentClient = this.sessionManager.getClientByStreamId(current.getClient().getId(), null);
      Long room_id = currentClient.getRoom_id();
      Long user_level = userManager.getUserLevelByID(currentClient.getUser_id());
      Room room = roomManager.getRoomById(user_level, room_id);
      log.debug("room_id: " + room_id);

      @SuppressWarnings("rawtypes")
      ArrayList messageMap = (ArrayList) newMessage;
      // adding delimiter space, cause otherwise an emoticon in the last
      // string would not be found
      String messageText = messageMap.get(4).toString() + " ";
      // add server time
      messageMap.set(1, parseDateAsTimeString());
      LinkedList<String[]> parsedStringObjects = ChatString.parseChatString(messageText, emoticonsManager.getEmotfilesList(), room.getAllowFontStyles());
      // log.error("parsedStringObjects"+parsedStringObjects.size());
      log.debug("size:" + messageMap.size());
      messageMap.add(parsedStringObjects);
      newMessage = messageMap;

      HashMap<String, Object> hsm = new HashMap<String, Object>();
      hsm.put("client", currentClient);
      hsm.put("message", newMessage);

      // broadcast to everybody in the room/domain
      for (Set<IConnection> conset : current.getScope().getConnections()) {
      for (IConnection conn : conset) {
        if (conn != null) {
          if (conn instanceof IServiceCapableConnection) {
            IClient client = conn.getClient();
            if (SessionVariablesUtil.isScreenClient(client)) {
              // screen sharing clients do not receive events
              continue;
            } else if (SessionVariablesUtil.isAVClient(client)) {
              // AVClients or potential AVClients do not receive events
              continue;
            }

            if (SessionVariablesUtil.getPublicSID(client).equals(publicSID)
                || SessionVariablesUtil.getPublicSID(client).equals(
                    currentClient.getPublicSID())) {
              ((IServiceCapableConnection) conn).invoke(
                "sendVarsToMessageWithClient",
                  new Object[] { hsm }, this);
            }
          }
View Full Code Here

  public synchronized Map<String, String> screenSharerAction(Map<String, Object> map) {
    try {
      log.debug("-----------  screenSharerAction");
      IConnection current = Red5.getConnectionLocal();

      Client rc = sessionManager.getClientByStreamId(current.getClient().getId(), null);

      Map<String, String> returnMap = new HashMap<String, String>();

      if (rc != null) {
        boolean changed = false;
        if (Boolean.valueOf("" + map.get("stopStreaming")) && rc.isStartStreaming()) {
          changed = true;
          rc.setStartStreaming(false);
          //Send message to all users
          syncMessageToCurrentScope("stopScreenSharingMessage", rc, false);
         
          returnMap.put("result", "stopSharingOnly");
        }
        if (Boolean.valueOf("" + map.get("stopRecording")) && rc.getIsRecording()) {
          changed = true;
          rc.setStartRecording(false);
          rc.setIsRecording(false);
         
          returnMap.put("result", "stopRecordingOnly");
          //Send message to all users
          syncMessageToCurrentScope("stopRecordingMessage", rc, false);

          flvRecorderService.stopRecordAndSave(current.getScope(), rc, null);
        }
        if (Boolean.valueOf("" + map.get("stopPublishing")) && rc.isScreenPublishStarted()) {
          changed = true;
          rc.setScreenPublishStarted(false);
          returnMap.put("result", "stopPublishingOnly");
         
          //Send message to all users
          syncMessageToCurrentScope("stopPublishingMessage", rc, false);
        }
       
        if (changed) {
          sessionManager.updateClientByStreamId(rc.getStreamid(), rc, false, null);
         
          if (!rc.isStartStreaming() && !rc.isStartRecording() && !rc.isStreamPublishStarted()) {
            returnMap.put("result", "stopAll");
          }
        }
      }
      return returnMap;
View Full Code Here

  }

  public List<HashMap<String,Object>> clearChat() {
    try {
      IConnection current = Red5.getConnectionLocal();
      Client currentClient = this.sessionManager.getClientByStreamId(current.getClient().getId(), null);
      Long room_id = currentClient.getRoom_id();
     
      Long chatroom = room_id;
      log.debug("### GET CHATROOM: "+chatroom);
     
      List<HashMap<String,Object>> myChatList = myChats.get(chatroom);
View Full Code Here

  }
 
  public List<HashMap<String,Object>> getRoomChatHistory() {
    try {
      IConnection current = Red5.getConnectionLocal();
      Client currentClient = this.sessionManager.getClientByStreamId(current.getClient().getId(), null);
      Long room_id = currentClient.getRoom_id();
     
      log.debug("GET CHATROOM: " + room_id);
     
      List<HashMap<String,Object>> myChatList = myChats.get(room_id);
      if (myChatList==null) myChatList = new LinkedList<HashMap<String,Object>>();
     
      if (Boolean.TRUE != currentClient.getIsMod() && Boolean.TRUE != currentClient.getIsSuperModerator()) {
        //current user is not moderator, chat history need to be filtered
        List<HashMap<String,Object>> tmpChatList = new LinkedList<HashMap<String,Object>>(myChatList);
        for (int i = tmpChatList.size() - 1; i > -1; --i) {
          @SuppressWarnings("rawtypes")
          List msgList = (List)tmpChatList.get(i).get("message");
View Full Code Here

      log.debug("checkScreenSharing -2- " + streamid);

      List<Client> screenSharerList = new LinkedList<Client>();

      Client currentClient = this.sessionManager
          .getClientByStreamId(streamid, null);

      for (Client rcl : sessionManager.getClientListByRoomAll(currentClient.getRoom_id())) {
        if (rcl.isStartStreaming()) {
          screenSharerList.add(rcl);
        }
      }
View Full Code Here

  public synchronized Map setConnectionAsSharingClient(Map map) {
    try {
      log.debug("-----------  setConnectionAsSharingClient");
      IConnection current = Red5.getConnectionLocal();

      Client currentClient = sessionManager.getClientByStreamId(current.getClient().getId(), null);

      if (currentClient != null) {
        boolean startRecording = Boolean.valueOf("" + map.get("startRecording"));
        boolean startStreaming = Boolean.valueOf("" + map.get("startStreaming"));
        boolean startPublishing = Boolean.valueOf("" + map.get("startPublishing"))
          && (0 == sessionManager.getPublishingCount(currentClient.getRoom_id()));

        currentClient.setRoom_id(Long.parseLong(current.getScope().getName()));

        // Set this connection to be a RTMP-Java Client
        currentClient.setIsScreenClient(true);
       
        SessionVariablesUtil.setIsScreenClient(current.getClient());
       
        currentClient.setUser_id(Long.parseLong(map.get("user_id").toString()));
        SessionVariablesUtil.setUserId(current.getClient(), Long.parseLong(map.get("user_id").toString()));

        boolean alreadyStreaming = currentClient.isStartStreaming();
        if (startStreaming) {
          currentClient.setStartStreaming(true);
        }
        boolean alreadyRecording = currentClient.isStartRecording();
        if (startRecording) {
          currentClient.setStartRecording(true);
        }
        if (startPublishing) {
          currentClient.setStreamPublishStarted(true);
        }

        currentClient.setOrganization_id(Long.parseLong(map.get("organization_id").toString()));

        sessionManager.updateClientByStreamId(current.getClient().getId(), currentClient, false, null);

        Map returnMap = new HashMap();
        returnMap.put("alreadyPublished", false);

        // if is already started screen sharing, then there is no need
        // to start it again
        if (currentClient.isScreenPublishStarted()) {
          returnMap.put("alreadyPublished", true);
        }

        currentClient.setVX(Integer.parseInt(map.get("screenX").toString()));
        currentClient.setVY(Integer.parseInt(map.get("screenY").toString()));
        currentClient.setVWidth(Integer.parseInt(map.get("screenWidth").toString()));
        currentClient.setVHeight(Integer.parseInt(map.get("screenHeight").toString()));

        log.debug("screen x,y,width,height " + currentClient.getVX()
            + " " + currentClient.getVY() + " "
            + currentClient.getVWidth() + " "
            + currentClient.getVHeight());

        log.debug("publishName :: " + map.get("publishName"));

        currentClient.setStreamPublishName(map.get("publishName").toString());

        Client currentScreenUser = sessionManager.getClientByPublicSID(currentClient.getStreamPublishName(), false, null);

        currentClient.setFirstname(currentScreenUser.getFirstname());
        currentClient.setLastname(currentScreenUser.getLastname());

        // This is duplicated, but its not sure that in the meantime
        // somebody requests this Client Object Info
        sessionManager.updateClientByStreamId(current.getClient().getId(), currentClient, false, null);
View Full Code Here

        IConnection current = Red5.getConnectionLocal();
        String streamid = current.getClient().getId();
        for (Set<IConnection> conset : current.getScope().getConnections()) {
        for (IConnection conn : conset) {
            if (conn != null) {
                Client rcl = this.sessionManager
                        .getClientByStreamId(conn
                                .getClient().getId(), null);
                if (rcl == null) {
                    // continue;
                } else if (rcl.getIsScreenClient() != null
                        && rcl.getIsScreenClient()) {
                    // continue;
                } else {
                    if (!streamid.equals(rcl.getStreamid())) {
                        // It is not needed to send back
                        // that event to the actuall
                        // Moderator
                        // as it will be already triggered
                        // in the result of this Function
                        // in the Client
                      Long id = Long.valueOf(rcl.getBroadCastID());
                      if (id != null && !broadcastList.contains(id)) {
                        broadcastList.add(id.intValue());
                      }
                    }
                }
View Full Code Here

   * @return publicSID of current client
   */
  public synchronized String getPublicSID() {
    log.debug("-----------  getPublicSID");
    IConnection current = Red5.getConnectionLocal();
    Client currentClient = this.sessionManager
        .getClientByStreamId(current.getClient().getId(), null);
    sessionManager.updateClientByStreamId(current.getClient().getId(),
        currentClient, false, null);
    return currentClient.getPublicSID();
  }
View Full Code Here

  public synchronized Boolean overwritePublicSID(String newPublicSID) {
    try {
      log.debug("-----------  overwritePublicSID");
      IConnection current = Red5.getConnectionLocal();
      IClient c = current.getClient();
      Client currentClient = sessionManager.getClientByStreamId(c.getId(), null);
      if (currentClient == null) {
        return false;
      }
      SessionVariablesUtil.initClient(c, SessionVariablesUtil.isAVClient(c), newPublicSID);
      currentClient.setPublicSID(newPublicSID);
      sessionManager.updateClientByStreamId(c.getId(), currentClient, false, null);
      return true;
    } catch (Exception err) {
      log.error("[overwritePublicSID]", err);
    }
View Full Code Here

TOP

Related Classes of org.apache.openmeetings.db.entity.room.Client

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.