Removing a packetlistener from a chat

How should I go about removing a “message listener” from a chat? It would seem to me to be a logical extension of the Chat class to be able to remove, as well as add a listener (maybe a list of listeners on a chat). I guess i could just use the removePacketListener in the XMPPConnection but then why wouldn’'t I just use XMPPConnection to add the listener as well?

The other thing i noticed is that there doesn’'t seem to be any way to not filter on thread id… there is the method to set filtered on thread ID but filteredonthreadid is only checked in the class constructor. so unless you can pass it into the constructor it basicly does nothing.

You have to remove the listener from the connection, which means you need to keep a reference to the listener. E.g.

MsgListener msgListener=new MsgListener(); //implements PacketListner
//remove listener
Conn.removePacketListener(msgListener); //Conn is an instance of XMPPConnection

HTH, Pheet