mod_muc_room
uses the gen_fsm behaviour. You can tell since this line is near the top of the file:
-behaviour(gen_fsm).
To receive and handle a message sent to a gen_fsm process you wouldn't use receive
directly, but rather add a new clause to the handle_info
function.
For example, there is a clause that handles the {process_user_presence, From}
message. It starts with:
handle_info({process_user_presence, From}, normal_state = _StateName, StateData) ->
and eventually ends up in something like:
{next_state, normal_state, StateData1}
where StateData1
is a modified form of StateData
. This is how you modify the state of the room.