コード例 #1
0
 public Set<String> resolveParticipantIds(String anyID) {
   Set<String> idSet = new HashSet<String>();
   for (Participant p : resolveParticipants(anyID)) {
     idSet.add(p.getID());
   }
   return idSet;
 }
コード例 #2
0
 public String resolveParticipantIdsAsXML(String anyID) {
   XNode node = new XNode("participantids");
   for (Participant p : resolveParticipants(anyID)) {
     node.addChild("id", p.getID());
   }
   return node.toString();
 }
コード例 #3
0
 public Set<Participant> getOrgGroupMembers(OrgGroup o) {
   Set<Participant> result = new HashSet<Participant>();
   for (Participant p : participantMap.values()) {
     if (p.isOrgGroupMember(o)) result.add(p);
   }
   return result;
 }
コード例 #4
0
  public String getParticipantsAsXML() {
    List<Participant> pList = sortFullParticipantListByName();

    StringBuilder xml = new StringBuilder("<participants>");
    for (Participant p : pList) xml.append(p.toXML());
    xml.append("</participants>");
    return xml.toString();
  }
コード例 #5
0
 public Participant getParticipantFromUserID(String userID) {
   for (Participant p : getParticipants()) {
     if (p.getUserID().equals(userID)) {
       return p;
     }
   }
   return null;
 }
コード例 #6
0
 // @return a csv listing of the full name of each participant
 public String getParticipantNames() {
   List<Participant> pList = sortFullParticipantListByName();
   StringBuilder csvList = new StringBuilder();
   for (Participant p : pList) {
     if (csvList.length() > 0) csvList.append(",");
     csvList.append(p.getFullName());
   }
   return csvList.toString();
 }
コード例 #7
0
  private synchronized void disconnectResources(AbstractResourceAttribute attrib) {
    Set<AbstractResource> resources = attrib.getResources();

    // get ids to avoid ConcurrentModificationException
    List<String> ids = new ArrayList<String>();
    for (AbstractResource resource : resources) ids.add(resource.getID());

    for (String id : ids) {
      Participant p = getParticipant(id);
      if (attrib instanceof Role) p.removeRole((Role) attrib);
      else if (attrib instanceof Capability) p.removeCapability((Capability) attrib);
      else if (attrib instanceof Position) p.removePosition((Position) attrib);
      updateParticipant(p);
    }
  }
コード例 #8
0
 /** ********************************* */
 public String addParticipant(Participant p) {
   if (isDataEditable(ResUnit.Participant)) {
     String newID = getDataSource(ResUnit.Participant).insert(p);
     if (!hasDefaultDataSource(ResUnit.Participant)) p.setID(newID);
     putParticipant(p); // add it to the data set
     return newID;
   } else return fail("External Participant dataset is read-only");
 }
コード例 #9
0
 /** ********************************* */
 public synchronized boolean removeParticipant(Participant p) {
   boolean editable = isDataEditable(ResUnit.Participant);
   if (editable) {
     p.removeAttributeReferences();
     getDataSource(ResUnit.Participant).delete(p);
     delParticipant(p);
   }
   return editable;
 }
コード例 #10
0
  /** Handles XEP-0337 "log" extensions. */
  private void handleLogRequest(LogPacketExtension log, String jid) {
    JitsiMeetConference conference = getConferenceForMucJid(jid);

    if (conference == null) {
      logger.debug("Room not found for JID: " + jid);
      return;
    }

    Participant participant = conference.findParticipantForRoomJid(jid);

    if (participant == null) {
      logger.info("Ignoring log request from an unknown JID: " + jid);
      return;
    }

    EventAdmin eventAdmin = FocusBundleActivator.getEventAdmin();

    if (eventAdmin == null) return;

    if (LogUtil.LOG_ID_PC_STATS.equals(log.getID())) {
      String content = LogUtil.getContent(log);

      if (content != null) {
        ColibriConference colibriConference = conference.getColibriConference();

        if (colibriConference != null) {
          Event event =
              EventFactory.peerConnectionStats(
                  colibriConference.getConferenceId(), participant.getEndpointId(), content);

          if (event != null) eventAdmin.sendEvent(event);
        } else {
          logger.warn("Unhandled log request" + " - no valid Colibri conference");
        }
      }
    } else if (logger.isInfoEnabled()) {
      logger.info("Ignoring log request with an unknown ID:" + log.getID());
    }
  }
コード例 #11
0
 /**
  * Gets the immediate supervisor of a participant. If the participant holds multiple positions,
  * and therefore has multiple supervisors, one is returned as a random selection.
  *
  * @param p the participant to get the supervisor of
  * @return the Participant who is the supervisor of the pid passed, or null if there is no
  *     supervisor.
  */
 public Participant getImmediateSupervisor(Participant p) {
   if (p != null) {
     for (Position position : p.getPositions()) {
       Position superPosition = position.getReportsTo();
       if (superPosition != null) {
         Set<AbstractResource> resources = superPosition.getResources();
         if (!resources.isEmpty()) {
           return (Participant) resources.iterator().next();
         }
       }
     }
   }
   return null;
 }
