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
d43a2b01
Commit
d43a2b01
authored
Dec 23, 2020
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement WallOps to send a warning to all operators.
parent
65357759
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
0 deletions
+32
-0
group/group.go
group/group.go
+18
-0
rtpconn/webclient.go
rtpconn/webclient.go
+14
-0
No files found.
group/group.go
View file @
d43a2b01
...
@@ -480,6 +480,24 @@ func (g *Group) Shutdown(message string) {
...
@@ -480,6 +480,24 @@ func (g *Group) Shutdown(message string) {
})
})
}
}
type
warner
interface
{
Warn
(
oponly
bool
,
message
string
)
error
}
func
(
g
*
Group
)
WallOps
(
message
string
)
{
clients
:=
g
.
GetClients
(
nil
)
for
_
,
c
:=
range
clients
{
w
,
ok
:=
c
.
(
warner
)
if
!
ok
{
continue
}
err
:=
w
.
Warn
(
true
,
message
)
if
err
!=
nil
{
log
.
Printf
(
"WallOps: %v"
,
err
)
}
}
}
func
FromJSTime
(
tm
int64
)
time
.
Time
{
func
FromJSTime
(
tm
int64
)
time
.
Time
{
if
tm
==
0
{
if
tm
==
0
{
return
time
.
Time
{}
return
time
.
Time
{}
...
...
rtpconn/webclient.go
View file @
d43a2b01
...
@@ -1393,6 +1393,20 @@ func clientWriter(conn *websocket.Conn, ch <-chan interface{}, done chan<- struc
...
@@ -1393,6 +1393,20 @@ func clientWriter(conn *websocket.Conn, ch <-chan interface{}, done chan<- struc
}
}
}
}
func
(
c
*
webClient
)
Warn
(
oponly
bool
,
message
string
)
error
{
if
oponly
&&
!
c
.
permissions
.
Op
{
return
nil
}
return
c
.
write
(
clientMessage
{
Type
:
"usermessage"
,
Kind
:
"warning"
,
Dest
:
c
.
id
,
Privileged
:
true
,
Value
:
&
message
,
})
}
var
ErrClientDead
=
errors
.
New
(
"client is dead"
)
var
ErrClientDead
=
errors
.
New
(
"client is dead"
)
func
(
c
*
webClient
)
action
(
m
interface
{})
error
{
func
(
c
*
webClient
)
action
(
m
interface
{})
error
{
...
...
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