Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sfu
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alain Takoudjou
sfu
Commits
aa71205f
Commit
aa71205f
authored
Nov 30, 2020
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Include username and id in group and user actions.
parent
74b3683c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
11 deletions
+18
-11
static/protocol.js
static/protocol.js
+10
-3
static/sfu.js
static/sfu.js
+8
-8
No files found.
static/protocol.js
View file @
aa71205f
...
@@ -451,15 +451,17 @@ ServerConnection.prototype.chat = function(username, kind, dest, value) {
...
@@ -451,15 +451,17 @@ ServerConnection.prototype.chat = function(username, kind, dest, value) {
/**
/**
* userAction sends a request to act on a user.
* userAction sends a request to act on a user.
*
*
* @param {string} username - The sender's username.
* @param {string} kind - One of "op", "unop", "kick", "present", "unpresent".
* @param {string} kind - One of "op", "unop", "kick", "present", "unpresent".
* @param {string} dest - The id of the user to act upon.
* @param {string} dest - The id of the user to act upon.
* @param {string} [value] - An optional user-readable message.
* @param {string} [value] - An optional user-readable message.
*/
*/
ServerConnection
.
prototype
.
userAction
=
function
(
kind
,
dest
,
value
)
{
ServerConnection
.
prototype
.
userAction
=
function
(
username
,
kind
,
dest
,
value
)
{
this
.
send
({
this
.
send
({
type
:
'
useraction
'
,
type
:
'
useraction
'
,
id
:
this
.
id
,
id
:
this
.
id
,
dest
:
dest
,
dest
:
dest
,
username
:
username
,
kind
:
kind
,
kind
:
kind
,
value
:
value
,
value
:
value
,
});
});
...
@@ -468,15 +470,17 @@ ServerConnection.prototype.userAction = function(kind, dest, value) {
...
@@ -468,15 +470,17 @@ ServerConnection.prototype.userAction = function(kind, dest, value) {
/**
/**
* userMessage sends an application-specific message to a user.
* userMessage sends an application-specific message to a user.
*
*
* @param {string} username - The sender's username.
* @param {string} kind - The kind of application-specific message.
* @param {string} kind - The kind of application-specific message.
* @param {string} dest - The id of the user to send the message to.
* @param {string} dest - The id of the user to send the message to.
* @param {string} [value] - An optional parameter.
* @param {string} [value] - An optional parameter.
*/
*/
ServerConnection
.
prototype
.
userMessage
=
function
(
kind
,
dest
,
value
)
{
ServerConnection
.
prototype
.
userMessage
=
function
(
username
,
kind
,
dest
,
value
)
{
this
.
send
({
this
.
send
({
type
:
'
usermessage
'
,
type
:
'
usermessage
'
,
id
:
this
.
id
,
id
:
this
.
id
,
dest
:
dest
,
dest
:
dest
,
username
:
username
,
kind
:
kind
,
kind
:
kind
,
value
:
value
,
value
:
value
,
});
});
...
@@ -485,14 +489,17 @@ ServerConnection.prototype.userMessage = function(kind, dest, value) {
...
@@ -485,14 +489,17 @@ ServerConnection.prototype.userMessage = function(kind, dest, value) {
/**
/**
* groupAction sends a request to act on the current group.
* groupAction sends a request to act on the current group.
*
*
* @param {string} username - The sender's username.
* @param {string} kind - One of "clearchat", "lock", "unlock", "record or
* @param {string} kind - One of "clearchat", "lock", "unlock", "record or
* "unrecord".
* "unrecord".
* @param {string} [message] - An optional user-readable message.
* @param {string} [message] - An optional user-readable message.
*/
*/
ServerConnection
.
prototype
.
groupAction
=
function
(
kind
,
message
)
{
ServerConnection
.
prototype
.
groupAction
=
function
(
username
,
kind
,
message
)
{
this
.
send
({
this
.
send
({
type
:
'
groupaction
'
,
type
:
'
groupaction
'
,
id
:
this
.
id
,
kind
:
kind
,
kind
:
kind
,
username
:
username
,
value
:
message
,
value
:
message
,
});
});
};
};
...
...
static/sfu.js
View file @
aa71205f
...
@@ -1660,7 +1660,7 @@ commands.clear = {
...
@@ -1660,7 +1660,7 @@ commands.clear = {
predicate
:
operatorPredicate
,
predicate
:
operatorPredicate
,
description
:
'
clear the chat history
'
,
description
:
'
clear the chat history
'
,
f
:
(
c
,
r
)
=>
{
f
:
(
c
,
r
)
=>
{
serverConnection
.
groupAction
(
'
clearchat
'
);
serverConnection
.
groupAction
(
getUsername
(),
'
clearchat
'
);
}
}
};
};
...
@@ -1669,7 +1669,7 @@ commands.lock = {
...
@@ -1669,7 +1669,7 @@ commands.lock = {
description
:
'
lock this group
'
,
description
:
'
lock this group
'
,
parameters
:
'
[message]
'
,
parameters
:
'
[message]
'
,
f
:
(
c
,
r
)
=>
{
f
:
(
c
,
r
)
=>
{
serverConnection
.
groupAction
(
'
lock
'
,
r
);
serverConnection
.
groupAction
(
getUsername
(),
'
lock
'
,
r
);
}
}
};
};
...
@@ -1677,7 +1677,7 @@ commands.unlock = {
...
@@ -1677,7 +1677,7 @@ commands.unlock = {
predicate
:
operatorPredicate
,
predicate
:
operatorPredicate
,
description
:
'
unlock this group, revert the effect of /lock
'
,
description
:
'
unlock this group, revert the effect of /lock
'
,
f
:
(
c
,
r
)
=>
{
f
:
(
c
,
r
)
=>
{
serverConnection
.
groupAction
(
'
unlock
'
);
serverConnection
.
groupAction
(
getUsername
(),
'
unlock
'
);
}
}
};
};
...
@@ -1685,7 +1685,7 @@ commands.record = {
...
@@ -1685,7 +1685,7 @@ commands.record = {
predicate
:
recordingPredicate
,
predicate
:
recordingPredicate
,
description
:
'
start recording
'
,
description
:
'
start recording
'
,
f
:
(
c
,
r
)
=>
{
f
:
(
c
,
r
)
=>
{
serverConnection
.
groupAction
(
'
record
'
);
serverConnection
.
groupAction
(
getUsername
(),
'
record
'
);
}
}
};
};
...
@@ -1693,7 +1693,7 @@ commands.unrecord = {
...
@@ -1693,7 +1693,7 @@ commands.unrecord = {
predicate
:
recordingPredicate
,
predicate
:
recordingPredicate
,
description
:
'
stop recording
'
,
description
:
'
stop recording
'
,
f
:
(
c
,
r
)
=>
{
f
:
(
c
,
r
)
=>
{
serverConnection
.
groupAction
(
'
unrecord
'
);
serverConnection
.
groupAction
(
getUsername
(),
'
unrecord
'
);
}
}
};
};
...
@@ -1773,7 +1773,7 @@ function userCommand(c, r) {
...
@@ -1773,7 +1773,7 @@ function userCommand(c, r) {
let
id
=
findUserId
(
p
[
0
]);
let
id
=
findUserId
(
p
[
0
]);
if
(
!
id
)
if
(
!
id
)
throw
new
Error
(
`Unknown user
${
p
[
0
]}
`
);
throw
new
Error
(
`Unknown user
${
p
[
0
]}
`
);
serverConnection
.
userAction
(
c
,
id
,
p
[
1
]);
serverConnection
.
userAction
(
getUsername
(),
c
,
id
,
p
[
1
]);
}
}
function
userMessage
(
c
,
r
)
{
function
userMessage
(
c
,
r
)
{
...
@@ -1783,7 +1783,7 @@ function userMessage(c, r) {
...
@@ -1783,7 +1783,7 @@ function userMessage(c, r) {
let
id
=
findUserId
(
p
[
0
]);
let
id
=
findUserId
(
p
[
0
]);
if
(
!
id
)
if
(
!
id
)
throw
new
Error
(
`Unknown user
${
p
[
0
]}
`
);
throw
new
Error
(
`Unknown user
${
p
[
0
]}
`
);
serverConnection
.
userMessage
(
c
,
id
,
p
[
1
]);
serverConnection
.
userMessage
(
getUsername
(),
c
,
id
,
p
[
1
]);
}
}
commands
.
kick
=
{
commands
.
kick
=
{
...
@@ -2108,11 +2108,11 @@ async function serverConnect() {
...
@@ -2108,11 +2108,11 @@ async function serverConnect() {
serverConnection
.
onchat
=
addToChatbox
;
serverConnection
.
onchat
=
addToChatbox
;
serverConnection
.
onclearchat
=
clearChat
;
serverConnection
.
onclearchat
=
clearChat
;
serverConnection
.
onusermessage
=
function
(
id
,
dest
,
username
,
time
,
priviledged
,
kind
,
message
)
{
serverConnection
.
onusermessage
=
function
(
id
,
dest
,
username
,
time
,
priviledged
,
kind
,
message
)
{
let
from
=
id
?
(
username
||
'
Anonymous
'
)
:
'
The Server
'
;
switch
(
kind
)
{
switch
(
kind
)
{
case
'
error
'
:
case
'
error
'
:
case
'
warning
'
:
case
'
warning
'
:
case
'
info
'
:
case
'
info
'
:
let
from
=
id
?
(
username
||
'
Anonymous
'
)
:
'
The Server
'
;
if
(
priviledged
)
if
(
priviledged
)
displayError
(
`
${
from
}
said:
${
message
}
`
,
kind
);
displayError
(
`
${
from
}
said:
${
message
}
`
,
kind
);
else
else
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment