This commit is contained in:
Sunglocto committed 2026-05-08 06:56:51 +01:00
1 parent 9593e7c041
commit 9bbefbcea8
7 files changed
+80 -40

No files matched your search

+30 -6
View File
@@ -16,9 +16,13 @@ import (
"image"
"image/png"
xmpp_color "mellium.im/xmpp/color"
"image/color"
"strconv"
)
func init() {
}
func scrollToBottomAfterUpdate(scrolledWindow *gtk.ScrolledWindow) {
glib.IdleAdd(func() bool {
vAdj := scrolledWindow.VAdjustment()
@@ -63,10 +67,26 @@ func switchToTab(jid string, w *gtk.Window) {
if typed_tab.isMuc {
m, ok := mucmembers.Load(jid)
if !ok {
box := gtk.NewBox(gtk.OrientationVertical, 10)
failed_icon := gtk.NewImageFromPaintable(clientAssets["fail"])
failed_icon.SetPixelSize(100)
box.Append(failed_icon)
label := gtk.NewLabel("There was an error loading the members of this room. Maybe the MUC does not give user presence, it does not exist, you have been banned from it, or you have to fill a CAPTCHA to access it. Try joining the room again or check if the room exists.")
label.SetWrap(true)
box.Append(label)
memberList.SetChild(box)
return
}
ma, ok := m.(mucUnit)
if !ok {
box := gtk.NewBox(gtk.OrientationVertical, 10)
failed_icon := gtk.NewImageFromPaintable(clientAssets["fail"])
failed_icon.SetPixelSize(100)
box.Append(failed_icon)
label := gtk.NewLabel("There was an error loading the members of this room. Maybe the MUC does not give user presence, it does not exist, you have been banned from it, or you have to fill a CAPTCHA to access it. Try joining the room again or check if the room exists.")
label.SetWrap(true)
box.Append(label)
memberList.SetChild(box)
return
}
mm := ma.Members
@@ -155,7 +175,7 @@ func switchToTab(jid string, w *gtk.Window) {
medal.SetHExpand(true)
userbox.Append(medal)
default_av := createIdenticon(u.From)
default_av := createIdenticon(u.From, false)
userbox.Prepend(default_av)
var vcu VCardUpdate
ok = u.Get(&vcu)
@@ -461,13 +481,13 @@ func switchToTab(jid string, w *gtk.Window) {
im.AddCSSClass("author_img")
profile_box.Prepend(im)
} else {
im := createIdenticon(u.From)
im := createIdenticon(u.From, false)
im.SetPixelSize(80)
im.AddCSSClass("author_img")
profile_box.Prepend(im)
}
} else {
im := createIdenticon(u.From)
im := createIdenticon(u.From, false)
im.SetPixelSize(80)
im.AddCSSClass("author_img")
profile_box.Prepend(im)
@@ -529,14 +549,18 @@ func showErrorDialog(err error) {
err_win.Present()
}
func createIdenticon(word string) *gtk.Image { // This function generates an identicon
if !loadedConfig.Identicons {
func createIdenticon(word string, always_create bool) *gtk.Image { // This function generates an identicon
if !loadedConfig.Identicons && !always_create {
i := gtk.NewImageFromPaintable(clientAssets["DefaultAvatar"])
i.AddCSSClass(loadedConfig.CVD.String() + "_CVD")
return i
}
gen, _ := identicon.New("github", 5, 3)
identicon.SetBackgroundColorFunction(func([]byte, color.Color) color.Color {
return color.Transparent
})
gen, _ := identicon.New("", 5, 3)
ii, _ := gen.Draw(word)
im := ii.Image(250)