mirror of
https://dev.narayana.im/narayana/telegabber.git
synced 2026-08-05 04:07:07 +00:00
Assure all MUC presences have affiliation/role/realJID
This commit is contained in:
parent
93dcc32480
commit
6d24823bb3
2 changed files with 13 additions and 0 deletions
|
|
@ -236,6 +236,10 @@ func (c *Client) Disconnect(resource string, quit bool) bool {
|
|||
|
||||
if c.Session.MUC {
|
||||
c.locks.mucCacheLock.Lock()
|
||||
var myJid string
|
||||
if c.me != nil {
|
||||
myJid = gateway.CHATJID(c.me.Id, true)
|
||||
}
|
||||
for chatID := range c.mucCache {
|
||||
c.sendPresence(
|
||||
gateway.SPFrom(gateway.MUCNODE(chatID)),
|
||||
|
|
@ -243,6 +247,7 @@ func (c *Client) Disconnect(resource string, quit bool) bool {
|
|||
gateway.SPType("unavailable"),
|
||||
gateway.SPMUCAffiliation("none"),
|
||||
gateway.SPMUCRole("none"),
|
||||
gateway.SPMUCJid(myJid),
|
||||
gateway.SPMUCStatusCodes([]uint16{110, 332}),
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -607,12 +607,17 @@ func (c *Client) DestroyMUC(chatId int64) error {
|
|||
for resource := range mucState.Resources {
|
||||
toResources = append(toResources, resource)
|
||||
}
|
||||
var myJid string
|
||||
if c.me != nil {
|
||||
myJid = gateway.CHATJID(c.me.Id, true)
|
||||
}
|
||||
c.sendPresence(
|
||||
gateway.SPFrom(gateway.MUCNODE(chatId)),
|
||||
gateway.SPResource(c.GetMUCNickname(0)),
|
||||
gateway.SPToResources(toResources),
|
||||
gateway.SPMUCAffiliation("none"),
|
||||
gateway.SPMUCRole("none"),
|
||||
gateway.SPMUCJid(myJid),
|
||||
gateway.SPMUCDestroy(""),
|
||||
)
|
||||
|
||||
|
|
@ -649,8 +654,10 @@ func (c *Client) sendMUCStatuses(chatID int64) {
|
|||
func (c *Client) updateMUCOccupants(mucState *MUCState, chatID int64, members []*client.ChatMember) {
|
||||
sChatId := gateway.MUCNODE(chatID)
|
||||
myNickname := "me"
|
||||
var myJid string
|
||||
if c.me != nil {
|
||||
myNickname = c.getFullName(c.me)
|
||||
myJid = gateway.CHATJID(c.me.Id, true)
|
||||
}
|
||||
myAffiliation := "member"
|
||||
myRole := "participant"
|
||||
|
|
@ -690,6 +697,7 @@ func (c *Client) updateMUCOccupants(mucState *MUCState, chatID int64, members []
|
|||
gateway.SPImmed(true),
|
||||
gateway.SPMUCAffiliation(myAffiliation),
|
||||
gateway.SPMUCRole(myRole),
|
||||
gateway.SPMUCJid(myJid),
|
||||
gateway.SPMUCStatusCodes([]uint16{100, 110, 210}),
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue