add throughput, format code, and begin to add MUC preview window

This commit is contained in:
2026-04-18 10:29:07 +01:00
parent 7416aa37e0
commit 843687ff2b
20 changed files with 165 additions and 94 deletions
+10 -10
View File
@@ -68,7 +68,7 @@ func generateMessageWidget(p stanza.Packet) gtk.Widgetter {
if ok {
b := gtk.NewBox(gtk.OrientationHorizontal, 0)
b.Append(gtk.NewLabel(fmt.Sprintf("%s is typing...", JidMustParse(m.From).Resource)))
return b
return b
}
if m.Error.Type != "" {
@@ -120,7 +120,7 @@ func generateMessageWidget(p stanza.Packet) gtk.Widgetter {
quote.ConnectClicked(func() {
lines := strings.Split(m.Body, "\n")
for i, line := range lines {
quoteline:= "> " + line
quoteline := "> " + line
lines[i] = quoteline
}
@@ -179,7 +179,7 @@ func generateMessageWidget(p stanza.Packet) gtk.Widgetter {
im.AddCSSClass("author_img")
authorBox.Append(im)
} else {
im := createIdenticon(m.From)
im := createIdenticon(m.From)
im.SetPixelSize(40)
im.AddCSSClass("author_img")
authorBox.Append(im)
@@ -260,18 +260,18 @@ func getAvatar(j, hash string) *gtk.Image { // TODO: This function probably shou
oghash := hash
p, err := ensureCache()
if err != nil {
return createIdenticon(j)
return createIdenticon(j)
}
if hash == "" {
fmt.Println("Hash is nil!")
return createIdenticon(j)
return createIdenticon(j)
}
_, ok := invalidImages[hash]
if ok {
fmt.Println("Image is invalid")
return createIdenticon(j)
return createIdenticon(j)
}
hash = filepath.Join(p, sanitizefilename.Sanitize(hash))
@@ -279,7 +279,7 @@ func getAvatar(j, hash string) *gtk.Image { // TODO: This function probably shou
_, err = os.ReadFile(hash)
if err == nil {
i := newImageFromPath(hash)
i.AddCSSClass(loadedConfig.CVD.String()+"_CVD")
i.AddCSSClass(loadedConfig.CVD.String() + "_CVD")
return i
}
@@ -305,14 +305,14 @@ func getAvatar(j, hash string) *gtk.Image { // TODO: This function probably shou
result := <-mychan
card, ok := result.Payload.(*VCard)
if !ok {
return createIdenticon(j)
return createIdenticon(j)
}
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")) {
fmt.Println("Blocking image")
invalidImages[oghash] = true
return createIdenticon(j)
return createIdenticon(j)
}
data, err := base64.StdEncoding.DecodeString(base64_data)
@@ -326,6 +326,6 @@ func getAvatar(j, hash string) *gtk.Image { // TODO: This function probably shou
}
i := newImageFromPath(hash)
i.AddCSSClass(loadedConfig.CVD.String()+"_CVD")
i.AddCSSClass(loadedConfig.CVD.String() + "_CVD")
return i
}