you need a man, with, sen-si-ti-vi-ty. a man like me
This commit is contained in:
+19
-13
@@ -7,7 +7,7 @@ import (
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
"github.com/diamondburned/gotk4/pkg/gdk/v4"
|
||||
_ "github.com/diamondburned/gotk4/pkg/glib/v2"
|
||||
"github.com/diamondburned/gotk4/pkg/glib/v2"
|
||||
"github.com/diamondburned/gotk4/pkg/gtk/v4"
|
||||
"github.com/google/uuid"
|
||||
"github.com/jasonlovesdoggo/gopen"
|
||||
@@ -290,25 +290,27 @@ func generateMessageWidget(p stanza.Packet, blocked bool) (gtk.Widgetter, bool)
|
||||
if !ok {
|
||||
can_generate = false
|
||||
}
|
||||
|
||||
im := gtk.NewImage()
|
||||
im.SetFromPaintable(clientAssetsLoad("DefaultAvatar"))
|
||||
im.SetPixelSize(40)
|
||||
im.AddCSSClass("author_img")
|
||||
// createIdenticon(m.From, false, im)
|
||||
authorBox.Append(im)
|
||||
if can_generate {
|
||||
pres := mmmm.(stanza.Presence)
|
||||
var vu VCardUpdate
|
||||
pres.Get(&vu)
|
||||
createIdenticon(m.From, false, im)
|
||||
im.SetPixelSize(40)
|
||||
im.AddCSSClass("author_img")
|
||||
authorBox.Append(im)
|
||||
|
||||
if vu.Photo != "" {
|
||||
go getAvatar(m.From, vu.Photo, im)
|
||||
}
|
||||
|
||||
} else {
|
||||
createIdenticon(m.From, false, im)
|
||||
/*
|
||||
im.SetPixelSize(40)
|
||||
im.AddCSSClass("author_img")
|
||||
authorBox.Append(im)
|
||||
*/
|
||||
}
|
||||
} else if m.Type == stanza.MessageTypeChat {
|
||||
al.SetText(al.Text() + loadedLocale["whispers"])
|
||||
@@ -329,7 +331,10 @@ func generateMessageWidget(p stanza.Packet, blocked bool) (gtk.Widgetter, bool)
|
||||
authorBox.Append(gtk.NewLabel("🎮"))
|
||||
}
|
||||
|
||||
mlabel := gtk.NewLabel(m.Body)
|
||||
body := m.Body
|
||||
body = XEPToPango(body)
|
||||
|
||||
mlabel := gtk.NewLabel("")
|
||||
if m.Body == "" {
|
||||
/*
|
||||
mlabel.SetText(loadedLocale["noBodySet"])
|
||||
@@ -337,6 +342,8 @@ func generateMessageWidget(p stanza.Packet, blocked bool) (gtk.Widgetter, bool)
|
||||
*/
|
||||
return nil, false
|
||||
}
|
||||
|
||||
mlabel.SetMarkup(body)
|
||||
mlabel.SetWrap(true)
|
||||
mlabel.SetSelectable(true)
|
||||
mlabel.SetHAlign(gtk.AlignFill)
|
||||
@@ -401,6 +408,7 @@ func generateMessageWidget(p stanza.Packet, blocked bool) (gtk.Widgetter, bool)
|
||||
|
||||
mainBox.Append(lp_box)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if loadedConfig.BlockingMode == Highlight && blocked {
|
||||
@@ -465,7 +473,7 @@ func getAvatar(j, hash string, i *gtk.Image) { // TODO: This function probably s
|
||||
|
||||
setImageFromPath(hash, i)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
iqResp, err := stanza.NewIQ(stanza.Attrs{
|
||||
Type: "get",
|
||||
@@ -510,15 +518,13 @@ func getAvatar(j, hash string, i *gtk.Image) { // TODO: This function probably s
|
||||
panic(err)
|
||||
}
|
||||
|
||||
glib.IdleAdd(func() {
|
||||
err = setImageFromPath(hash, i)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
invalidImages.Store(oghash, true)
|
||||
createIdenticon(j, false, i)
|
||||
}
|
||||
|
||||
fmt.Println("Everything is OK. There should be an avatar!")
|
||||
|
||||
i.AddCSSClass(loadedConfig.CVD.String() + "_CVD")
|
||||
// return i
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user