Package org.jivesoftware.smack.filter

Examples of org.jivesoftware.smack.filter.PacketFilter


  {  }
 
  static public Packet getReply(Connection connection, Packet packet, long timeout)
    throws XMPPException
  {
        PacketFilter responseFilter = new PacketIDFilter(packet.getPacketID());
        PacketCollector response = connection.createPacketCollector(responseFilter);
       
        connection.sendPacket(packet);

        // Wait up to a certain number of seconds for a reply.
View Full Code Here


    iqSent.setTo(getFullJID(0));
    iqSent.setFrom(getFullJID(0));
    iqSent.setType(IQ.Type.GET);

    // Create a filter and a collector...
    PacketFilter filter = new PacketTypeFilter(IQ.class);
    PacketCollector collector = getConnection(0).createPacketCollector(filter);

    System.out.println("Testing if a Jingle IQ can be sent and received...");

    // Send the iq packet with an invalid namespace
View Full Code Here

    /**
     * Register the listenerJingles, waiting for a Jingle packet that tries to
     * establish a new session.
     */
    private void initJingleSessionRequestListeners() {
        PacketFilter initRequestFilter = new PacketFilter() {
            // Return true if we accept this packet
            public boolean accept(Packet pin) {
                if (pin instanceof IQ) {
                    IQ iq = (IQ) pin;
                    if (iq.getType().equals(IQ.Type.SET)) {
View Full Code Here

     * @return A PacketFilter that only accepts Packets if there is currently a
     *         SarosSession
     */
    public static PacketFilter getInSessionFilter(
        final SarosSessionManager sessionManager) {
        return new PacketFilter() {
            public boolean accept(Packet arg0) {
                return sessionManager.getSarosSession() != null;
            }
        };
    }
View Full Code Here

     * @return filter that returns true iff currently a shared project exists
     *         and the message was from the host of this shared project.
     */
    public static PacketFilter getFromHostFilter(
        final SarosSessionManager sessionManager) {
        return new PacketFilter() {
            public boolean accept(Packet packet) {
                ISarosSession sarosSession = sessionManager.getSarosSession();

                return sarosSession != null
                    && sarosSession.getHost().getJID()
View Full Code Here

     */
    public static PacketFilter getSessionIDPacketFilter(
        final SessionIDObservable sessionIDObservable) {

        return new AndFilter(new MessageTypeFilter(Message.Type.chat),
            new PacketFilter() {
                public boolean accept(Packet arg0) {
                    Message message = (Message) arg0;
                    return sessionIDObservable.getValue().equals(
                        getSessionID(message));
                }
View Full Code Here

     */
    public static PacketFilter getInvitationIDFilter(
        final XStreamExtensionProvider<? extends DefaultInvitationInfo> extProv,
        final String invitationID) {

        return new PacketFilter() {
            public boolean accept(Packet arg0) {
                DefaultInvitationInfo invInfo = extProv.getPayload(arg0);

                return ObjectUtils.equals(invInfo.invitationID, invitationID);
            }
View Full Code Here

    public static PacketFilter getIncomingTransferObjectFilter(
        final IncomingTransferObjectExtensionProvider extProv,
        final SessionIDObservable sessionID, final String invitationID,
        final String type) {

        return new AndFilter(extProv.getPacketFilter(), new PacketFilter() {

            public boolean accept(Packet packet) {
                IncomingTransferObject payload = extProv.getPayload(packet);

                if (payload == null) {
View Full Code Here

    }

    public static PacketFilter getIncomingFileListFilter(
        final IncomingTransferObjectExtensionProvider extProv,
        final String sessionID, final String processID, final JID peer) {
        return new AndFilter(extProv.getPacketFilter(), new PacketFilter() {

            public boolean accept(Packet packet) {
                IncomingTransferObject payload = extProv.getPayload(packet);

                if (payload == null) {
View Full Code Here

                    log.error(
                        "Could not send test results to "
                            + Utils.prefix(new JID(packet.getFrom())), e);
                }
            }
        }, new PacketFilter() {

            public boolean accept(Packet packet) {
                IncomingTransferObject payload = incomingTransferObjectExtensionProvider
                    .getPayload(packet);
View Full Code Here

TOP

Related Classes of org.jivesoftware.smack.filter.PacketFilter

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.