Merge pull request #1083 from strukturag/getincall-interface

Add interface for method "GetInCall".
This commit is contained in:
Joachim Bauch 2025-09-29 21:41:19 +02:00 committed by GitHub
commit 7e3be8f8a4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 8 deletions

10
room.go
View file

@ -957,14 +957,8 @@ func (r *Room) NotifySessionChanged(session Session, flags SessionChangeFlag) {
if flags&SessionChangeInCall != 0 {
joinLeave := 0
if clientSession, ok := session.(*ClientSession); ok {
if clientSession.GetInCall()&FlagInCall != 0 {
joinLeave = 1
} else {
joinLeave = 2
}
} else if virtual, ok := session.(*VirtualSession); ok {
if virtual.GetInCall()&FlagInCall != 0 {
if session, ok := session.(SessionWithInCall); ok {
if session.GetInCall()&FlagInCall != 0 {
joinLeave = 1
} else {
joinLeave = 2

View file

@ -76,6 +76,10 @@ type Session interface {
SendMessage(message *ServerMessage) bool
}
type SessionWithInCall interface {
GetInCall() int
}
func parseUserData(data json.RawMessage) func() (api.StringMap, error) {
return sync.OnceValues(func() (api.StringMap, error) {
if len(data) == 0 {