private void processRequest(Stanza packet) throws NotConnectedException { Open ibbRequest = (Open) packet; // validate that block size is within allowed range if (ibbRequest.getBlockSize() > this.manager.getMaximumBlockSize()) { this.manager.replyResourceConstraintPacket(ibbRequest); return; } StreamNegotiator.signal(ibbRequest.getFrom() + '\t' + ibbRequest.getSessionID(), ibbRequest); // ignore request if in ignore list if (this.manager.getIgnoredBytestreamRequests().remove(ibbRequest.getSessionID())) return; // build bytestream request from packet InBandBytestreamRequest request = new InBandBytestreamRequest(this.manager, ibbRequest); // notify listeners for bytestream initiation from a specific user BytestreamListener userListener = this.manager.getUserListener(ibbRequest.getFrom()); if (userListener != null) { userListener.incomingBytestreamRequest(request); } else if (!this.manager.getAllRequestListeners().isEmpty()) { /* * if there is no user specific listener inform listeners for all initiation requests */ for (BytestreamListener listener : this.manager.getAllRequestListeners()) { listener.incomingBytestreamRequest(request); } } else { /* * if there is no listener for this initiation request, reply with reject message */ this.manager.replyRejectPacket(ibbRequest); } }
private void processRequest(Stanza packet) throws NotConnectedException { Bytestream byteStreamRequest = (Bytestream) packet; StreamNegotiator.signal(byteStreamRequest.getFrom() + '\t' + byteStreamRequest.getSessionID(), byteStreamRequest); // ignore request if in ignore list if (this.manager.getIgnoredBytestreamRequests().remove(byteStreamRequest.getSessionID())) { return; } // build bytestream request from packet Socks5BytestreamRequest request = new Socks5BytestreamRequest(this.manager, byteStreamRequest); // notify listeners for bytestream initiation from a specific user BytestreamListener userListener = this.manager.getUserListener(byteStreamRequest.getFrom()); if (userListener != null) { userListener.incomingBytestreamRequest(request); } else if (!this.manager.getAllRequestListeners().isEmpty()) { /* * if there is no user specific listener inform listeners for all initiation requests */ for (BytestreamListener listener : this.manager.getAllRequestListeners()) { listener.incomingBytestreamRequest(request); } } else { /* * if there is no listener for this initiation request, reply with reject message */ this.manager.replyRejectPacket(byteStreamRequest); } }
private void processRequest(Packet packet) { Open ibbRequest = (Open) packet; // validate that block size is within allowed range if (ibbRequest.getBlockSize() > this.manager.getMaximumBlockSize()) { this.manager.replyResourceConstraintPacket(ibbRequest); return; } // ignore request if in ignore list if (this.manager.getIgnoredBytestreamRequests().remove(ibbRequest.getSessionID())) return; // build bytestream request from packet InBandBytestreamRequest request = new InBandBytestreamRequest(this.manager, ibbRequest); // notify listeners for bytestream initiation from a specific user BytestreamListener userListener = this.manager.getUserListener(ibbRequest.getFrom()); if (userListener != null) { userListener.incomingBytestreamRequest(request); } else if (!this.manager.getAllRequestListeners().isEmpty()) { /* * if there is no user specific listener inform listeners for all initiation requests */ for (BytestreamListener listener : this.manager.getAllRequestListeners()) { listener.incomingBytestreamRequest(request); } } else { /* * if there is no listener for this initiation request, reply with reject message */ this.manager.replyRejectPacket(ibbRequest); } }
private void processRequest(Packet packet) { Bytestream byteStreamRequest = (Bytestream) packet; // ignore request if in ignore list if (this.manager.getIgnoredBytestreamRequests().remove(byteStreamRequest.getSessionID())) { return; } // build bytestream request from packet Socks5BytestreamRequest request = new Socks5BytestreamRequest(this.manager, byteStreamRequest); // notify listeners for bytestream initiation from a specific user BytestreamListener userListener = this.manager.getUserListener(byteStreamRequest.getFrom()); if (userListener != null) { userListener.incomingBytestreamRequest(request); } else if (!this.manager.getAllRequestListeners().isEmpty()) { /* * if there is no user specific listener inform listeners for all initiation requests */ for (BytestreamListener listener : this.manager.getAllRequestListeners()) { listener.incomingBytestreamRequest(request); } } else { /* * if there is no listener for this initiation request, reply with reject message */ this.manager.replyRejectPacket(byteStreamRequest); } }
private void processRequest(Packet packet) { Bytestream byteStreamRequest = (Bytestream) packet; // ignore request if in ignore list if (this.manager.getIgnoredBytestreamRequests().remove( byteStreamRequest.getSessionID())) { return; } // build bytestream request from packet Socks5BytestreamRequest request = new Socks5BytestreamRequest( this.manager, byteStreamRequest); // notify listeners for bytestream initiation from a specific user BytestreamListener userListener = this.manager .getUserListener(byteStreamRequest.getFrom()); if (userListener != null) { userListener.incomingBytestreamRequest(request); } else if (!this.manager.getAllRequestListeners().isEmpty()) { /* * if there is no user specific listener inform listeners for all * initiation requests */ for (BytestreamListener listener : this.manager .getAllRequestListeners()) { listener.incomingBytestreamRequest(request); } } else { /* * if there is no listener for this initiation request, reply with * reject message */ this.manager.replyRejectPacket(byteStreamRequest); } }
private void processRequest(Packet packet) { Open ibbRequest = (Open) packet; // validate that block size is within allowed range if (ibbRequest.getBlockSize() > this.manager.getMaximumBlockSize()) { this.manager.replyResourceConstraintPacket(ibbRequest); return; } // ignore request if in ignore list if (this.manager.getIgnoredBytestreamRequests().remove( ibbRequest.getSessionID())) return; // build bytestream request from packet InBandBytestreamRequest request = new InBandBytestreamRequest( this.manager, ibbRequest); // notify listeners for bytestream initiation from a specific user BytestreamListener userListener = this.manager .getUserListener(ibbRequest.getFrom()); if (userListener != null) { userListener.incomingBytestreamRequest(request); } else if (!this.manager.getAllRequestListeners().isEmpty()) { /* * if there is no user specific listener inform listeners for all * initiation requests */ for (BytestreamListener listener : this.manager .getAllRequestListeners()) { listener.incomingBytestreamRequest(request); } } else { /* * if there is no listener for this initiation request, reply with * reject message */ this.manager.replyRejectPacket(ibbRequest); } }
/** * Adds InBandBytestreamListener that is called for every incoming in-band bytestream request * unless there is a user specific InBandBytestreamListener registered. * <p> * If no listeners are registered all In-Band Bytestream request are rejected with a * <not-acceptable/> error. * <p> * Note that the registered {@link InBandBytestreamListener} will NOT be notified on incoming * Socks5 bytestream requests sent in the context of <a * href="http://xmpp.org/extensions/xep-0096.html">XEP-0096</a> file transfer. (See * {@link FileTransferManager}) * * @param listener the listener to register */ public void addIncomingBytestreamListener(BytestreamListener listener) { this.allRequestListeners.add(listener); }
/** * Removes the given listener from the list of listeners for all incoming In-Band Bytestream * requests. * * @param listener the listener to remove */ public void removeIncomingBytestreamListener(BytestreamListener listener) { this.allRequestListeners.remove(listener); }
/** * Adds InBandBytestreamListener that is called for every incoming in-band bytestream request * from the given user. * <p> * Use this method if you are awaiting an incoming Socks5 bytestream request from a specific * user. * <p> * If no listeners are registered all In-Band Bytestream request are rejected with a * <not-acceptable/> error. * <p> * Note that the registered {@link InBandBytestreamListener} will NOT be notified on incoming * Socks5 bytestream requests sent in the context of <a * href="http://xmpp.org/extensions/xep-0096.html">XEP-0096</a> file transfer. (See * {@link FileTransferManager}) * * @param listener the listener to register * @param initiatorJID the JID of the user that wants to establish an In-Band Bytestream */ public void addIncomingBytestreamListener(BytestreamListener listener, String initiatorJID) { this.userListeners.put(initiatorJID, listener); }
/** * Returns the {@link InBandBytestreamListener} that should be informed if a In-Band Bytestream * request from the given initiator JID is received. * * @param initiator the initiator's JID * @return the listener */ protected BytestreamListener getUserListener(String initiator) { return this.userListeners.get(initiator); }
/** * Returns a list of {@link InBandBytestreamListener} that are informed if there are no * listeners for a specific initiator. * * @return list of listeners */ protected List<BytestreamListener> getAllRequestListeners() { return this.allRequestListeners; }
/** * Adds BytestreamListener that is called for every incoming SOCKS5 Bytestream request unless * there is a user specific BytestreamListener registered. * <p> * If no listeners are registered all SOCKS5 Bytestream request are rejected with a * <not-acceptable/> error. * <p> * Note that the registered {@link BytestreamListener} will NOT be notified on incoming Socks5 * bytestream requests sent in the context of <a * href="http://xmpp.org/extensions/xep-0096.html">XEP-0096</a> file transfer. (See * {@link FileTransferManager}) * * @param listener the listener to register */ public void addIncomingBytestreamListener(BytestreamListener listener) { this.allRequestListeners.add(listener); }
/** * Removes the given listener from the list of listeners for all incoming SOCKS5 Bytestream * requests. * * @param listener the listener to remove */ public void removeIncomingBytestreamListener(BytestreamListener listener) { this.allRequestListeners.remove(listener); }
/** * Adds BytestreamListener that is called for every incoming SOCKS5 Bytestream request from the * given user. * <p> * Use this method if you are awaiting an incoming SOCKS5 Bytestream request from a specific * user. * <p> * If no listeners are registered all SOCKS5 Bytestream request are rejected with a * <not-acceptable/> error. * <p> * Note that the registered {@link BytestreamListener} will NOT be notified on incoming Socks5 * bytestream requests sent in the context of <a * href="http://xmpp.org/extensions/xep-0096.html">XEP-0096</a> file transfer. (See * {@link FileTransferManager}) * * @param listener the listener to register * @param initiatorJID the JID of the user that wants to establish a SOCKS5 Bytestream */ public void addIncomingBytestreamListener(BytestreamListener listener, String initiatorJID) { this.userListeners.put(initiatorJID, listener); }
/** * Returns the {@link BytestreamListener} that should be informed if a SOCKS5 Bytestream request * from the given initiator JID is received. * * @param initiator the initiator's JID * @return the listener */ protected BytestreamListener getUserListener(String initiator) { return this.userListeners.get(initiator); }
/** * Returns a list of {@link BytestreamListener} that are informed if there are no listeners for * a specific initiator. * * @return list of listeners */ protected List<BytestreamListener> getAllRequestListeners() { return this.allRequestListeners; }