mirror of
https://dev.narayana.im/narayana/telegabber.git
synced 2026-08-05 04:07:07 +00:00
Improve detection of nickname change presences
This commit is contained in:
parent
5ec8eab64b
commit
e85b534e4f
1 changed files with 8 additions and 2 deletions
|
|
@ -689,18 +689,24 @@ func tryHandleMUCPresence(s xmpp.Sender, p stanza.Presence) {
|
||||||
|
|
||||||
switch p.Type {
|
switch p.Type {
|
||||||
case "":
|
case "":
|
||||||
handleMUCNicknameChange(component, p, session, chatId, toBare)
|
if p.Show == "" {
|
||||||
|
handleMUCNicknameChange(component, p, session, chatId, toBare, nickname)
|
||||||
|
}
|
||||||
case stanza.PresenceTypeUnavailable:
|
case stanza.PresenceTypeUnavailable:
|
||||||
handleMUCUnavailable(component, p, session, chatId, fromResource)
|
handleMUCUnavailable(component, p, session, chatId, fromResource)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func handleMUCNicknameChange(component *xmpp.Component, p stanza.Presence, session *telegram.Client, chatId int64, toBare string) {
|
func handleMUCNicknameChange(component *xmpp.Component, p stanza.Presence, session *telegram.Client, chatId int64, toBare string, newNickname string) {
|
||||||
log.Warn("🗿 Yes")
|
log.Warn("🗿 Yes")
|
||||||
|
|
||||||
from := toBare
|
from := toBare
|
||||||
nickname, ok := session.GetMyMUCNickname(chatId)
|
nickname, ok := session.GetMyMUCNickname(chatId)
|
||||||
if ok {
|
if ok {
|
||||||
|
if nickname == newNickname {
|
||||||
|
log.Warn("But whatever, it's the same")
|
||||||
|
return
|
||||||
|
}
|
||||||
from = from+"/"+nickname
|
from = from+"/"+nickname
|
||||||
}
|
}
|
||||||
reply := &stanza.Presence{
|
reply := &stanza.Presence{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue