Add experimental functionality to join bookmarks

This commit is contained in:
2025-09-01 20:05:06 +01:00
parent 21564cc70e
commit 853bed70e7

14
main.go
View File

@@ -29,7 +29,6 @@ import (
_ "mellium.im/xmpp/disco"
"mellium.im/xmpp/jid"
"mellium.im/xmpp/muc"
"mellium.im/xmpp/stanza"
_ "mellium.im/xmpp/stanza"
oasisSdk "pain.agency/oasis-sdk"
// gui - optional
@@ -679,13 +678,16 @@ func main() {
url, uerr := url.Parse(strings.Split(text, " ")[0])
if uerr == nil && strings.HasPrefix(strings.Split(text, " ")[0], "https://") {
//err = client.SendImage(jid.MustParse(activeMucJid).Bare(), text, url.String(), &text)
dialog.ShowConfirm("Confirm", "Do you want to embed this link into your message?", func(b bool) {
if b {
err = client.SendSingleFileMessage(jid.MustParse(activeMucJid).Bare(), url.String(), nil)
if err != nil {
dialog.ShowError(err, w)
}
return
}
}, w)
}
err = client.SendText(jid.MustParse(activeMucJid).Bare(), text)
if err != nil {
@@ -950,6 +952,7 @@ func main() {
})
/*
servDisc := fyne.NewMenuItem("Disco features", func() {
//var search jid.JID
dialog.ShowEntryDialog("Disco features", "JID: ", func(s string) { // TODO: replace with undeprecated widgetd
@@ -967,7 +970,7 @@ func main() {
type='get'
id='vc2'>
<vCard xmlns='vcard-temp'/>
</iq>`
</iq>`
var stan stanza.IQ
xml.Unmarshal([]byte(txt), &stan)
if err != nil {
@@ -1004,11 +1007,11 @@ func main() {
fyne.Do(func() {d.Hide()})
myBox.Objects = append(myBox.Objects, widget.NewLabel(string(bytes)))
dialog.ShowCustom("Service discovery", "cancel", myBox, w)
*/
}()
}, w)
})
*/
savedata := fyne.NewMenuItem("DEBUG: Save tab data to disk", func() {
d := []ChatTab{}
@@ -1024,6 +1027,7 @@ func main() {
os.WriteFile("text.xml", b, os.ModeAppend)
})
menu_help := fyne.NewMenu("π", mit, reconnect, savedata, fyne.NewMenuItem("Join rooms in bookmarks", func() {
// FIXME: Race condition
client.FetchBookmarks()
rooms := client.BookmarkCache()
for _, v := range rooms {
@@ -1046,7 +1050,7 @@ func main() {
}
}))
menu_changeroom := fyne.NewMenu("Α", mic, servDisc, beginADM, joinARoom, leaveRoom)
menu_changeroom := fyne.NewMenu("Α", mic, beginADM, joinARoom, leaveRoom)
menu_configureview := fyne.NewMenu("Β", mia, mis, jtt, jtb)
hafjag := fyne.NewMenuItem("Hafjag", func() {
entry.Text = "Hafjag"