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); }
/** * Cancels the SOCKS5 Bytestream request by sending an error to the initiator and building a XMPP * exception. * * @throws XMPPException XMPP exception containing the XMPP error */ private void cancelRequest() throws XMPPException { String errorMessage = "Could not establish socket with any provided host"; XMPPError error = new XMPPError(XMPPError.Condition.item_not_found, errorMessage); IQ errorIQ = IQ.createErrorResponse(this.bytestreamRequest, error); this.manager.getConnection().sendPacket(errorIQ); throw new XMPPException(errorMessage, error); }
/** * Reject an incoming file transfer. * * <p>Specified in XEP-95 4.2 and 3.2 Example 8 * * @param request * @throws NotConnectedException * @throws InterruptedException */ protected void rejectIncomingFileTransfer(FileTransferRequest request) throws NotConnectedException, InterruptedException { StreamInitiation initiation = request.getStreamInitiation(); // Reject as specified in XEP-95 4.2. Note that this is not to be confused with the Socks 5 // Bytestream rejection as specified in XEP-65 5.3.1 Example 13, which says that // 'not-acceptable' should be returned. This is done by Smack in // Socks5BytestreamManager.replyRejectPacket(IQ). IQ rejection = IQ.createErrorResponse(initiation, new XMPPError(XMPPError.Condition.forbidden)); connection().sendStanza(rejection); }
private void handleColibriIq(ColibriConferenceIQ colibriIQ) { ColibriConferenceIQ.Recording recording = colibriIQ.getRecording(); String from = colibriIQ.getFrom(); JitsiMeetConference conference = getConferenceForMucJid(colibriIQ.getFrom()); if (conference == null) { logger.debug("Room not found for JID: " + from); return; } JitsiMeetRecording recordingHandler = conference.getRecording(); if (recordingHandler == null) { logger.error("JitsiMeetRecording is null for iq: " + colibriIQ.toXML()); // Internal server error smackXmpp .getXmppConnection() .sendPacket( IQ.createErrorResponse( colibriIQ, new XMPPError(XMPPError.Condition.interna_server_error))); return; } State recordingState = recordingHandler.modifyRecordingState( colibriIQ.getFrom(), recording.getToken(), recording.getState(), recording.getDirectory(), colibriIQ.getTo()); ColibriConferenceIQ response = new ColibriConferenceIQ(); response.setType(IQ.Type.RESULT); response.setPacketID(colibriIQ.getPacketID()); response.setTo(colibriIQ.getFrom()); response.setFrom(colibriIQ.getTo()); response.setName(colibriIQ.getName()); response.setRecording(new ColibriConferenceIQ.Recording(recordingState)); smackXmpp.getXmppConnection().sendPacket(response); }
/** * Responses to the given IQ packet's sender with an XMPP error that an In-Band Bytestream open * request is rejected because its block size is greater than the maximum allowed block size. * * @param request IQ packet that should be answered with a resource-constraint error */ protected void replyResourceConstraintPacket(IQ request) { final XMPPError xmppError = new XMPPError(XMPPError.Condition.resource_constraint); final IQ error = IQ.createErrorResponse(request, xmppError); connection.sendPacket(error); }
/** * Responses to the given IQ packet's sender with an XMPP error that an In-Band Bytestream is not * accepted. * * @param request IQ packet that should be answered with a not-acceptable error */ protected void replyRejectPacket(IQ request) { final XMPPError xmppError = new XMPPError(XMPPError.Condition.no_acceptable); final IQ error = IQ.createErrorResponse(request, xmppError); connection.sendPacket(error); }
/** * Responses to the given IQ packet's sender with an XMPP error that an In-Band Bytestream session * could not be found. * * @param request IQ packet that should be answered with a item-not-found error */ protected void replyItemNotFoundPacket(IQ request) { final XMPPError xmppError = new XMPPError(XMPPError.Condition.item_not_found); final IQ error = IQ.createErrorResponse(request, xmppError); connection.sendPacket(error); }