diff --git a/assets.go b/assets.go index cb14740..87c25c2 100644 --- a/assets.go +++ b/assets.go @@ -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) diff --git a/assets/information.png b/assets/information.png new file mode 100644 index 0000000..12cd1ae Binary files /dev/null and b/assets/information.png differ diff --git a/assets/jabber.png b/assets/jabber.png new file mode 100644 index 0000000..c0d11fb Binary files /dev/null and b/assets/jabber.png differ diff --git a/gtk-helpers.go b/gtk-helpers.go index bf10f5c..dfb055e 100644 --- a/gtk-helpers.go +++ b/gtk-helpers.go @@ -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") - } + } } }() diff --git a/gtk-message.go b/gtk-message.go index 62f100c..a21a73c 100644 --- a/gtk-message.go +++ b/gtk-message.go @@ -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(` - - - - Retracted - - - `, 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(` + + + + Retracted + + + `, jid.MustParse(m.From).Bare().String(), uuid.New().String(), sid.ID)) + }) + rc_box.Append(moderate) + } */ quote := gtk.NewButtonWithLabel("Quote") diff --git a/main.go b/main.go index 1df73c2..2e5e83b 100644 --- a/main.go +++ b/main.go @@ -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, } diff --git a/types.go b/types.go index 3cc1ed5..f4204d6 100644 --- a/types.go +++ b/types.go @@ -13,7 +13,7 @@ type chatTab struct { type lambdaConfig struct { Server string Username string - Resource string + Resource string Password string Insecure bool Nick string diff --git a/xmpp-attention.go b/xmpp-attention.go index 0ddbac3..298f1c7 100644 --- a/xmpp-attention.go +++ b/xmpp-attention.go @@ -5,7 +5,7 @@ import ( "gosrc.io/xmpp/stanza" ) -// Implementation of XEP-0224: Attention +// Implementation of XEP-0224: Attention type Attention struct { stanza.MsgExtension diff --git a/xmpp-carbons.go b/xmpp-carbons.go index f2695e5..f457c49 100644 --- a/xmpp-carbons.go +++ b/xmpp-carbons.go @@ -14,7 +14,6 @@ type ReceivedCarbon struct { Forwarded stanza.Forwarded } - type SentCarbon struct { stanza.MsgExtension XMLName xml.Name `xml:"urn:xmpp:carbons:2 sent"` diff --git a/xmpp-helpers.go b/xmpp-helpers.go index 1256939..24b946d 100644 --- a/xmpp-helpers.go +++ b/xmpp-helpers.go @@ -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) diff --git a/xmpp-mentions.go b/xmpp-mentions.go index 064cadd..11b4b6e 100644 --- a/xmpp-mentions.go +++ b/xmpp-mentions.go @@ -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() {