Format code
This commit is contained in:
@@ -39,7 +39,6 @@ var outcastMedalB64 string = base64.StdEncoding.EncodeToString(outcastMedalBytes
|
|||||||
var cancelBytes []byte
|
var cancelBytes []byte
|
||||||
var cancelB64 string = base64.StdEncoding.EncodeToString(cancelBytes)
|
var cancelB64 string = base64.StdEncoding.EncodeToString(cancelBytes)
|
||||||
|
|
||||||
|
|
||||||
//go:embed assets/status_away.png
|
//go:embed assets/status_away.png
|
||||||
var sABytes []byte
|
var sABytes []byte
|
||||||
var sAB64 string = base64.StdEncoding.EncodeToString(sABytes)
|
var sAB64 string = base64.StdEncoding.EncodeToString(sABytes)
|
||||||
@@ -301,7 +300,6 @@ func init() {
|
|||||||
|
|
||||||
clientAssets["status_away"] = gdk.NewTextureForPixbuf(loader.Pixbuf())
|
clientAssets["status_away"] = gdk.NewTextureForPixbuf(loader.Pixbuf())
|
||||||
|
|
||||||
|
|
||||||
loader = gdkpixbuf.NewPixbufLoader()
|
loader = gdkpixbuf.NewPixbufLoader()
|
||||||
|
|
||||||
sBData, _ := base64.StdEncoding.DecodeString(sBB64)
|
sBData, _ := base64.StdEncoding.DecodeString(sBB64)
|
||||||
@@ -326,7 +324,6 @@ func init() {
|
|||||||
|
|
||||||
clientAssets["status_xa"] = gdk.NewTextureForPixbuf(loader.Pixbuf())
|
clientAssets["status_xa"] = gdk.NewTextureForPixbuf(loader.Pixbuf())
|
||||||
|
|
||||||
|
|
||||||
loader = gdkpixbuf.NewPixbufLoader()
|
loader = gdkpixbuf.NewPixbufLoader()
|
||||||
|
|
||||||
sOData, _ := base64.StdEncoding.DecodeString(sOB64)
|
sOData, _ := base64.StdEncoding.DecodeString(sOB64)
|
||||||
|
|||||||
@@ -164,19 +164,19 @@ func switchToTab(jid string, w *gtk.Window) {
|
|||||||
ok = u.Get(&mu)
|
ok = u.Get(&mu)
|
||||||
if ok {
|
if ok {
|
||||||
if mu.MucUserItem.JID != "" {
|
if mu.MucUserItem.JID != "" {
|
||||||
win := gtk.NewWindow()
|
win := gtk.NewWindow()
|
||||||
win.SetDefaultSize(400, 1)
|
win.SetDefaultSize(400, 1)
|
||||||
win.SetResizable(false)
|
win.SetResizable(false)
|
||||||
|
|
||||||
box := gtk.NewBox(gtk.OrientationVertical, 0)
|
box := gtk.NewBox(gtk.OrientationVertical, 0)
|
||||||
box.Append(gtk.NewLabel("Set "+JidMustParse(u.From).Resource+"'s affiliation"))
|
box.Append(gtk.NewLabel("Set " + JidMustParse(u.From).Resource + "'s affiliation"))
|
||||||
|
|
||||||
the_entry := gtk.NewEntry()
|
the_entry := gtk.NewEntry()
|
||||||
the_entry.SetText(mu.MucUserItem.Affiliation)
|
the_entry.SetText(mu.MucUserItem.Affiliation)
|
||||||
|
|
||||||
submit := gtk.NewButtonWithLabel("Submit")
|
submit := gtk.NewButtonWithLabel("Submit")
|
||||||
submit.ConnectClicked(func() {
|
submit.ConnectClicked(func() {
|
||||||
client.SendRaw(fmt.Sprintf(`
|
client.SendRaw(fmt.Sprintf(`
|
||||||
<iq from='%s'
|
<iq from='%s'
|
||||||
id='ba1'
|
id='ba1'
|
||||||
to='%s'
|
to='%s'
|
||||||
@@ -186,38 +186,38 @@ func switchToTab(jid string, w *gtk.Window) {
|
|||||||
</query>
|
</query>
|
||||||
</iq>
|
</iq>
|
||||||
`, clientroot.Session.BindJid, jid, the_entry.Text(), JidMustParse(mu.MucUserItem.JID).Bare()))
|
`, clientroot.Session.BindJid, jid, the_entry.Text(), JidMustParse(mu.MucUserItem.JID).Bare()))
|
||||||
win.SetVisible(false)
|
win.SetVisible(false)
|
||||||
})
|
})
|
||||||
|
|
||||||
box.Append(the_entry)
|
box.Append(the_entry)
|
||||||
box.Append(submit)
|
box.Append(submit)
|
||||||
|
|
||||||
win.SetChild(box)
|
win.SetChild(box)
|
||||||
win.SetVisible(true)
|
win.SetVisible(true)
|
||||||
}}
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
rb.ConnectClicked(func() {
|
rb.ConnectClicked(func() {
|
||||||
var mu MucUser
|
var mu MucUser
|
||||||
ok = u.Get(&mu)
|
ok = u.Get(&mu)
|
||||||
if ok {
|
if ok {
|
||||||
if mu.MucUserItem.JID != "" {
|
if mu.MucUserItem.JID != "" {
|
||||||
win := gtk.NewWindow()
|
win := gtk.NewWindow()
|
||||||
win.SetDefaultSize(400, 1)
|
win.SetDefaultSize(400, 1)
|
||||||
win.SetResizable(false)
|
win.SetResizable(false)
|
||||||
|
|
||||||
box := gtk.NewBox(gtk.OrientationVertical, 0)
|
box := gtk.NewBox(gtk.OrientationVertical, 0)
|
||||||
box.Append(gtk.NewLabel("Set "+JidMustParse(u.From).Resource+"'s role"))
|
box.Append(gtk.NewLabel("Set " + JidMustParse(u.From).Resource + "'s role"))
|
||||||
box.Append(gtk.NewLabel("Important: if you want this to be permanent, set their affiliation instead"))
|
box.Append(gtk.NewLabel("Important: if you want this to be permanent, set their affiliation instead"))
|
||||||
|
|
||||||
the_entry := gtk.NewEntry()
|
the_entry := gtk.NewEntry()
|
||||||
the_entry.SetText(mu.MucUserItem.Role)
|
the_entry.SetText(mu.MucUserItem.Role)
|
||||||
|
|
||||||
submit := gtk.NewButtonWithLabel("Submit")
|
submit := gtk.NewButtonWithLabel("Submit")
|
||||||
submit.ConnectClicked(func() {
|
submit.ConnectClicked(func() {
|
||||||
|
|
||||||
client.SendRaw(fmt.Sprintf(`
|
client.SendRaw(fmt.Sprintf(`
|
||||||
<iq from='%s'
|
<iq from='%s'
|
||||||
id='kick1'
|
id='kick1'
|
||||||
to='%s'
|
to='%s'
|
||||||
@@ -228,14 +228,15 @@ func switchToTab(jid string, w *gtk.Window) {
|
|||||||
</query>
|
</query>
|
||||||
</iq>
|
</iq>
|
||||||
`, clientroot.Session.BindJid, jid, JidMustParse(u.From).Resource, the_entry.Text()))
|
`, clientroot.Session.BindJid, jid, JidMustParse(u.From).Resource, the_entry.Text()))
|
||||||
})
|
})
|
||||||
|
|
||||||
box.Append(the_entry)
|
box.Append(the_entry)
|
||||||
box.Append(submit)
|
box.Append(submit)
|
||||||
|
|
||||||
win.SetChild(box)
|
win.SetChild(box)
|
||||||
win.SetVisible(true)
|
win.SetVisible(true)
|
||||||
}}
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
rc_box.Append(bb)
|
rc_box.Append(bb)
|
||||||
|
|||||||
@@ -115,23 +115,6 @@ func generateMessageWidget(p stanza.Packet) gtk.Widgetter {
|
|||||||
|
|
||||||
rc_box.Append(reactions)
|
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)
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
quote := gtk.NewButtonWithLabel("Quote")
|
quote := gtk.NewButtonWithLabel("Quote")
|
||||||
quote.ConnectClicked(func() {
|
quote.ConnectClicked(func() {
|
||||||
message_en.SetText("> " + m.Body + "\n")
|
message_en.SetText("> " + m.Body + "\n")
|
||||||
|
|||||||
4
main.go
4
main.go
@@ -514,8 +514,8 @@ func main() {
|
|||||||
|
|
||||||
app := gtk.NewApplication("net.sunglocto.lambda", gio.ApplicationFlagsNone)
|
app := gtk.NewApplication("net.sunglocto.lambda", gio.ApplicationFlagsNone)
|
||||||
app.ConnectActivate(func() {
|
app.ConnectActivate(func() {
|
||||||
go conc()
|
go conc()
|
||||||
activate(app)
|
activate(app)
|
||||||
})
|
})
|
||||||
|
|
||||||
if code := app.Run(os.Args); code > 0 {
|
if code := app.Run(os.Args); code > 0 {
|
||||||
|
|||||||
Reference in New Issue
Block a user