Unlimited retrieve messages when new user join conference


Hi team,

I want to unlimited the retrieve message when new user join room. Right now, the maximum message is only 20. I’ve tried to config max_archive_query_results = 100; in prosody but it’s doesn’t work.
Here is my config, I’m using prosody 0.10.2 and save all the message to sql database.

Component “conference.abc.com” “muc”
name = “The localhost chatrooms server”
max_history_messages = 100;
max_archive_query_results = 100;

Can you tell me how to config it correctly. thanks so much


I’m looking at trunk code, I don’t think message history is stored in database.
But I think prosody maybe have a bug. I will open and issue on their side to check it?

local default_history_length = 20;
local max_history_length = module:get_option_number("max_history_messages", math.huge);

local function get_historylength(room)
    return math.min(room._data.history_length or default_history_length, max_history_length);

So this should state max, not min, at least this is my understanding. And the default value of max_history_messages should not be math.huge.

There is another option, where the owner of the room can set it in the muc dataform, but this is not implemented in our client and I think this is better to be controlled on the serverside.


What you can do to workaround it, to find the default_history_length in the lua code under /usr/lib/prosody change it and restart prosody.
The downside is, you need to do that on every prosody upgrade.


Here is the issue: https://issues.prosody.im/1176


Hi Damencho,

Thanks so much for helping me. Actually I already set the default_history_length = 100 but it’s doesn’t work. It’s still kept the default 20 messages. I change the default history length in /usr/lib/prosody/mod_mam_muc.lua


Hum, I need to look at 0.10 logic there, cause I’m looking at trunk code.


You need to change /usr/lib/prosody/modules/muc/muc.lib.lua
local default_history_length, max_history_length = 20, math.huge


Well even that doesn’t work :frowning: Let’s see what they reply on the issue.
I made it work by modifying in

function room_mt:send_history(to, stanza)
if not history_tag then maxstanzas = 200; end


@nam1665 You can find more information in the issue.

But basically the correct way to handle this is implementing it in jicofo with a configuration, as jicofo is creating the room and is authenticated to the server.


Thanks so much, I change the max_history_length and it’s already work.