Merge branch 'master' into muc

This commit is contained in:
Bohdan Horbeshko 2025-09-13 17:03:41 -04:00
commit 60634ff4ea

View file

@ -7,6 +7,7 @@ import (
"sort"
"strconv"
"strings"
"sync"
"time"
"dev.narayana.im/narayana/telegabber/persistence"
@ -28,6 +29,10 @@ const (
const MUC_DEFAULT_HISTORY_LIMIT int32 = 20
// kludge for client resuming after the transport restart (by full jids)
var probeFired = make(map[string]bool)
var probeFiredLock = sync.Mutex{}
func logPacketType(p stanza.Packet) {
log.Warnf("Ignoring packet: %T\n", p)
}
@ -549,6 +554,13 @@ func handlePresence(s xmpp.Sender, p stanza.Presence) {
if err != nil {
log.Error(errors.Wrap(err, "TDlib connection failure"))
} else {
var probeFiredForFrom bool
probeFiredLock.Lock()
_, probeFiredForFrom = probeFired[p.From]
probeFired[p.From] = true
probeFiredLock.Unlock()
if p.Type != "probe" || !probeFiredForFrom {
for status := range session.StatusesRange() {
show, description, typ := status.Destruct()
newArgs := []args.V{
@ -567,6 +579,7 @@ func handlePresence(s xmpp.Sender, p stanza.Presence) {
probeClientFeatures(p.From, component)
session.UpdateChatNicknames()
}
}
}()
}
}