コード例 #12
0
 public Map<String, String> getParticipantIdentifiers(Identifier idType) {
   Map<String, String> idMap = new Hashtable<String, String>();
   for (Participant p : getParticipants()) {
     String nameValue;
     switch (idType) {
       case FullName:
         nameValue = p.getFullName();
         break;
       case ReverseFullName:
         nameValue = p.getLastName() + ", " + p.getFirstName();
         break;
       case LastName:
         nameValue = p.getLastName();
         break;
       default:
         nameValue = p.getUserID();
     }
     idMap.put(p.getID(), nameValue);
   }
   return idMap;
 }
コード例 #13
0
 /** ********************************* */
 public void delParticipant(Participant p) {
   participantMap.remove(p.getID());
   setChangeStamp(ResUnit.Participant);
 }
コード例 #14
0
 /** ********************************* */
 public void putParticipant(Participant p) {
   participantMap.put(p.getID(), p);
   setChangeStamp(ResUnit.Participant);
 }
コード例 #15
0
 public void rollback() {
   for (Participant participant : participants) {
     participant.rollback();
   }
 }
コード例 #16
0
 public Set<Capability> getParticipantCapabilities(String pid) {
   Participant p = participantMap.get(pid);
   return (p != null) ? p.getCapabilities() : null;
 }
コード例 #17
0
 public Set<Position> getParticipantPositions(String pid) {
   Participant p = participantMap.get(pid);
   return (p != null) ? p.getPositions() : null;
 }
コード例 #18
0
 public Set<Role> getParticipantRoles(String pid) {
   Participant p = participantMap.get(pid);
   return (p != null) ? p.getRoles() : null;
 }
コード例 #19
0
 public boolean isKnownParticipant(Participant p) {
   return isKnownParticipant(p.getID());
 }
コード例 #20
0
 private String participantSetToXML(Set<Participant> pSet, String header) {
   StringBuilder xml = new StringBuilder(header);
   for (Participant p : pSet) xml.append(p.toXML());
   xml.append("</participants>");
   return xml.toString();
 }
コード例 #21
0
  /**
   * Handles presence stanzas
   *
   * @param presence
   */
  private void handlePresence(Presence presence) {
    // unavailable is sent when user leaves the room
    if (!presence.isAvailable()) {
      return;
    }

    String from = presence.getFrom();
    JitsiMeetConference conference = getConferenceForMucJid(from);

    if (conference == null) {
      if (logger.isDebugEnabled()) {
        logger.debug("Room not found for JID: " + from);
      }
      return;
    }

    ChatRoomMemberRole role = conference.getRoleForMucJid(from);

    if (role != null && role.compareTo(ChatRoomMemberRole.MODERATOR) < 0) {
      StartMutedPacketExtension ext =
          (StartMutedPacketExtension)
              presence.getExtension(
                  StartMutedPacketExtension.ELEMENT_NAME, StartMutedPacketExtension.NAMESPACE);

      if (ext != null) {
        boolean[] startMuted = {ext.getAudioMuted(), ext.getVideoMuted()};

        conference.setStartMuted(startMuted);
      }
    }

    Participant participant = conference.findParticipantForRoomJid(from);
    ColibriConference colibriConference = conference.getColibriConference();

    if (participant != null && colibriConference != null) {
      // Check if this conference is valid
      String conferenceId = colibriConference.getConferenceId();
      if (StringUtils.isNullOrEmpty(conferenceId)) {
        logger.error("Unable to send DisplayNameChanged event" + " - no conference id");
        return;
      }

      // Check for changes to the display name
      String oldDisplayName = participant.getDisplayName();
      String newDisplayName = null;
      for (PacketExtension pe : presence.getExtensions()) {
        if (pe instanceof Nick) {
          newDisplayName = ((Nick) pe).getName();
          break;
        }
      }

      if (!Objects.equals(oldDisplayName, newDisplayName)) {
        participant.setDisplayName(newDisplayName);

        EventAdmin eventAdmin = FocusBundleActivator.getEventAdmin();
        if (eventAdmin != null) {
          // Prevent NPE when adding to event hashtable
          if (newDisplayName == null) {
            newDisplayName = "";
          }
          eventAdmin.sendEvent(
              EventFactory.endpointDisplayNameChanged(
                  conferenceId, participant.getEndpointId(), newDisplayName));
        }
      }
    }
  }
コード例 #22
0
  public void commit() {

    for (Participant participant : participants) {
      participant.commit();
    }
  }