format code & add additional assets
This commit is contained in:
@@ -1,10 +1,10 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/base64"
|
|
||||||
_ "embed"
|
_ "embed"
|
||||||
"github.com/diamondburned/gotk4/pkg/gdkpixbuf/v2"
|
"encoding/base64"
|
||||||
"github.com/diamondburned/gotk4/pkg/gdk/v4"
|
"github.com/diamondburned/gotk4/pkg/gdk/v4"
|
||||||
|
"github.com/diamondburned/gotk4/pkg/gdkpixbuf/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
//go:embed debug.png
|
//go:embed debug.png
|
||||||
@@ -87,7 +87,6 @@ var connectB64 string = base64.StdEncoding.EncodeToString(connectBytes)
|
|||||||
var commentBytes []byte
|
var commentBytes []byte
|
||||||
var commentB64 string = base64.StdEncoding.EncodeToString(commentBytes)
|
var commentB64 string = base64.StdEncoding.EncodeToString(commentBytes)
|
||||||
|
|
||||||
|
|
||||||
//go:embed assets/information.png
|
//go:embed assets/information.png
|
||||||
var informationBytes []byte
|
var informationBytes []byte
|
||||||
var informationB64 string = base64.StdEncoding.EncodeToString(informationBytes)
|
var informationB64 string = base64.StdEncoding.EncodeToString(informationBytes)
|
||||||
@@ -245,7 +244,6 @@ func init() {
|
|||||||
|
|
||||||
clientAssets["connect"] = gdk.NewTextureForPixbuf(loader.Pixbuf())
|
clientAssets["connect"] = gdk.NewTextureForPixbuf(loader.Pixbuf())
|
||||||
|
|
||||||
|
|
||||||
loader = gdkpixbuf.NewPixbufLoader()
|
loader = gdkpixbuf.NewPixbufLoader()
|
||||||
|
|
||||||
commentData, _ := base64.StdEncoding.DecodeString(commentB64)
|
commentData, _ := base64.StdEncoding.DecodeString(commentB64)
|
||||||
@@ -254,7 +252,6 @@ func init() {
|
|||||||
|
|
||||||
clientAssets["comment"] = gdk.NewTextureForPixbuf(loader.Pixbuf())
|
clientAssets["comment"] = gdk.NewTextureForPixbuf(loader.Pixbuf())
|
||||||
|
|
||||||
|
|
||||||
loader = gdkpixbuf.NewPixbufLoader()
|
loader = gdkpixbuf.NewPixbufLoader()
|
||||||
|
|
||||||
informationData, _ := base64.StdEncoding.DecodeString(informationB64)
|
informationData, _ := base64.StdEncoding.DecodeString(informationB64)
|
||||||
|
|||||||
BIN
assets/information.png
Normal file
BIN
assets/information.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 778 B |
BIN
assets/jabber.png
Normal file
BIN
assets/jabber.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 730 B |
@@ -188,10 +188,10 @@ func switchToTab(jid string, w *gtk.Window) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
s := fmt.Sprintf("%v", res.Features)
|
s := fmt.Sprintf("%v", res.Features)
|
||||||
h := sha1.New()
|
h := sha1.New()
|
||||||
h.Write([]byte(s))
|
h.Write([]byte(s))
|
||||||
sha1_hash := hex.EncodeToString(h.Sum(nil))
|
sha1_hash := hex.EncodeToString(h.Sum(nil))
|
||||||
*/
|
*/
|
||||||
|
|
||||||
sw := gtk.NewScrolledWindow()
|
sw := gtk.NewScrolledWindow()
|
||||||
@@ -222,10 +222,10 @@ func switchToTab(jid string, w *gtk.Window) {
|
|||||||
ver_text.RemoveCSSClass("visitor")
|
ver_text.RemoveCSSClass("visitor")
|
||||||
} else if result.Error != nil && result.Error.Type != "" {
|
} else if result.Error != nil && result.Error.Type != "" {
|
||||||
ver_text.SetText("Got error trying to get version")
|
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.RemoveCSSClass("visitor")
|
||||||
ver_text.AddCSSClass("error")
|
ver_text.AddCSSClass("error")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
|||||||
@@ -116,20 +116,20 @@ func generateMessageWidget(p stanza.Packet) gtk.Widgetter {
|
|||||||
rc_box.Append(reactions)
|
rc_box.Append(reactions)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if m.Type == stanza.MessageTypeGroupchat {
|
if m.Type == stanza.MessageTypeGroupchat {
|
||||||
moderate := gtk.NewButtonWithLabel("Moderate") // TODO: Implement proper support for moderations via extension
|
moderate := gtk.NewButtonWithLabel("Moderate") // TODO: Implement proper support for moderations via extension
|
||||||
moderate.ConnectClicked(func() {
|
moderate.ConnectClicked(func() {
|
||||||
client.SendRaw(fmt.Sprintf(`
|
client.SendRaw(fmt.Sprintf(`
|
||||||
<iq type='set' to='%s' id='%s'>
|
<iq type='set' to='%s' id='%s'>
|
||||||
<moderate id='%s' xmlns='urn:xmpp:message-moderate:1'>
|
<moderate id='%s' xmlns='urn:xmpp:message-moderate:1'>
|
||||||
<retract xmlns='urn:xmpp-message-retract:1'/>
|
<retract xmlns='urn:xmpp-message-retract:1'/>
|
||||||
<reason>Retracted</reason>
|
<reason>Retracted</reason>
|
||||||
</moderate>
|
</moderate>
|
||||||
</iq>
|
</iq>
|
||||||
`, jid.MustParse(m.From).Bare().String(), uuid.New().String(), sid.ID))
|
`, jid.MustParse(m.From).Bare().String(), uuid.New().String(), sid.ID))
|
||||||
})
|
})
|
||||||
rc_box.Append(moderate)
|
rc_box.Append(moderate)
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
quote := gtk.NewButtonWithLabel("Quote")
|
quote := gtk.NewButtonWithLabel("Quote")
|
||||||
|
|||||||
8
main.go
8
main.go
@@ -25,8 +25,8 @@ import (
|
|||||||
_ "embed"
|
_ "embed"
|
||||||
"encoding/xml"
|
"encoding/xml"
|
||||||
"github.com/kr/pretty"
|
"github.com/kr/pretty"
|
||||||
"runtime"
|
|
||||||
"io"
|
"io"
|
||||||
|
"runtime"
|
||||||
)
|
)
|
||||||
|
|
||||||
var loadedConfig lambdaConfig
|
var loadedConfig lambdaConfig
|
||||||
@@ -118,9 +118,9 @@ func main() {
|
|||||||
return charset.NewReaderLabel(c, input)
|
return charset.NewReaderLabel(c, input)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Jid: loadedConfig.Username + "/" + loadedConfig.Resource,
|
Jid: loadedConfig.Username + "/" + loadedConfig.Resource,
|
||||||
Credential: xmpp.Password(loadedConfig.Password),
|
Credential: xmpp.Password(loadedConfig.Password),
|
||||||
Insecure: loadedConfig.Insecure,
|
Insecure: loadedConfig.Insecure,
|
||||||
// StreamLogger: os.Stdout,
|
// StreamLogger: os.Stdout,
|
||||||
StreamManagementEnable: true,
|
StreamManagementEnable: true,
|
||||||
}
|
}
|
||||||
|
|||||||
2
types.go
2
types.go
@@ -13,7 +13,7 @@ type chatTab struct {
|
|||||||
type lambdaConfig struct {
|
type lambdaConfig struct {
|
||||||
Server string
|
Server string
|
||||||
Username string
|
Username string
|
||||||
Resource string
|
Resource string
|
||||||
Password string
|
Password string
|
||||||
Insecure bool
|
Insecure bool
|
||||||
Nick string
|
Nick string
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import (
|
|||||||
"gosrc.io/xmpp/stanza"
|
"gosrc.io/xmpp/stanza"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Implementation of XEP-0224: Attention
|
// Implementation of XEP-0224: Attention
|
||||||
|
|
||||||
type Attention struct {
|
type Attention struct {
|
||||||
stanza.MsgExtension
|
stanza.MsgExtension
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ type ReceivedCarbon struct {
|
|||||||
Forwarded stanza.Forwarded
|
Forwarded stanza.Forwarded
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
type SentCarbon struct {
|
type SentCarbon struct {
|
||||||
stanza.MsgExtension
|
stanza.MsgExtension
|
||||||
XMLName xml.Name `xml:"urn:xmpp:carbons:2 sent"`
|
XMLName xml.Name `xml:"urn:xmpp:carbons:2 sent"`
|
||||||
|
|||||||
@@ -15,9 +15,9 @@ func sendMessage(c xmpp.Sender, sendTo string, msgType stanza.StanzaType, body s
|
|||||||
To: sendTo,
|
To: sendTo,
|
||||||
Type: msgType,
|
Type: msgType,
|
||||||
},
|
},
|
||||||
Body: body,
|
Body: body,
|
||||||
Subject: subject,
|
Subject: subject,
|
||||||
Thread: thread,
|
Thread: thread,
|
||||||
Extensions: exts,
|
Extensions: exts,
|
||||||
}
|
}
|
||||||
err := c.Send(m)
|
err := c.Send(m)
|
||||||
|
|||||||
@@ -10,12 +10,12 @@ import (
|
|||||||
|
|
||||||
type Mention struct {
|
type Mention struct {
|
||||||
stanza.MsgExtension
|
stanza.MsgExtension
|
||||||
XMLName xml.Name `xml:"urn:xmpp:mentions:0 mention"`
|
XMLName xml.Name `xml:"urn:xmpp:mentions:0 mention"`
|
||||||
Mentions string `xml:"mentions,attr,omitempty"`
|
Mentions string `xml:"mentions,attr,omitempty"`
|
||||||
URI string `xml:"uri,attr,omitempty"`
|
URI string `xml:"uri,attr,omitempty"`
|
||||||
Begin int `xml:"begin,attr,omitempty"`
|
Begin int `xml:"begin,attr,omitempty"`
|
||||||
End int `xml:"end,attr,omitempty"`
|
End int `xml:"end,attr,omitempty"`
|
||||||
OccupantID string `xml:"occupantid,attr,omitempty"`
|
OccupantID string `xml:"occupantid,attr,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
|||||||
Reference in New Issue
Block a user