Format code

This commit is contained in:
2026-03-15 09:57:08 +00:00
parent 71e6a58fbd
commit 523722bae6
5 changed files with 39 additions and 58 deletions

View File

@@ -39,7 +39,6 @@ var outcastMedalB64 string = base64.StdEncoding.EncodeToString(outcastMedalBytes
var cancelBytes []byte
var cancelB64 string = base64.StdEncoding.EncodeToString(cancelBytes)
//go:embed assets/status_away.png
var sABytes []byte
var sAB64 string = base64.StdEncoding.EncodeToString(sABytes)
@@ -301,7 +300,6 @@ func init() {
clientAssets["status_away"] = gdk.NewTextureForPixbuf(loader.Pixbuf())
loader = gdkpixbuf.NewPixbufLoader()
sBData, _ := base64.StdEncoding.DecodeString(sBB64)
@@ -326,7 +324,6 @@ func init() {
clientAssets["status_xa"] = gdk.NewTextureForPixbuf(loader.Pixbuf())
loader = gdkpixbuf.NewPixbufLoader()
sOData, _ := base64.StdEncoding.DecodeString(sOB64)

View File

@@ -164,19 +164,19 @@ func switchToTab(jid string, w *gtk.Window) {
ok = u.Get(&mu)
if ok {
if mu.MucUserItem.JID != "" {
win := gtk.NewWindow()
win.SetDefaultSize(400, 1)
win.SetResizable(false)
win := gtk.NewWindow()
win.SetDefaultSize(400, 1)
win.SetResizable(false)
box := gtk.NewBox(gtk.OrientationVertical, 0)
box.Append(gtk.NewLabel("Set "+JidMustParse(u.From).Resource+"'s affiliation"))
box := gtk.NewBox(gtk.OrientationVertical, 0)
box.Append(gtk.NewLabel("Set " + JidMustParse(u.From).Resource + "'s affiliation"))
the_entry := gtk.NewEntry()
the_entry.SetText(mu.MucUserItem.Affiliation)
the_entry := gtk.NewEntry()
the_entry.SetText(mu.MucUserItem.Affiliation)
submit := gtk.NewButtonWithLabel("Submit")
submit.ConnectClicked(func() {
client.SendRaw(fmt.Sprintf(`
submit := gtk.NewButtonWithLabel("Submit")
submit.ConnectClicked(func() {
client.SendRaw(fmt.Sprintf(`
<iq from='%s'
id='ba1'
to='%s'
@@ -186,38 +186,38 @@ func switchToTab(jid string, w *gtk.Window) {
</query>
</iq>
`, clientroot.Session.BindJid, jid, the_entry.Text(), JidMustParse(mu.MucUserItem.JID).Bare()))
win.SetVisible(false)
})
win.SetVisible(false)
})
box.Append(the_entry)
box.Append(submit)
box.Append(the_entry)
box.Append(submit)
win.SetChild(box)
win.SetVisible(true)
}}
win.SetChild(box)
win.SetVisible(true)
}
}
})
rb.ConnectClicked(func() {
var mu MucUser
ok = u.Get(&mu)
if ok {
if mu.MucUserItem.JID != "" {
win := gtk.NewWindow()
win.SetDefaultSize(400, 1)
win.SetResizable(false)
win := gtk.NewWindow()
win.SetDefaultSize(400, 1)
win.SetResizable(false)
box := gtk.NewBox(gtk.OrientationVertical, 0)
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 := gtk.NewBox(gtk.OrientationVertical, 0)
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"))
the_entry := gtk.NewEntry()
the_entry.SetText(mu.MucUserItem.Role)
the_entry := gtk.NewEntry()
the_entry.SetText(mu.MucUserItem.Role)
submit := gtk.NewButtonWithLabel("Submit")
submit.ConnectClicked(func() {
submit := gtk.NewButtonWithLabel("Submit")
submit.ConnectClicked(func() {
client.SendRaw(fmt.Sprintf(`
client.SendRaw(fmt.Sprintf(`
<iq from='%s'
id='kick1'
to='%s'
@@ -228,14 +228,15 @@ func switchToTab(jid string, w *gtk.Window) {
</query>
</iq>
`, clientroot.Session.BindJid, jid, JidMustParse(u.From).Resource, the_entry.Text()))
})
})
box.Append(the_entry)
box.Append(submit)
box.Append(the_entry)
box.Append(submit)
win.SetChild(box)
win.SetVisible(true)
}}
win.SetChild(box)
win.SetVisible(true)
}
}
})
rc_box.Append(bb)

View File

@@ -115,23 +115,6 @@ 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)
}
*/
quote := gtk.NewButtonWithLabel("Quote")
quote.ConnectClicked(func() {
message_en.SetText("> " + m.Body + "\n")

View File

@@ -514,8 +514,8 @@ func main() {
app := gtk.NewApplication("net.sunglocto.lambda", gio.ApplicationFlagsNone)
app.ConnectActivate(func() {
go conc()
activate(app)
go conc()
activate(app)
})
if code := app.Run(os.Args); code > 0 {

View File

@@ -23,7 +23,7 @@ type lambdaConfig struct {
}
type mucUnit struct {
// key: Resource
// key: Resource
// value: last user presence
Members sync.Map
}