I’m not sure what the behavior should be, but the reason it is happening is that the listeners are stored using a map of listener instance to packet type. So when you are adding the second packet type it is replacing the map entry with the most recent one. You can work around the issue pretty easily by registering both packet types at the same time using an OrFilter class.
conn.addPacketListener(listener, new OrFilter(new PacketTypeFilter (Presence.class), new PacketTypeFilter(Message.class)));
I guess it’s ultimately up to the developers of Smack to decide that, but I would probably expect it to work the way you were trying to use it. Plus if it worked in the old version it should probably continue to work that way. The current behavior is in fact documented though for the addPacketListener method, so it seems that the change was intentional.
I am trying to develop a chat client based on Smack,I am getting prblm while getting the subscription request from users.How i can get subscription request