@ -101,9 +101,10 @@ end
-- Sends a json message notifying that the jid was granted/denied access in lobby
-- the message from is the actor that did the operation
function notify_lobby_access ( room , actor , jid , granted )
function notify_lobby_access ( room , actor , jid , display_name , granted )
local notify_json = {
value = jid
value = jid ,
name = display_name
} ;
if granted then
notify_json.event = NOTIFY_LOBBY_ACCESS_GRANTED ;
@ -234,8 +235,10 @@ function process_lobby_muc_loaded(lobby_muc, host_module)
host_module : hook ( ' muc-broadcast-presence ' , function ( event )
local actor , occupant , room , x = event.actor , event.occupant , event.room , event.x ;
if check_status ( x , ' 307 ' ) then
local display_name = occupant : get_presence ( ) : get_child_text (
' nick ' , ' http://jabber.org/protocol/nick ' ) ;
-- we need to notify in the main room
notify_lobby_access ( room.main_room , actor , occupant.nick , false ) ;
notify_lobby_access ( room.main_room , actor , occupant.nick , display_name , false ) ;
end
end ) ;
end
@ -362,7 +365,10 @@ process_host_module(main_muc_component_config, function(host_module, host)
if room._data . lobbyroom then
local occupant = room._data . lobbyroom : get_occupant_by_real_jid ( invitee ) ;
if occupant then
notify_lobby_access ( room , from , occupant.nick , true ) ;
local display_name = occupant : get_presence ( ) : get_child_text (
' nick ' , ' http://jabber.org/protocol/nick ' ) ;
notify_lobby_access ( room , from , occupant.nick , display_name , true ) ;
end
end
end ) ;
@ -396,4 +402,4 @@ end
module : hook_global ( ' bosh-session ' , update_session ) ;
module : hook_global ( ' websocket-session ' , update_session ) ;
module : hook_global ( ' config-reloaded ' , load_config ) ;
module : hook_global ( ' create-lobby-room ' , handle_create_lobby ) ;
module : hook_global ( ' create-lobby-room ' , handle_create_lobby ) ;