Examples of PacketIDFilter


Examples of org.jivesoftware.smack.filter.PacketIDFilter

    }

    //System.out.println("SEND DATA " + iq.getChildElementXML());
    // result = (SearchIQ)account.xmpp.sendIQPacketAndWaitForReply( iq);
    new GOIMPacketListener(account.xmpp.getConnection(),
        new PacketIDFilter(iq.getPacketID()), new TaskObserver()) {
      public void processPacket(final Packet packet) {
        final SearchIQ result = (SearchIQ) packet;
        showResults( result );
      }
    }.registerListener();
View Full Code Here

Examples of org.jivesoftware.smack.filter.PacketIDFilter

    }

    @Override
    protected PacketFilter createFilter()
    {
        return new PacketIDFilter(pattern);
    }
View Full Code Here

Examples of org.jivesoftware.smack.filter.PacketIDFilter

            System.out.print("Looking for " + readerAddress + "...");
            while (true) {
                IQ testIQ = new Time();
                testIQ.setType(IQ.Type.GET);
                testIQ.setTo(readerAddress);
                PacketCollector collector = con.createPacketCollector(new PacketIDFilter(testIQ.getPacketID()));
                con.sendPacket(testIQ);
                // Wait 5 seconds.
                long start = System.currentTimeMillis();
                Packet result = collector.nextResult(5000);
                collector.cancel();
View Full Code Here

Examples of org.jivesoftware.smack.filter.PacketIDFilter

    }

    private void doLoad(XMPPConnection connection, String user) throws XMPPException {
        setType(Type.GET);
        PacketCollector collector = connection.createPacketCollector(
                new PacketIDFilter(getPacketID()));
        connection.sendPacket(this);

        VCard result = null;
        try {
            result = (VCard) collector.nextResult(SmackConfiguration.getPacketReplyTimeout());
View Full Code Here

Examples of org.jivesoftware.smack.filter.PacketIDFilter

    public static BrowseIQ retrieveBrowseRequest(XMPPConnection conn, String to) throws XMPPException {
      BrowseIQ iq = new BrowseIQ();
      iq.setType(IQ.Type.GET);
      iq.setTo(to);
          PacketCollector collector =
              conn.createPacketCollector(new PacketIDFilter(iq.getPacketID()));

          conn.sendPacket(iq);

          // Wait up to 5 seconds for a result.
          IQ result = (IQ) collector.nextResult(SmackConfiguration.getPacketReplyTimeout());
View Full Code Here

Examples of org.jivesoftware.smack.filter.PacketIDFilter

      conn = new SSLXMPPConnection(account.getServer(),account.getPort(),StringUtils.parseServer(account.jid));
    else
      conn = new XMPPConnection(account.getServer(),account.getPort(),StringUtils.parseServer(account.jid));
  }
  public IQ sendIQPacketAndWaitForReply(IQ reg) throws XMPPException {
    PacketFilter filter = new AndFilter(new PacketIDFilter(reg
        .getPacketID()), new PacketTypeFilter(IQ.class));
    PacketCollector collector = conn
        .createPacketCollector(filter);
    conn.sendPacket(reg);
    IQ result = (IQ) collector.nextResult(SmackConfiguration
View Full Code Here

Examples of org.jivesoftware.smack.filter.PacketIDFilter

        return client;
    }

    protected Packet sendSync(XMPPConnection client, Packet request) {
        // Create a packet collector to listen for a response.
        PacketCollector collector = client.createPacketCollector(new PacketIDFilter(request.getPacketID()));

        client.sendPacket(request);

        // Wait up to 5 seconds for a result.
        return collector.nextResult(5000);
View Full Code Here

Examples of org.jivesoftware.smack.filter.PacketIDFilter

            throws XMPPException {
        LastActivity activity = new LastActivity();
        activity.setTo(jid);

        PacketCollector collector =
                con.createPacketCollector(new PacketIDFilter(activity.getPacketID()));
        con.sendPacket(activity);

        LastActivity response =
                (LastActivity) collector.nextResult(SmackConfiguration.getPacketReplyTimeout());
View Full Code Here

Examples of org.jivesoftware.smack.filter.PacketIDFilter

        Authentication discoveryAuth = new Authentication();
        discoveryAuth.setType(IQ.Type.GET);
        discoveryAuth.setUsername(username);

        PacketCollector collector =
            connection.createPacketCollector(new PacketIDFilter(discoveryAuth.getPacketID()));
        // Send the packet
        connection.sendPacket(discoveryAuth);
        // Wait up to a certain number of seconds for a response from the server.
        IQ response = (IQ) collector.nextResult(SmackConfiguration.getPacketReplyTimeout());
        if (response == null) {
            throw new XMPPException("No response from the server.");
        }
        // If the server replied with an error, throw an exception.
        else if (response.getType() == IQ.Type.ERROR) {
            throw new XMPPException(response.getError());
        }
        // Otherwise, no error so continue processing.
        Authentication authTypes = (Authentication) response;
        collector.cancel();

        // Now, create the authentication packet we'll send to the server.
        Authentication auth = new Authentication();
        auth.setUsername(username);

        // Figure out if we should use digest or plain text authentication.
        if (authTypes.getDigest() != null) {
            auth.setDigest(connection.getConnectionID(), password);
        }
        else if (authTypes.getPassword() != null) {
            auth.setPassword(password);
        }
        else {
            throw new XMPPException("Server does not support compatible authentication mechanism.");
        }

        auth.setResource(resource);

        collector = connection.createPacketCollector(new PacketIDFilter(auth.getPacketID()));
        // Send the packet.
        connection.sendPacket(auth);
        // Wait up to a certain number of seconds for a response from the server.
        response = (IQ) collector.nextResult(SmackConfiguration.getPacketReplyTimeout());
        if (response == null) {
View Full Code Here

Examples of org.jivesoftware.smack.filter.PacketIDFilter

    public String authenticateAnonymously() throws XMPPException {
        // Create the authentication packet we'll send to the server.
        Authentication auth = new Authentication();

        PacketCollector collector =
            connection.createPacketCollector(new PacketIDFilter(auth.getPacketID()));
        // Send the packet.
        connection.sendPacket(auth);
        // Wait up to a certain number of seconds for a response from the server.
        IQ response = (IQ) collector.nextResult(SmackConfiguration.getPacketReplyTimeout());
        if (response == null) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.