Rest in peace Dolly Patron
This commit is contained in:
+27
@@ -2,6 +2,8 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"gosrc.io/xmpp/stanza"
|
||||
"sort"
|
||||
"sync"
|
||||
)
|
||||
@@ -23,3 +25,28 @@ func rangeOrdered(m *sync.Map, fn func(k, v any) bool) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func getPresenceFromJIDMuc(jid *stanza.Jid) (*stanza.Presence, error) {
|
||||
mo, ok := mucmembers.Load(jid.Bare())
|
||||
if !ok {
|
||||
return nil, errors.New("tab is not present in mucmembers")
|
||||
}
|
||||
|
||||
mm, ok := mo.(mucUnit)
|
||||
if !ok {
|
||||
return nil, errors.New("mucUnit is nil")
|
||||
}
|
||||
|
||||
mmm := mm.Members
|
||||
mmmm, ok := mmm.Load(jid.Resource)
|
||||
if !ok {
|
||||
return nil, errors.New("user not in room")
|
||||
}
|
||||
|
||||
pres, ok := mmmm.(stanza.Presence)
|
||||
if !ok {
|
||||
return nil, errors.New("presence is nil")
|
||||
}
|
||||
|
||||
return &pres, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user