Format code

This commit is contained in:
2025-08-07 23:12:40 +01:00
parent 59d83cb185
commit 52e38e7e66

32
main.go
View File

@@ -54,18 +54,18 @@ type Message struct {
} }
type ChatTab struct { type ChatTab struct {
Jid jid.JID Jid jid.JID
Nick string Nick string
Messages []Message Messages []Message
isMuc bool isMuc bool
Muc muc.Channel Muc muc.Channel
UpdateSidebar bool UpdateSidebar bool
} }
type ChatTabUI struct { type ChatTabUI struct {
Internal *ChatTab Internal *ChatTab
Scroller *widget.List `xml:"-"` Scroller *widget.List `xml:"-"`
Sidebar *fyne.Container `xml:"-"` Sidebar *fyne.Container `xml:"-"`
} }
type piConfig struct { type piConfig struct {
@@ -201,8 +201,6 @@ func CreateUITab(chatJidStr string) ChatTabUI {
}, },
) )
scroller.OnSelected = func(id widget.ListItemID) { scroller.OnSelected = func(id widget.ListItemID) {
selectedId = id selectedId = id
} }
@@ -224,10 +222,10 @@ func addChatTab(isMuc bool, chatJid jid.JID, nick string) {
} }
myChatTab := ChatTab{ myChatTab := ChatTab{
Jid: chatJid, Jid: chatJid,
Nick: nick, Nick: nick,
Messages: []Message{}, Messages: []Message{},
isMuc: isMuc, isMuc: isMuc,
} }
myUITab := CreateUITab(chatJid.String()) myUITab := CreateUITab(chatJid.String())
@@ -655,7 +653,6 @@ func main() {
}, w) }, w)
}) })
jtb := fyne.NewMenuItem("jump to bottom", func() { jtb := fyne.NewMenuItem("jump to bottom", func() {
selectedScroller, ok := AppTabs.Selected().Content.(*widget.List) selectedScroller, ok := AppTabs.Selected().Content.(*widget.List)
if !ok { if !ok {
@@ -707,7 +704,7 @@ func main() {
}) })
//deb := fyne.NewMenuItem("DEBUG: Attempt to get MAM history from a user", func() { //deb := fyne.NewMenuItem("DEBUG: Attempt to get MAM history from a user", func() {
//res, err := history.Fetch(client.Ctx, history.Query{}, jid.MustParse("ringen@muc.isekai.rocks"), client.Session) //res, err := history.Fetch(client.Ctx, history.Query{}, jid.MustParse("ringen@muc.isekai.rocks"), client.Session)
//}) //})
mic := fyne.NewMenuItem("upload a file", func() { mic := fyne.NewMenuItem("upload a file", func() {
var link string var link string
@@ -790,7 +787,6 @@ func main() {
}, w) }, w)
}) })
savedata := fyne.NewMenuItem("DEBUG: Save tab data to disk", func() { savedata := fyne.NewMenuItem("DEBUG: Save tab data to disk", func() {
d := []ChatTab{} d := []ChatTab{}
for _, v := range chatTabs { for _, v := range chatTabs {
@@ -911,8 +907,6 @@ func main() {
} }
} }
tab := chatTabs[activeChatJid] tab := chatTabs[activeChatJid]
UITab := UITabs[activeChatJid] UITab := UITabs[activeChatJid]
if tab.isMuc { if tab.isMuc {