Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
galene
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
nexedi
galene
Commits
0ec9f92d
Commit
0ec9f92d
authored
Jan 03, 2021
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make 'clearchat' into a user message.
parent
e393819e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
15 deletions
+12
-15
rtpconn/webclient.go
rtpconn/webclient.go
+6
-2
static/galene.js
static/galene.js
+6
-2
static/protocol.js
static/protocol.js
+0
-11
No files found.
rtpconn/webclient.go
View file @
0ec9f92d
...
@@ -539,7 +539,7 @@ func gotAnswer(c *webClient, id string, sdp string) error {
...
@@ -539,7 +539,7 @@ func gotAnswer(c *webClient, id string, sdp string) error {
}
}
err
:=
down
.
pc
.
SetRemoteDescription
(
webrtc
.
SessionDescription
{
err
:=
down
.
pc
.
SetRemoteDescription
(
webrtc
.
SessionDescription
{
Type
:
webrtc
.
SDPTypeAnswer
,
Type
:
webrtc
.
SDPTypeAnswer
,
SDP
:
sdp
,
SDP
:
sdp
,
})
})
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
...
@@ -1235,7 +1235,11 @@ func handleClientMessage(c *webClient, m clientMessage) error {
...
@@ -1235,7 +1235,11 @@ func handleClientMessage(c *webClient, m clientMessage) error {
switch
m
.
Kind
{
switch
m
.
Kind
{
case
"clearchat"
:
case
"clearchat"
:
g
.
ClearChatHistory
()
g
.
ClearChatHistory
()
m
:=
clientMessage
{
Type
:
"clearchat"
}
m
:=
clientMessage
{
Type
:
"usermessage"
,
Kind
:
"clearchat"
,
Privileged
:
true
,
}
clients
:=
g
.
GetClients
(
nil
)
clients
:=
g
.
GetClients
(
nil
)
for
_
,
cc
:=
range
clients
{
for
_
,
cc
:=
range
clients
{
cc
,
ok
:=
cc
.
(
*
webClient
)
cc
,
ok
:=
cc
.
(
*
webClient
)
...
...
static/galene.js
View file @
0ec9f92d
...
@@ -1555,7 +1555,6 @@ function gotUserMessage(id, dest, username, time, privileged, kind, message) {
...
@@ -1555,7 +1555,6 @@ function gotUserMessage(id, dest, username, time, privileged, kind, message) {
console
.
error
(
`Got unprivileged message of kind
${
kind
}
`
);
console
.
error
(
`Got unprivileged message of kind
${
kind
}
`
);
break
;
break
;
case
'
mute
'
:
case
'
mute
'
:
console
.
log
(
id
,
dest
,
username
);
if
(
privileged
)
{
if
(
privileged
)
{
setLocalMute
(
true
,
true
);
setLocalMute
(
true
,
true
);
let
by
=
username
?
'
by
'
+
username
:
''
;
let
by
=
username
?
'
by
'
+
username
:
''
;
...
@@ -1564,6 +1563,12 @@ function gotUserMessage(id, dest, username, time, privileged, kind, message) {
...
@@ -1564,6 +1563,12 @@ function gotUserMessage(id, dest, username, time, privileged, kind, message) {
console
.
error
(
`Got unprivileged message of kind
${
kind
}
`
);
console
.
error
(
`Got unprivileged message of kind
${
kind
}
`
);
}
}
break
;
break
;
case
'
clearchat
'
:
if
(
privileged
)
{
clearChat
();
}
else
{
console
.
error
(
`Got unprivileged message of kind
${
kind
}
`
);
}
default
:
default
:
console
.
warn
(
`Got unknown user message
${
kind
}
`
);
console
.
warn
(
`Got unknown user message
${
kind
}
`
);
break
;
break
;
...
@@ -2319,7 +2324,6 @@ async function serverConnect() {
...
@@ -2319,7 +2324,6 @@ async function serverConnect() {
serverConnection
.
onuser
=
gotUser
;
serverConnection
.
onuser
=
gotUser
;
serverConnection
.
onjoined
=
gotJoined
;
serverConnection
.
onjoined
=
gotJoined
;
serverConnection
.
onchat
=
addToChatbox
;
serverConnection
.
onchat
=
addToChatbox
;
serverConnection
.
onclearchat
=
clearChat
;
serverConnection
.
onusermessage
=
gotUserMessage
;
serverConnection
.
onusermessage
=
gotUserMessage
;
let
url
=
`ws
${
location
.
protocol
===
'
https:
'
?
'
s
'
:
''
}
://
${
location
.
host
}
/ws`
;
let
url
=
`ws
${
location
.
protocol
===
'
https:
'
?
'
s
'
:
''
}
://
${
location
.
host
}
/ws`
;
...
...
static/protocol.js
View file @
0ec9f92d
...
@@ -161,13 +161,6 @@ function ServerConnection() {
...
@@ -161,13 +161,6 @@ function ServerConnection() {
* @type {(this: ServerConnection, id: string, dest: string, username: string, time: number, privileged: boolean, kind: string, message: unknown) => void}
* @type {(this: ServerConnection, id: string, dest: string, username: string, time: number, privileged: boolean, kind: string, message: unknown) => void}
*/
*/
this
.
onusermessage
=
null
;
this
.
onusermessage
=
null
;
/**
* onclearchat is called whenever the server requests that the chat
* be cleared.
*
* @type{(this: ServerConnection) => void}
*/
this
.
onclearchat
=
null
;
}
}
/**
/**
...
@@ -315,10 +308,6 @@ ServerConnection.prototype.connect = async function(url) {
...
@@ -315,10 +308,6 @@ ServerConnection.prototype.connect = async function(url) {
m
.
privileged
,
m
.
kind
,
m
.
value
,
m
.
privileged
,
m
.
kind
,
m
.
value
,
);
);
break
;
break
;
case
'
clearchat
'
:
if
(
sc
.
onclearchat
)
sc
.
onclearchat
.
call
(
sc
);
break
;
case
'
ping
'
:
case
'
ping
'
:
sc
.
send
({
sc
.
send
({
type
:
'
pong
'
,
type
:
'
pong
'
,
...
...
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