processPacket - no packets received

Hello,

I am not receiving any incoming ‘Presence’ packets using a packet listener and a subscription mode of ‘manual’. Here’s a snippet of code:

xmppConnection = new XMPPConnection(config);

xmppConnection.getRoster().setSubscriptionMode(SubscriptionMode.manual);

xmppConnection.addPacketListener(this, new AndFilter(new PacketTypeFilter(Message.class), new PacketTypeFilter(Presence.class)));

xmppConnection.connect();

@Override

processPacket(Packet packet){

System.out.println(packet);

}

I then subscribe to this user (using a different endpoint and name). I would expect to see the ‘subscribe’ Presence packet. Any ideas what I’m doing wrong?

Thanks,

Matt

Think I figured this out. It appears that Smack doesn’t like my AndFilter. Once I removed the AndFilter and changed it to look for Presence messages only, it worked.

Can a smack author or expert verify this?

Thanks,

Matt

My fault. Just realized that a Message packet and Presence packet will never come in as a packet of both types (AND). It needs to be an OrFilter. Now it works. Sorry folks.

MattS