Attempt to fix duplicated user tabs

This commit is contained in:
2026-02-03 10:38:41 +00:00
parent c260b8b231
commit 5c76729a6b
2 changed files with 9 additions and 6 deletions

View File

@@ -11,7 +11,6 @@ import (
"github.com/diamondburned/gotk4/pkg/glib/v2"
"github.com/diamondburned/gotk4/pkg/gtk/v4"
"github.com/diamondburned/gotk4/pkg/gdkpixbuf/v2"
_ "github.com/kr/pretty"
"path/filepath"
"github.com/BurntSushi/toml"
@@ -86,6 +85,7 @@ var cancelBytes []byte
var cancelB64 string = base64.StdEncoding.EncodeToString(cancelBytes)
var clientAssets map[string]gdk.Paintabler = make(map[string]gdk.Paintabler)
var lockedJIDs map[string]bool = make(map[string]bool)
func init() {
go func() {
@@ -187,7 +187,7 @@ func main() {
Jid: loadedConfig.Username + "/lambda." + str,
Credential: xmpp.Password(loadedConfig.Password),
Insecure: loadedConfig.Insecure,
StreamLogger: os.Stdout,
// StreamLogger: os.Stdout,
}
router := xmpp.NewRouter()
@@ -317,7 +317,6 @@ func main() {
} else {
typed_unit.Members.Delete(ocu.ID)
glib.IdleAdd(func() {
//uiQueue <- func() {
b := gtk.NewLabel("")
ba, ok := generatePresenceWidget(p).(*gtk.Label)
if ok {
@@ -333,7 +332,6 @@ func main() {
} else {
fmt.Println("Got message when the tab does not exist!")
}
//}
})
}
@@ -346,7 +344,7 @@ func main() {
_, mok := mucmembers.Load(user)
if !ok && !mok { // FIXME: The initial muc presence gets picked up from this check
ok := createTab(user, false)
if ok {
if ok && !lockedJIDs[user]{
userdevices.Store(user, userUnit{})
b := gtk.NewButtonWithLabel(user)
@@ -374,6 +372,7 @@ func main() {
}
userdevices.Store(user, typed_unit)
lockedJIDs[user] = true
}
time.Sleep(1 * time.Second)
})