diff --git a/lib/Vroom/I18N/en.pm b/lib/Vroom/I18N/en.pm index 6b5826a..d2fe745 100644 --- a/lib/Vroom/I18N/en.pm +++ b/lib/Vroom/I18N/en.pm @@ -94,6 +94,7 @@ our %Lexicon = ( "s_WONT_BE_NOTIFIED_ANYMORE" => "%s won't be notified anymore", "JOIN_NOTIFICATION" => "Someone joined the room", "SOMEONE_JOINED_A_ROOM" => "Someone joined a video conference room, and your address is configured to receive this notifications", + "PARTICIPANT_NAME" => "The one who just joined your room is named", "AUTH_SUCCESS" => "You are now authenticated", "NOT_ALLOWED" => "You are not allowed to do this", "WRONG_PASSWORD" => "Wrong password", diff --git a/lib/Vroom/I18N/fr.pm b/lib/Vroom/I18N/fr.pm index 4314c1a..0bde416 100644 --- a/lib/Vroom/I18N/fr.pm +++ b/lib/Vroom/I18N/fr.pm @@ -100,6 +100,7 @@ our %Lexicon = ( "s_WONT_BE_NOTIFIED_ANYMORE" => "%s ne recevra plus les notifications pour ce salon", "JOIN_NOTIFICATION" => "Quelqu'un a rejoint votre salon", "SOMEONE_JOINED_A_ROOM" => "Quelqu'un a rejoint un salon de vidéo conférence, et votre adresse est configurée pour recevoir ces notifications", + "PARTICIPANT_NAME" => "La personne qui a rejoint votre salon se nomme", "AUTH_SUCCESS" => "Vous êtes maintenant authentifié", "NOT_ALLOWED" => "Vous n'êtes pas autorisé à faire ceci", "WRONG_PASSWORD" => "Mauvais mot de passe", diff --git a/public/js/vroom.js b/public/js/vroom.js index c903850..8f45e3b 100644 --- a/public/js/vroom.js +++ b/public/js/vroom.js @@ -830,6 +830,25 @@ function initVroom(room) { }); } }, 10000); + // Notify the frontend a new participant has joined + $.ajax({ + data: { + action: 'join', + room: roomName, + name: (peers.local.hasName) ? peers.local.displayName : '' + }, + error: function(data) { + $.notify(locale.ERROR_OCCURED, 'error'); + }, + success: function(data) { + if (data.status == 'success' && data.msg){ + $.notify(data.msg, 'success'); + } + else{ + $.notify(data.msg, 'error'); + } + } + }); }); // Handle new video stream added: someone joined the room diff --git a/public/vroom.pl b/public/vroom.pl index 5ac1647..0d25439 100755 --- a/public/vroom.pl +++ b/public/vroom.pl @@ -609,19 +609,6 @@ get '/(*room)' => sub { room => $room ); } - # Send notifications - foreach my $rcpt ($self->get_notification($room)){ - $self->email( - header => [ - Subject => encode("MIME-Header", $self->l("JOIN_NOTIFICATION")), - To => $rcpt - ], - data => [ - template => 'notification', - room => $room, - ], - ); - } # Now display the room page $self->render('join', format => 'html', @@ -879,6 +866,29 @@ post '/action' => sub { } ); } + # New participant joined the room + elsif ($action eq 'join'){ + my $name = $self->param('name') || ''; + # Send notifications + foreach my $rcpt ($self->get_notification($room)){ + $self->email( + header => [ + Subject => encode("MIME-Header", $self->l("JOIN_NOTIFICATION")), + To => $rcpt + ], + data => [ + template => 'notification', + room => $room, + name => $name + ], + ); + } + return $self->render( + json => { + status => 'success' + } + ); + } }; # use the templates defined in the config diff --git a/templates/default/notification.email_html.ep b/templates/default/notification.email_html.ep index 287bc84..55394b2 100644 --- a/templates/default/notification.email_html.ep +++ b/templates/default/notification.email_html.ep @@ -5,6 +5,11 @@

<%=l 'SOMEONE_JOINED_A_ROOM' %>

+<% if ($name && $name ne ''){ %> +

+ <%=l 'PARTICIPANT_NAME' %>: <%= $name %> +

+<% } %>

<%=l 'WHEN_YOU_ARE_READY' %>

diff --git a/templates/default/notification.email_text.ep b/templates/default/notification.email_text.ep index b215b06..03153d7 100644 --- a/templates/default/notification.email_text.ep +++ b/templates/default/notification.email_text.ep @@ -4,6 +4,10 @@ %> <%==l 'SOMEONE_JOINED_A_ROOM' %> +<% if ($name && $name ne ''){ %> +<%=l 'PARTICIPANT_NAME' %>: <%== $name %> +<% } %> + <%=l 'WHEN_YOU_ARE_READY' %> <%== $url . $room %>