Attention and experimental mentions impl
This commit is contained in:
@@ -2,8 +2,6 @@ package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"crypto/sha1"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"github.com/diamondburned/gotk4/pkg/glib/v2"
|
||||
"github.com/diamondburned/gotk4/pkg/gtk/v4"
|
||||
@@ -112,11 +110,17 @@ func switchToTab(jid string, w *gtk.Window) {
|
||||
win.SetDefaultSize(400, 400)
|
||||
profile_box := gtk.NewBox(gtk.OrientationVertical, 0)
|
||||
nick := gtk.NewLabel(JidMustParse(u.From).Resource)
|
||||
ver_text := gtk.NewLabel("Getting version...")
|
||||
ver_text.AddCSSClass("visitor")
|
||||
|
||||
win.SetTitle(JidMustParse(u.From).Resource)
|
||||
nick.AddCSSClass("author")
|
||||
profile_box.Append(nick)
|
||||
profile_box.Append(gtk.NewLabel(u.From))
|
||||
profile_box.Append(ver_text)
|
||||
fr := gtk.NewLabel(u.From)
|
||||
fr.AddCSSClass("jid")
|
||||
profile_box.Append(fr)
|
||||
profile_box.Append(ver_text)
|
||||
|
||||
iqResp, err := stanza.NewIQ(stanza.Attrs{
|
||||
Type: "get",
|
||||
@@ -147,7 +151,9 @@ func switchToTab(jid string, w *gtk.Window) {
|
||||
ok = u.Get(&mu)
|
||||
if ok {
|
||||
if mu.MucUserItem.JID != "" {
|
||||
profile_box.Append(gtk.NewLabel(mu.MucUserItem.JID))
|
||||
ji := (gtk.NewLabel(mu.MucUserItem.JID))
|
||||
ji.AddCSSClass("jid")
|
||||
profile_box.Append(ji)
|
||||
}
|
||||
profile_box.Append(gtk.NewLabel("Connected with role " + mu.MucUserItem.Role))
|
||||
profile_box.Append(gtk.NewLabel("Affiliated as " + mu.MucUserItem.Affiliation))
|
||||
@@ -178,14 +184,24 @@ func switchToTab(jid string, w *gtk.Window) {
|
||||
if ok {
|
||||
idents := res.Identity
|
||||
for i, ident := range idents {
|
||||
profile_box.Append(gtk.NewLabel(fmt.Sprintf("Identity %d: Name: %s, Category: %s, Type: %s", i+1, ident.Name, ident.Category, ident.Type)))
|
||||
profile_box.Append(gtk.NewLabel(fmt.Sprintf("%d: Name: %s, Category: %s, Type: %s", i+1, ident.Name, ident.Category, ident.Type)))
|
||||
}
|
||||
|
||||
/*
|
||||
s := fmt.Sprintf("%v", res.Features)
|
||||
h := sha1.New()
|
||||
h.Write([]byte(s))
|
||||
sha1_hash := hex.EncodeToString(h.Sum(nil))
|
||||
profile_box.Append(gtk.NewLabel(fmt.Sprintf("The hash of this user's Disco features is:\n%s\nUse the disco feature to view them", sha1_hash)))
|
||||
*/
|
||||
|
||||
sw := gtk.NewScrolledWindow()
|
||||
s := ""
|
||||
for _, feature := range res.Features {
|
||||
s = s + feature.Var + "\n"
|
||||
}
|
||||
sw.SetChild(gtk.NewLabel(s))
|
||||
|
||||
profile_box.Append(sw)
|
||||
}
|
||||
}
|
||||
}()
|
||||
@@ -202,8 +218,14 @@ func switchToTab(jid string, w *gtk.Window) {
|
||||
version := ver.Version
|
||||
os := ver.OS
|
||||
|
||||
profile_box.Append(gtk.NewLabel(fmt.Sprintf("%s %s %s", name, version, os)))
|
||||
}
|
||||
ver_text.SetText(fmt.Sprintf("%s %s %s", name, version, os))
|
||||
ver_text.RemoveCSSClass("visitor")
|
||||
} else if result.Error != nil && result.Error.Type != "" {
|
||||
ver_text.SetText("Got error trying to get version")
|
||||
ver_text.SetTooltipText(result.Error.Reason + ": "+result.Error.Text)
|
||||
ver_text.RemoveCSSClass("visitor")
|
||||
ver_text.AddCSSClass("error")
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
@@ -221,18 +243,18 @@ func switchToTab(jid string, w *gtk.Window) {
|
||||
im := getAvatar(u.From, vu.Photo)
|
||||
im.SetPixelSize(80)
|
||||
im.AddCSSClass("author_img")
|
||||
profile_box.Append(im)
|
||||
profile_box.Prepend(im)
|
||||
} else {
|
||||
im := newImageFromPath("debug.png")
|
||||
im.SetPixelSize(80)
|
||||
im.AddCSSClass("author_img")
|
||||
profile_box.Append(im)
|
||||
profile_box.Prepend(im)
|
||||
}
|
||||
} else {
|
||||
im := newImageFromPath("debug.png")
|
||||
im.SetPixelSize(80)
|
||||
im.AddCSSClass("author_img")
|
||||
profile_box.Append(im)
|
||||
profile_box.Prepend(im)
|
||||
}
|
||||
}()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user