This commit is contained in:
2026-01-30 19:08:18 +00:00
parent 63ad9247bc
commit 69bee8766e
6 changed files with 55 additions and 17 deletions

View File

@@ -71,6 +71,7 @@ func generateMessageWidget(p stanza.Packet) gtk.Widgetter {
}
ocu := OccupantID{}
m.Get(&ocu)
authorBox := gtk.NewBox(gtk.OrientationHorizontal, 10)
@@ -78,10 +79,32 @@ func generateMessageWidget(p stanza.Packet) gtk.Widgetter {
// im := newImageFromPath("debug.png")
// authorBox.Append(im)
im := getAvatar(m.From, ocu.ID)
im.SetPixelSize(40)
im.AddCSSClass("author_img")
authorBox.Append(im)
mo, _ := mucmembers.Load(jid.MustParse(m.From).Bare().String())
mm := mo.(mucUnit)
mmm := mm.Members
mmmm, ok := mmm.Load(ocu.ID)
if ok {
pres := mmmm.(stanza.Presence)
var vu VCardUpdate
pres.Get(&vu)
if vu.Photo != "" {
im := getAvatar(m.From, vu.Photo)
im.SetPixelSize(40)
im.AddCSSClass("author_img")
authorBox.Append(im)
} else {
im := newImageFromPath("debug.png")
im.SetPixelSize(40)
im.AddCSSClass("author_img")
}
} else {
im := newImageFromPath("debug.png")
im.SetPixelSize(40)
im.AddCSSClass("author_img")
}
al := gtk.NewLabel(jid.MustParse(m.From).Resourcepart())
al.AddCSSClass("author")
@@ -128,6 +151,11 @@ func getAvatar(j, hash string) *gtk.Image { // TODO: This function probably shou
return newImageFromPath("debug.png")
}
if hash == "" {
fmt.Println("Hash is nil!")
return newImageFromPath("debug.png")
}
hash = filepath.Join(p, sanitizefilename.Sanitize(hash))
_, err = os.ReadFile(hash)