private void handleMuteIq(MuteIq muteIq) { Boolean doMute = muteIq.getMute(); String jid = muteIq.getJid(); if (doMute == null || StringUtils.isNullOrEmpty(jid)) return; String from = muteIq.getFrom(); JitsiMeetConference conference = getConferenceForMucJid(from); if (conference == null) { logger.debug("Mute error: room not found for JID: " + from); return; } IQ result; if (conference.handleMuteRequest(muteIq.getFrom(), jid, doMute)) { result = IQ.createResultIQ(muteIq); if (!muteIq.getFrom().equals(jid)) { MuteIq muteStatusUpdate = new MuteIq(); muteStatusUpdate.setType(IQ.Type.SET); muteStatusUpdate.setTo(jid); muteStatusUpdate.setMute(doMute); smackXmpp.getXmppConnection().sendPacket(muteStatusUpdate); } } else { result = IQ.createErrorResponse(muteIq, new XMPPError(XMPPError.Condition.interna_server_error)); } smackXmpp.getXmppConnection().sendPacket(result); }
private void handleRayoIQ(RayoIqProvider.DialIq dialIq) { String from = dialIq.getFrom(); JitsiMeetConference conference = getConferenceForMucJid(from); if (conference == null) { logger.debug("Mute error: room not found for JID: " + from); return; } ChatRoomMemberRole role = conference.getRoleForMucJid(from); if (role == null) { // Only room members are allowed to send requests IQ error = createErrorResponse(dialIq, new XMPPError(XMPPError.Condition.forbidden)); smackXmpp.getXmppConnection().sendPacket(error); return; } if (ChatRoomMemberRole.MODERATOR.compareTo(role) < 0) { // Moderator permission is required IQ error = createErrorResponse(dialIq, new XMPPError(XMPPError.Condition.not_allowed)); smackXmpp.getXmppConnection().sendPacket(error); return; } // Check if Jigasi is available String jigasiJid = conference.getServices().getSipGateway(); if (StringUtils.isNullOrEmpty(jigasiJid)) { // Not available IQ error = createErrorResponse(dialIq, new XMPPError(XMPPError.Condition.service_unavailable)); smackXmpp.getXmppConnection().sendPacket(error); return; } // Redirect original request to Jigasi component String originalPacketId = dialIq.getPacketID(); dialIq.setFrom(null); dialIq.setTo(jigasiJid); dialIq.setPacketID(IQ.nextID()); IQ reply = (IQ) smackXmpp.getXmppConnection().sendPacketAndGetReply(dialIq); // Send Jigasi response back to the client reply.setFrom(null); reply.setTo(from); reply.setPacketID(originalPacketId); smackXmpp.getXmppConnection().sendPacket(reply); }
/** * Creates query for the given <tt>searchString</tt>. * * @param queryString the string to search for * @param contactCount the maximum count of result contacts * @return the created query */ @Override public ContactQuery createContactQuery(String queryString, int contactCount) { if (!StringUtils.isNullOrEmpty(queryString)) return null; recentQuery = new MessageSourceContactQuery(MessageSourceService.this); return recentQuery; }
/** * Allocates new focus for given MUC room. * * @param room the name of MUC room for which new conference has to be allocated. * @param properties configuration properties map included in the request. * @return <tt>true</tt> if conference focus is in the room and ready to handle session * participants. * @throws Exception if for any reason we have failed to create the conference */ public synchronized boolean conferenceRequest(String room, Map<String, String> properties) throws Exception { if (StringUtils.isNullOrEmpty(room)) return false; if (shutdownInProgress && !conferences.containsKey(room)) return false; if (!conferences.containsKey(room)) { createConference(room, properties); } JitsiMeetConference conference = conferences.get(room); return conference.isInTheRoom(); }
/** Creating the configuration form */ private void init() { ResourceManagementService resources = LoggingUtilsActivator.getResourceService(); enableCheckBox = new SIPCommCheckBox(resources.getI18NString("plugin.loggingutils.ENABLE_DISABLE")); enableCheckBox.addActionListener(this); sipProtocolCheckBox = new SIPCommCheckBox(resources.getI18NString("plugin.sipaccregwizz.PROTOCOL_NAME")); sipProtocolCheckBox.addActionListener(this); jabberProtocolCheckBox = new SIPCommCheckBox(resources.getI18NString("plugin.jabberaccregwizz.PROTOCOL_NAME")); jabberProtocolCheckBox.addActionListener(this); String rtpDescription = resources.getI18NString("plugin.loggingutils.PACKET_LOGGING_RTP_DESCRIPTION"); rtpProtocolCheckBox = new SIPCommCheckBox( resources.getI18NString("plugin.loggingutils.PACKET_LOGGING_RTP") + " " + rtpDescription); rtpProtocolCheckBox.addActionListener(this); rtpProtocolCheckBox.setToolTipText(rtpDescription); ice4jProtocolCheckBox = new SIPCommCheckBox(resources.getI18NString("plugin.loggingutils.PACKET_LOGGING_ICE4J")); ice4jProtocolCheckBox.addActionListener(this); JPanel mainPanel = new TransparentPanel(); add(mainPanel, BorderLayout.NORTH); mainPanel.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); enableCheckBox.setAlignmentX(Component.LEFT_ALIGNMENT); c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1.0; c.gridx = 0; c.gridy = 0; mainPanel.add(enableCheckBox, c); String label = resources.getI18NString("plugin.loggingutils.PACKET_LOGGING_DESCRIPTION"); JLabel descriptionLabel = new JLabel(label); descriptionLabel.setToolTipText(label); enableCheckBox.setToolTipText(label); descriptionLabel.setForeground(Color.GRAY); descriptionLabel.setFont(descriptionLabel.getFont().deriveFont(8)); c.gridy = 1; c.insets = new Insets(0, 25, 10, 0); mainPanel.add(descriptionLabel, c); final JPanel loggersButtonPanel = new TransparentPanel(new GridLayout(0, 1)); loggersButtonPanel.setBorder( BorderFactory.createTitledBorder(resources.getI18NString("service.gui.PROTOCOL"))); loggersButtonPanel.add(sipProtocolCheckBox); loggersButtonPanel.add(jabberProtocolCheckBox); loggersButtonPanel.add(rtpProtocolCheckBox); loggersButtonPanel.add(ice4jProtocolCheckBox); c.insets = new Insets(0, 20, 10, 0); c.gridy = 2; mainPanel.add(loggersButtonPanel, c); final JPanel advancedPanel = new TransparentPanel(new GridLayout(0, 2)); advancedPanel.setBorder( BorderFactory.createTitledBorder(resources.getI18NString("service.gui.ADVANCED"))); fileCountField.getDocument().addDocumentListener(this); fileSizeField.getDocument().addDocumentListener(this); fileCountLabel = new JLabel(resources.getI18NString("plugin.loggingutils.PACKET_LOGGING_FILE_COUNT")); advancedPanel.add(fileCountLabel); advancedPanel.add(fileCountField); fileSizeLabel = new JLabel(resources.getI18NString("plugin.loggingutils.PACKET_LOGGING_FILE_SIZE")); advancedPanel.add(fileSizeLabel); advancedPanel.add(fileSizeField); c.gridy = 3; mainPanel.add(advancedPanel, c); archiveButton = new JButton(resources.getI18NString("plugin.loggingutils.ARCHIVE_BUTTON")); archiveButton.addActionListener(this); c = new GridBagConstraints(); c.anchor = GridBagConstraints.LINE_START; c.weightx = 0; c.gridx = 0; c.gridy = 4; mainPanel.add(archiveButton, c); if (!StringUtils.isNullOrEmpty(getUploadLocation())) { uploadLogsButton = new JButton(resources.getI18NString("plugin.loggingutils.UPLOAD_LOGS_BUTTON")); uploadLogsButton.addActionListener(this); c.insets = new Insets(10, 0, 0, 0); c.gridy = 5; mainPanel.add(uploadLogsButton, c); } }
/** * 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)); } } } }
/** * Creates new instance of <tt>RESTReservations</tt> instance. * * @param baseUrl base URL for RESP API endpoint. */ public RESTReservations(String baseUrl) { if (StringUtils.isNullOrEmpty(baseUrl)) { throw new NullPointerException("baseUrl"); } this.api = new ApiHandler(baseUrl); }