Add hat icon, change some CSS and remove all reply support

This commit is contained in:
2026-02-08 09:44:45 +00:00
parent 589101c292
commit 713cb24508
7 changed files with 118 additions and 74 deletions

34
main.go
View File

@@ -7,10 +7,10 @@ import (
"context"
"fmt"
"github.com/diamondburned/gotk4/pkg/gdk/v4"
"github.com/diamondburned/gotk4/pkg/gdkpixbuf/v2"
"github.com/diamondburned/gotk4/pkg/gio/v2"
"github.com/diamondburned/gotk4/pkg/glib/v2"
"github.com/diamondburned/gotk4/pkg/gtk/v4"
"github.com/diamondburned/gotk4/pkg/gdkpixbuf/v2"
"path/filepath"
"github.com/BurntSushi/toml"
@@ -20,10 +20,11 @@ import (
"time"
_ "embed"
"encoding/base64"
"encoding/xml"
"math/rand/v2"
"runtime"
"encoding/base64"
"github.com/kr/pretty"
)
var loadedConfig lambdaConfig
@@ -84,6 +85,10 @@ var outcastMedalB64 string = base64.StdEncoding.EncodeToString(outcastMedalBytes
var cancelBytes []byte
var cancelB64 string = base64.StdEncoding.EncodeToString(cancelBytes)
//go:embed assets/tag.png
var tagBytes []byte
var tagB64 string = base64.StdEncoding.EncodeToString(tagBytes)
var clientAssets map[string]gdk.Paintabler = make(map[string]gdk.Paintabler)
var lockedJIDs map[string]bool = make(map[string]bool)
@@ -105,7 +110,6 @@ func init() {
loader.Close()
clientAssets["DefaultAvatar"] = gdk.NewTextureForPixbuf(loader.Pixbuf())
loader = gdkpixbuf.NewPixbufLoader()
ownerMedalData, _ := base64.StdEncoding.DecodeString(ownerMedalB64)
@@ -124,6 +128,14 @@ func init() {
loader = gdkpixbuf.NewPixbufLoader()
tagData, _ := base64.StdEncoding.DecodeString(tagB64)
loader.Write(tagData)
loader.Close()
clientAssets["tag"] = gdk.NewTextureForPixbuf(loader.Pixbuf())
loader = gdkpixbuf.NewPixbufLoader()
adminMedalData, _ := base64.StdEncoding.DecodeString(adminMedalB64)
loader.Write(adminMedalData)
loader.Close()
@@ -173,7 +185,7 @@ func main() {
panic(err)
}
// Put 4 random characters at the end
// Put 4 random characters at the end
chars := "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZλ"
str := ""
for range 4 {
@@ -184,9 +196,9 @@ func main() {
TransportConfiguration: xmpp.TransportConfiguration{
Address: loadedConfig.Server,
},
Jid: loadedConfig.Username + "/lambda." + str,
Credential: xmpp.Password(loadedConfig.Password),
Insecure: loadedConfig.Insecure,
Jid: loadedConfig.Username + "/lambda." + str,
Credential: xmpp.Password(loadedConfig.Password),
Insecure: loadedConfig.Insecure,
StreamLogger: os.Stdout,
}
router := xmpp.NewRouter()
@@ -219,7 +231,6 @@ func main() {
{Var: "jabber:iq:version"},
{Var: "urn:xmpp:delegation:1"},
{Var: "http://jabber.org/protocol/muc"},
{Var: "urn:xmpp:reply:0"},
{Var: "λ"},
},
}
@@ -252,6 +263,8 @@ func main() {
return
}
pretty.Println(m)
e := stanza.PubSubEvent{}
ok = m.Get(&e)
if ok {
@@ -354,7 +367,7 @@ func main() {
_, mok := mucmembers.Load(user)
if !ok && !mok { // FIXME: The initial muc presence gets picked up from this check
ok := createTab(user, false)
if ok && !lockedJIDs[user]{
if ok && !lockedJIDs[user] {
userdevices.Store(user, userUnit{})
b := gtk.NewButtonWithLabel(user)
@@ -476,7 +489,7 @@ func activate(app *gtk.Application) {
box.Append(btn)
win := gtk.NewWindow()
win.SetTitle("Join MUC")
win.SetTitle("Join MUC")
win.SetDefaultSize(400, 1)
win.SetChild(box)
@@ -510,7 +523,6 @@ func activate(app *gtk.Application) {
the_menu.AppendSubmenu("File", fileMenu)
the_menu.AppendSubmenu("Help", helpMenu)
the_menuBar := gtk.NewPopoverMenuBarFromModel(the_menu)
app.SetMenubar(gio.NewMenu())