MUC not sending clients chat history

I am using the smack library port to android (asmack) so connect to a ejabberd server with a persistent room running. Everything is working correctly for the chat (people can chat to each other), but I am having issues getting chat history. Due to the nature of the application I am writing, network loss is inevitable, so on reconnection, I need to request the messages that were missed over the duration of the connection problem, and on initial connect, I need to download a large amount of history (even if no one is currently in the room, it is what the client wants).

Here is where my problems comes up, when I connect to a MUC, I specify that I want 100 messages none of which should be older than 24 hours. My desired results is a message I send to an empty room should be sent back to me when i disconnect and reconnect. But my results are that I don't get anything. This is not to say that the history feature isn't working at all, because if there are several people in the chat and someone dis/re connects, a few messages are sent, but no where near the number I am requesting, which makes me think that muc must be scrapping or simply ignoring the other messages as it doesn't see them as necessary to provide new users a context to the room.

So I am kind of at a loss (and nearing a deadline.... bad planning on my part), so I will continue digging through documentation and forum posts, but if anyone knows hoe to configure muc to send the number of requested messages no matter what, I would greatly appreciate it.

Thanks ahead of time to all who post, you very well may save my ass.

Look at the ejabberd Guide,

Look at the ejabberd Guide, it says:

ejabberd Guide «3.3.10 mod_muc» wrote:

{history_size, Size}
... define the number of history messages to keep and send to users joining the room.
The default value is 20.

After reading that, it's easy to answer your questions:

jessy.diamondman wrote:

when I connect to a MUC, I specify that I want 100 messages

You may request 1 million, but ejabberd by default stores only the last 20 messages :P

jessy.diamondman wrote:

which makes me think that muc must be scrapping or simply ignoring the other messages

Right, the room forgets the older messages in the FIFO queue of messages.

jessy.diamondman wrote:

if anyone knows hoe to configure muc to send the number of requested messages no matter what, I would greatly appreciate it.

Look at mod_muc option: history_size. Set it to 100 or higher in ejabberd.cfg

BTW, notice that the message history is kept in RAM, not disk: when the room/muc/ejabberd is stopped, the history is lost.

Syndicate content