Get user information (email) without using JWT

Hello,

I’m trying to get the data from the pariticpants like email or display_name without using the JWT, is there a way to get his data

I use this script

function getroom(room_address)
local room = get_room_from_jid(room_address);
local participant_count = 0;
local occupants_json = array();

    if room then

            local occupants = room._occupants;

            if occupants then

                    participant_count = iterators.count(room:each_occupant());

                    for _, occupant in room:each_occupant() do
                   if string.sub(occupant.nick,-string.len("/focus"))~="/focus" then

                                for _, pr in occupant:each_session() do
                                    local nick = pr:get_child_text("nick", "http://jabber.org/protocol/nick") or "";
                                    local email = pr:get_child_text("email") or "";
                                    occupants_json:push({
                                        jid = tostring(occupant.nick),
                                        email = tostring(email),
                                        display_name = tostring(nick)});
                                end
                 end
                    end
            end
    
    end

    if participant_count > 1 then
            participant_count = participant_count - 1;
    end

return occupants_json
end

but i get this result

{“event_name”:[{“email”:"",“jid”:“evcjvma1350@conference.meet.test.dev/focus”,“display_name”:""}]}

any help please

thanks

This is the jid of jicofo, which has no email or display name.

Hello @damencho

thanks for your reply, haw i can get the email, maybye my question it’s possible or not without JWT, if you have any example or explanation please

Thanks

Displayname example jitsi-meet/mod_speakerstats_component.lua at 0fe738315485e49f4407c602e850fece4a1028da · jitsi/jitsi-meet · GitHub
Same should be available for email if it is available in the presence.

Hello

yes i see i get info, i have another question please,
it is possible to integrate this function in another module lua ??

currently I’m using this module and I would like to have the user information when the room is created/destroyed and when the user join/left

but withou JWT i can get the data like email, id of room, …

thnaks

Yep, check the speakerstats module it has all listeners in it for room creation and destroy.

Hello,

Yes its working

Can i pass a variable from local storage to module lua ?

Thank you for your help @damencho

You need changes in the code for that, but that is how displayname and avatar works

@damencho

thank you for your time

when I change the code I take for example all the objects :

local occupant, room = event.occupant, event.room;


local occupant = event.occupant;

local nick = jid_resource(occupant.nick);

I don’t find all the localstorage do you have steps even without code to get localstorage in lua please

thanks

Its not automatic as I said, you need client code changes to send it. Changes in jitsi-meet.

Hello,

I will first find where I need to modify the code and then I will try to pass a variable of localstorage
I tried to change to for example and I restart all service jitsi & prosday but no change i tried this

file name : react/resources/prosody-plugins/ poltergeist.lib.lua

-- Returns the last presence of the occupant.
-- @param room the room instance where to check for occupant
-- @param nick the nick of the occupant
-- @return presence stanza of the occupant
function get_presence(room, nick)

    return "koussaiTest"
    local occupant_jid = room:get_occupant_jid(component.."/"..nick)
    if occupant_jid then
        return room:get_occupant_by_nick(occupant_jid):get_presence();
    end
    return nil;
end

and here

– Occupant left set its dominant speaker to false and update the store the
– display name
function occupant_leaving(event)
local room = event.room;

if is_healthcheck_room(room.jid) then
    return;
end

if not room.speakerStats then
    return;
end

local occupant = event.occupant;

local speakerStatsForOccupant = room.speakerStats[occupant.jid];
if speakerStatsForOccupant then
    speakerStatsForOccupant:setDominantSpeaker(false);

    -- set display name
    local displayName = occupant:get_presence():get_child_text(
        'nick', 'http://jabber.org/protocol/nick');
    speakerStatsForOccupant.displayName = displayName;
end

end

But it always returns to me the real displaName I think I’m editing the wrong file

Thank you

What do you expect to see?

logically it must return me koussaitest

function get_presence(room, nick)

return "koussaiTest"

but I still get the displayName of UI interface “Koussai”

I think you are confusing the flow.
So web client reads data from localstorage and sets displayname in presence and send it to prosody which then broadcast it to other participants.
The code is prosody which is the xmpp server receiving the presences where you can extract it.

reads data from localstorage and sets displayname in presence

where can I find this in the code please

sorry, this is the first time I’m doing this

Hello,
Thanks a lot,

I commented all this code, I always get the displayName of user if prosday, so is there another place to send this info from client side to prosday

if (localParticipant) {
const displayName = _.escape(urlDisplayName);
const email = _.escape(urlEmail);

dispatch(participantUpdated({
    ...localParticipant,
    email,
    name: displayName
}));

        
dispatch(updateSettings({
    displayName,
    email
}));

}

Thank you

@emrah @Freddie Hello have you any idea for this problem

i have a localstroage X i would get it in prosody lua but i dont know how I do it ?

thanks