Hello everybody,
we recently noticed the limitation in openfire that it wont return History-Messages in MultiUserChat Rooms that are older than 2 days.
Well, this is not completely true, but if you restart the server you will never get HistoryMessages that are older than 2 days...however, as long as you do not restart the server you will get as many HistoryMessages as saved in the cache(?).
I now want to provide a custom IQ to request Messages from a room that are older than a provided timestamp.
So, what I would send is something like:
<iq type="get" to="mycomponent" from="myjid@somewhere.com">
<query xmlns="getoldmessages">
<room>mucjid@mucservice.com</room>
<amountofmessagestoreceive>50</amountofmessagestoreceive>
<clienttimestamp>1234567567</clienttimestamp>
</query>
</iq>
So, the client would provide a timestamp, a number of messages that it wants to receive and the room for which it needs the messages.
The plugin would now have to find the next 50 messages that have a timestamp smaller the provided client-timestamp.
The way to get this messages is pretty much straigt forward I guess..however, I am afraid that this will perform badly in a table such as ofMucConversationLog with a lot of entries....
Does anybody have any idea on how to get a nice performance here?
One of my ideas is to read all messages belonging to this room once the client that could send the above IQ enters the room.
We could then filter locally and wouldn't have to access the database directly all the time.
Maybe somebody here already attempted this and (hopefuly) succeeded.
Thanks in advance!