format code & add additional assets

This commit is contained in:
2026-03-10 16:48:10 +00:00
parent 77e4e444d4
commit 7a201808e3
11 changed files with 37 additions and 41 deletions

View File

@@ -1,10 +1,10 @@
package main
import (
"encoding/base64"
_ "embed"
"github.com/diamondburned/gotk4/pkg/gdkpixbuf/v2"
"encoding/base64"
"github.com/diamondburned/gotk4/pkg/gdk/v4"
"github.com/diamondburned/gotk4/pkg/gdkpixbuf/v2"
)
//go:embed debug.png
@@ -87,7 +87,6 @@ var connectB64 string = base64.StdEncoding.EncodeToString(connectBytes)
var commentBytes []byte
var commentB64 string = base64.StdEncoding.EncodeToString(commentBytes)
//go:embed assets/information.png
var informationBytes []byte
var informationB64 string = base64.StdEncoding.EncodeToString(informationBytes)
@@ -245,7 +244,6 @@ func init() {
clientAssets["connect"] = gdk.NewTextureForPixbuf(loader.Pixbuf())
loader = gdkpixbuf.NewPixbufLoader()
commentData, _ := base64.StdEncoding.DecodeString(commentB64)
@@ -254,7 +252,6 @@ func init() {
clientAssets["comment"] = gdk.NewTextureForPixbuf(loader.Pixbuf())
loader = gdkpixbuf.NewPixbufLoader()
informationData, _ := base64.StdEncoding.DecodeString(informationB64)

BIN
assets/information.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 778 B

BIN
assets/jabber.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 730 B

View File

@@ -188,10 +188,10 @@ func switchToTab(jid string, w *gtk.Window) {
}
/*
s := fmt.Sprintf("%v", res.Features)
h := sha1.New()
h.Write([]byte(s))
sha1_hash := hex.EncodeToString(h.Sum(nil))
s := fmt.Sprintf("%v", res.Features)
h := sha1.New()
h.Write([]byte(s))
sha1_hash := hex.EncodeToString(h.Sum(nil))
*/
sw := gtk.NewScrolledWindow()
@@ -222,10 +222,10 @@ func switchToTab(jid string, w *gtk.Window) {
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.SetTooltipText(result.Error.Reason + ": " + result.Error.Text)
ver_text.RemoveCSSClass("visitor")
ver_text.AddCSSClass("error")
}
}
}
}()

View File

@@ -116,20 +116,20 @@ func generateMessageWidget(p stanza.Packet) gtk.Widgetter {
rc_box.Append(reactions)
/*
if m.Type == stanza.MessageTypeGroupchat {
moderate := gtk.NewButtonWithLabel("Moderate") // TODO: Implement proper support for moderations via extension
moderate.ConnectClicked(func() {
client.SendRaw(fmt.Sprintf(`
<iq type='set' to='%s' id='%s'>
<moderate id='%s' xmlns='urn:xmpp:message-moderate:1'>
<retract xmlns='urn:xmpp-message-retract:1'/>
<reason>Retracted</reason>
</moderate>
</iq>
`, jid.MustParse(m.From).Bare().String(), uuid.New().String(), sid.ID))
})
rc_box.Append(moderate)
}
if m.Type == stanza.MessageTypeGroupchat {
moderate := gtk.NewButtonWithLabel("Moderate") // TODO: Implement proper support for moderations via extension
moderate.ConnectClicked(func() {
client.SendRaw(fmt.Sprintf(`
<iq type='set' to='%s' id='%s'>
<moderate id='%s' xmlns='urn:xmpp:message-moderate:1'>
<retract xmlns='urn:xmpp-message-retract:1'/>
<reason>Retracted</reason>
</moderate>
</iq>
`, jid.MustParse(m.From).Bare().String(), uuid.New().String(), sid.ID))
})
rc_box.Append(moderate)
}
*/
quote := gtk.NewButtonWithLabel("Quote")

View File

@@ -25,8 +25,8 @@ import (
_ "embed"
"encoding/xml"
"github.com/kr/pretty"
"runtime"
"io"
"runtime"
)
var loadedConfig lambdaConfig
@@ -118,9 +118,9 @@ func main() {
return charset.NewReaderLabel(c, input)
},
},
Jid: loadedConfig.Username + "/" + loadedConfig.Resource,
Credential: xmpp.Password(loadedConfig.Password),
Insecure: loadedConfig.Insecure,
Jid: loadedConfig.Username + "/" + loadedConfig.Resource,
Credential: xmpp.Password(loadedConfig.Password),
Insecure: loadedConfig.Insecure,
// StreamLogger: os.Stdout,
StreamManagementEnable: true,
}

View File

@@ -13,7 +13,7 @@ type chatTab struct {
type lambdaConfig struct {
Server string
Username string
Resource string
Resource string
Password string
Insecure bool
Nick string

View File

@@ -5,7 +5,7 @@ import (
"gosrc.io/xmpp/stanza"
)
// Implementation of XEP-0224: Attention
// Implementation of XEP-0224: Attention
type Attention struct {
stanza.MsgExtension

View File

@@ -14,7 +14,6 @@ type ReceivedCarbon struct {
Forwarded stanza.Forwarded
}
type SentCarbon struct {
stanza.MsgExtension
XMLName xml.Name `xml:"urn:xmpp:carbons:2 sent"`

View File

@@ -15,9 +15,9 @@ func sendMessage(c xmpp.Sender, sendTo string, msgType stanza.StanzaType, body s
To: sendTo,
Type: msgType,
},
Body: body,
Subject: subject,
Thread: thread,
Body: body,
Subject: subject,
Thread: thread,
Extensions: exts,
}
err := c.Send(m)

View File

@@ -10,12 +10,12 @@ import (
type Mention struct {
stanza.MsgExtension
XMLName xml.Name `xml:"urn:xmpp:mentions:0 mention"`
Mentions string `xml:"mentions,attr,omitempty"`
URI string `xml:"uri,attr,omitempty"`
Begin int `xml:"begin,attr,omitempty"`
End int `xml:"end,attr,omitempty"`
OccupantID string `xml:"occupantid,attr,omitempty"`
XMLName xml.Name `xml:"urn:xmpp:mentions:0 mention"`
Mentions string `xml:"mentions,attr,omitempty"`
URI string `xml:"uri,attr,omitempty"`
Begin int `xml:"begin,attr,omitempty"`
End int `xml:"end,attr,omitempty"`
OccupantID string `xml:"occupantid,attr,omitempty"`
}
func init() {