diff --git a/assets.go b/assets.go index 16cbfa9..33a0cf2 100644 --- a/assets.go +++ b/assets.go @@ -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) diff --git a/gtk-helpers.go b/gtk-helpers.go index 033ebbb..9e9838e 100644 --- a/gtk-helpers.go +++ b/gtk-helpers.go @@ -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(` `, 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(` `, 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) diff --git a/gtk-message.go b/gtk-message.go index e7b3d0d..afb43d2 100644 --- a/gtk-message.go +++ b/gtk-message.go @@ -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(` - - - - Retracted - - - `, 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") diff --git a/main.go b/main.go index b285cd5..7d6a360 100644 --- a/main.go +++ b/main.go @@ -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 { diff --git a/types.go b/types.go index 4500488..1e2e64d 100644 --- a/types.go +++ b/types.go @@ -23,7 +23,7 @@ type lambdaConfig struct { } type mucUnit struct { - // key: Resource + // key: Resource // value: last user presence Members sync.Map }