The window handling code is quite old and desperately needs a rewrite. So I'll try to tackle this too. This will be done with XEP-0313: Message Archive Management in mind. So when we start implementing XEP-0313 we will already have it easier.
This project is one of its kind!