add some icons and only store members by resource
This commit is contained in:
@@ -151,10 +151,10 @@ func generateMessageWidget(p stanza.Packet) gtk.Widgetter {
|
||||
ocu := OccupantID{}
|
||||
|
||||
m.Get(&ocu)
|
||||
id := ocu.ID
|
||||
if id == "" {
|
||||
id = JidMustParse(m.From).Resource
|
||||
}
|
||||
//id := ocu.ID
|
||||
// if id == "" {
|
||||
id := JidMustParse(m.From).Resource
|
||||
// }
|
||||
|
||||
authorBox := gtk.NewBox(gtk.OrientationHorizontal, 10)
|
||||
|
||||
@@ -265,9 +265,10 @@ func getVAdjustment(scrolledWindow *gtk.ScrolledWindow) *gtk.Adjustment {
|
||||
}
|
||||
|
||||
func getAvatar(j, hash string) *gtk.Image { // TODO: This function probably shouldn't be here, and should probably be in xmpp-helpers or somewhere similar.
|
||||
oghash := hash
|
||||
p, err := ensureCache()
|
||||
if err != nil {
|
||||
return gtk.NewImageFromPaintable(clientAssets["DefaultAvatar"])
|
||||
return gtk.NewImageFromPaintable(clientAssets["FailedAvatar"])
|
||||
}
|
||||
|
||||
if hash == "" {
|
||||
@@ -275,6 +276,12 @@ func getAvatar(j, hash string) *gtk.Image { // TODO: This function probably shou
|
||||
return gtk.NewImageFromPaintable(clientAssets["DefaultAvatar"])
|
||||
}
|
||||
|
||||
_, ok := invalidImages[hash]
|
||||
if ok {
|
||||
fmt.Println("Image is invalid")
|
||||
return gtk.NewImageFromPaintable(clientAssets["FailedAvatar"])
|
||||
}
|
||||
|
||||
hash = filepath.Join(p, sanitizefilename.Sanitize(hash))
|
||||
|
||||
_, err = os.ReadFile(hash)
|
||||
@@ -309,7 +316,9 @@ func getAvatar(j, hash string) *gtk.Image { // TODO: This function probably shou
|
||||
|
||||
base64_data := card.Photo.Binval
|
||||
if card.Photo.Binval == "" || ((card.Photo.Type == "image/svg+xml" || card.Photo.Type == "image/webp") && (runtime.GOOS == "windows" || runtime.GOOS == "netbsd")) {
|
||||
return gtk.NewImageFromPaintable(clientAssets["DefaultAvatar"])
|
||||
fmt.Println("Blocking image")
|
||||
invalidImages[oghash] = true
|
||||
return gtk.NewImageFromPaintable(clientAssets["FailedAvatar"])
|
||||
}
|
||||
|
||||
data, err := base64.StdEncoding.DecodeString(base64_data)
|
||||
|
||||
Reference in New Issue
Block a user