Openfire server can surely save chat histories. To turn it on, you should go to Server/Server Settings/Message Audit Policy and select Enable Message Auditing. As you can see there, messages will be held under the /.../openfire/logs folder in some kind of XML format. You can parse this XML and get your messages very easily
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…