format code + make showing avatars in member lists optional

This commit is contained in:
2026-05-31 16:44:04 +01:00
parent 9ad48ff310
commit 1597f99eef
5 changed files with 32 additions and 29 deletions
+1 -1
View File
@@ -5,6 +5,7 @@ package main
import ( import (
"crypto/sha256" "crypto/sha256"
"errors"
"fmt" "fmt"
"github.com/diamondburned/gotk4/pkg/gdk/v4" "github.com/diamondburned/gotk4/pkg/gdk/v4"
"github.com/diamondburned/gotk4/pkg/gtk/v4" "github.com/diamondburned/gotk4/pkg/gtk/v4"
@@ -14,7 +15,6 @@ import (
"os" "os"
"path/filepath" "path/filepath"
"sync" "sync"
"errors"
) )
// global or app-level map/cache // global or app-level map/cache
+16 -14
View File
@@ -196,7 +196,7 @@ func switchToTab(jid string, w *gtk.Window) {
} }
} }
status := gtk.NewImageFromPaintable(clientAssetsLoad("status_"+string(u.Show))) status := gtk.NewImageFromPaintable(clientAssetsLoad("status_" + string(u.Show)))
status.SetTooltipText(string(u.Show)) status.SetTooltipText(string(u.Show))
status.SetHAlign(gtk.AlignEnd) status.SetHAlign(gtk.AlignEnd)
@@ -217,21 +217,23 @@ func switchToTab(jid string, w *gtk.Window) {
medal.SetHExpand(true) medal.SetHExpand(true)
userbox.Append(medal) userbox.Append(medal)
default_av := createIdenticon(u.From, false) if loadedConfig.ShowAvatarsInMemberList {
userbox.Prepend(default_av) default_av := createIdenticon(u.From, false)
var vcu VCardUpdate userbox.Prepend(default_av)
ok = u.Get(&vcu) var vcu VCardUpdate
if ok { ok = u.Get(&vcu)
photo := vcu.Photo if ok {
go func() { photo := vcu.Photo
new_im := getAvatar(u.From, photo) go func() {
new_im := getAvatar(u.From, photo)
glib.IdleAdd(func() { glib.IdleAdd(func() {
userbox.Remove(default_av) userbox.Remove(default_av)
userbox.Prepend(new_im) userbox.Prepend(new_im)
}) })
}() }()
}
} }
gesture := gtk.NewGestureClick() gesture := gtk.NewGestureClick()
+1
View File
@@ -93,6 +93,7 @@ func dropToSignInPage(err error) {
conf.Insecure = insecure_check.Active() conf.Insecure = insecure_check.Active()
conf.JoinBookmarks = true conf.JoinBookmarks = true
conf.Resource = randomClientResource() conf.Resource = randomClientResource()
conf.ShowAvatarsInMemberList = true
var b bytes.Buffer var b bytes.Buffer
e := toml.NewEncoder(&b) e := toml.NewEncoder(&b)
-1
View File
@@ -76,7 +76,6 @@ var userdevices sync.Map
var pingTimes = [][]float64{} var pingTimes = [][]float64{}
var xmlLog *os.File var xmlLog *os.File
func init() { func init() {
+14 -13
View File
@@ -16,19 +16,20 @@ type chatTab struct {
} }
type lambdaConfig struct { type lambdaConfig struct {
Server string Server string
Username string Username string
Resource string Resource string
Password string Password string
Insecure bool Insecure bool
Nick string Nick string
JoinBookmarks bool JoinBookmarks bool
CVD color.CVD CVD color.CVD
Identicons bool Identicons bool
Debug bool Debug bool
ShowPresenceUpdates bool ShowPresenceUpdates bool
CompactMode bool CompactMode bool
CustomNicks map[string]string ShowAvatarsInMemberList bool
CustomNicks map[string]string
} }
type mucUnit struct { type mucUnit struct {