Package org.jivesoftware.smack

Examples of org.jivesoftware.smack.PacketListener


        localConnectionConfiguration.setTruststorePassword(keystorePassword);
        XMPPConnection localClient = new XMPPConnection(localConnectionConfiguration);

        localClient.connect();
        localClient.login(localUser.getNode(), "password1");
        localClient.addPacketListener(new PacketListener() {
            public void processPacket(Packet packet) {
                System.out.println("# " + packet);
            }
        }, new PacketFilter() {
            public boolean accept(Packet arg0) {
View Full Code Here


     * @return
     * @throws InterruptedException
     */
    public Packet sendSync(Packet request) throws InterruptedException {
        LinkedBlockingQueue<Packet> queue = new LinkedBlockingQueue<Packet>();
        PacketListener listener = new SyncPacketListener(queue);
        PacketFilter filter = new IdPacketFilter(request.getPacketID());
       
        addPacketListener(listener, filter);
        sendPacket(request);
       
View Full Code Here

  private PacketListener recordListener;

  @Override
  public void installRecordReceiver(final SXEController controller) {

    recordListener = new PacketListener() {
      @Override
      public void processPacket(Packet packet) {
        final SXEExtension extension = (SXEExtension) packet
            .getExtension(SXEMessage.SXE_TAG, SXEMessage.SXE_XMLNS);
        extension.getMessage().setFrom(packet.getFrom());
View Full Code Here

   * invitation process
   */
  public void enableInvitation(final SXEController controller,
      final SubMonitor subMonitor) {

    invitationListener = new PacketListener() {
      @Override
      public void processPacket(Packet packet) {
        SXEExtension extension = (SXEExtension) packet.getExtension(
            SXEMessage.SXE_TAG, SXEMessage.SXE_XMLNS);
        extension.getMessage().setFrom(packet.getFrom());
View Full Code Here

        jComboBoxStatus.setSelectedIndex(loginwindow.getComboBoxSelectedItem());
        jComboBoxStatus.setForeground(((ComboItem)jComboBoxStatus.getSelectedItem()).getColor());

        final AndFilter andFilter = new AndFilter(new PacketTypeFilter(Message.class));
        //Listener für eingehende Messages, dass dann ein Fenster geöffnet wird
        final PacketListener pktListener = new PacketListener() {
            public void processPacket(Packet pktPacket) {
                boolean bWindow = false;
                if (pktPacket instanceof Message) {
                    Message msg = (Message) pktPacket;
                    //String strFrom = msg.getFrom().substring(0, msg.getFrom().indexOf("/"));
View Full Code Here

  // Create a Listener that listens for Messages with the extension
  //"http://jabber.org/protocol/xhtml-im"
  // This listener will listen on the conn2 and answer an ACK if everything is ok
  PacketFilter packetFilter =
      new PacketExtensionFilter("html", "http://jabber.org/protocol/xhtml-im");
  PacketListener packetListener = new PacketListener() {
      @Override
      public void processPacket(Packet packet) {

      }
  };
View Full Code Here

        addInformationPanel();

        // Create a thread that will listen for all incoming packets and write them to
        // the GUI. This is what we call "interpreted" packet data, since it's the packet
        // data as Smack sees it and not as it's coming in as raw XML.
        packetReaderListener = new PacketListener() {
            SimpleDateFormat dateFormatter = new SimpleDateFormat("hh:mm:ss aaa");

            public void processPacket(final Packet packet) {
                SwingUtilities.invokeLater(new Runnable() {
                    public void run() {
                        addReadPacketToTable(dateFormatter, packet);
                    }
                });

            }
        };

        // Create a thread that will listen for all outgoing packets and write them to
        // the GUI.
        packetWriterListener = new PacketListener() {
            SimpleDateFormat dateFormatter = new SimpleDateFormat("hh:mm:ss aaa");

            public void processPacket(final Packet packet) {
                SwingUtilities.invokeLater(new Runnable() {
                    public void run() {
View Full Code Here

        }
    }

    private void init() {
        // Listens for all roster exchange packets and fire the roster exchange listeners.
        packetListener = new PacketListener() {
            public void processPacket(Packet packet) {
                Message message = (Message) packet;
                PEPEvent event = (PEPEvent) message.getExtension("event", "http://jabber.org/protocol/pubsub#event");
                // Fire event for roster exchange listeners
                firePEPListeners(message.getFrom(), event);
View Full Code Here

        writer = debugWriter;

        // Create a thread that will listen for all incoming packets and write them to
        // the GUI. This is what we call "interpreted" packet data, since it's the packet
        // data as Smack sees it and not as it's coming in as raw XML.
        listener = new PacketListener() {
            public void processPacket(Packet packet) {
                if (printInterpreted) {
                    System.out.println(
                            dateFormatter.format(new Date()) + " RCV PKT (" +
                            connection.hashCode() +
View Full Code Here

        // get IBB sessions data packet listener
        InBandBytestreamSession session = new InBandBytestreamSession(connection, initBytestream,
                        initiatorJID);
        InputStream inputStream = session.getInputStream();
        PacketListener listener = Whitebox.getInternalState(inputStream, PacketListener.class);

        // build invalid packet with out of order sequence
        String base64Data = StringUtils.encodeBase64("Data");
        DataPacketExtension dpe = new DataPacketExtension(sessionID, 123, base64Data);
        Message dataMessage = new Message();
        dataMessage.addExtension(dpe);

        // add data packets
        listener.processPacket(dataMessage);

        // read until exception is thrown
        try {
            inputStream.read();
            fail("exception should be thrown");
View Full Code Here

TOP

Related Classes of org.jivesoftware.smack.PacketListener

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.