Suppress nickname presences for MUCs better

This commit is contained in:
Bohdan Horbeshko 2023-09-18 00:02:49 -04:00
parent f99f4f6acc
commit 4249a8bf41
2 changed files with 9 additions and 1 deletions

View file

@ -315,10 +315,14 @@ func (c *Client) updateMessageSendFailed(update *client.UpdateMessageSendFailed)
// chat title changed // chat title changed
func (c *Client) updateChatTitle(update *client.UpdateChatTitle) { func (c *Client) updateChatTitle(update *client.UpdateChatTitle) {
chat, user, _ := c.GetContactByID(update.ChatId, nil)
if c.Session.MUC && c.IsGroup(chat) {
return
}
gateway.SetNickname(c.jid, strconv.FormatInt(update.ChatId, 10), update.Title, c.xmpp) gateway.SetNickname(c.jid, strconv.FormatInt(update.ChatId, 10), update.Title, c.xmpp)
// set also the status (for group chats only) // set also the status (for group chats only)
chat, user, _ := c.GetContactByID(update.ChatId, nil)
if user == nil { if user == nil {
c.ProcessStatusUpdate(update.ChatId, update.Title, "chat", gateway.SPImmed(true)) c.ProcessStatusUpdate(update.ChatId, update.Title, "chat", gateway.SPImmed(true))
} }

View file

@ -1410,6 +1410,10 @@ func (c *Client) subscribeToID(id int64, chat *client.Chat) {
chat, _, _ = c.GetContactByID(id, nil) chat, _, _ = c.GetContactByID(id, nil)
} }
if chat != nil { if chat != nil {
if c.Session.MUC && c.IsGroup(chat) {
return
}
args = append(args, gateway.SPNickname(chat.Title)) args = append(args, gateway.SPNickname(chat.Title))
gateway.SetNickname(c.jid, strconv.FormatInt(id, 10), chat.Title, c.xmpp) gateway.SetNickname(c.jid, strconv.FormatInt(id, 10), chat.Title, c.xmpp)