mirror of
https://github.com/screego/server.git
synced 2026-04-22 23:47:03 +08:00
31 lines
483 B
Go
31 lines
483 B
Go
package ws
|
|
|
|
import (
|
|
"fmt"
|
|
)
|
|
|
|
func init() {
|
|
register("stopshare", func() Event {
|
|
return &StopShare{}
|
|
})
|
|
}
|
|
|
|
type StopShare struct {
|
|
}
|
|
|
|
func (e *StopShare) Execute(rooms *Rooms, current ClientInfo) error {
|
|
if current.RoomID == "" {
|
|
return fmt.Errorf("not in a room")
|
|
}
|
|
|
|
room, ok := rooms.Rooms[current.RoomID]
|
|
if !ok {
|
|
return fmt.Errorf("room with id %s does not exist", current.RoomID)
|
|
}
|
|
|
|
room.Users[current.ID].Sharing = false
|
|
|
|
room.notifyInfoChanged()
|
|
return nil
|
|
}
|