Format code, remove use of Mellium JID parser, and add indicator for messages originating from WebXDC apps

This commit is contained in:
2026-02-14 22:38:32 +00:00
parent 713cb24508
commit 29ef37e237
3 changed files with 60 additions and 10 deletions

37
main.go
View File

@@ -22,9 +22,9 @@ import (
_ "embed"
"encoding/base64"
"encoding/xml"
"github.com/kr/pretty"
"math/rand/v2"
"runtime"
"github.com/kr/pretty"
)
var loadedConfig lambdaConfig
@@ -196,9 +196,9 @@ func main() {
TransportConfiguration: xmpp.TransportConfiguration{
Address: loadedConfig.Server,
},
Jid: loadedConfig.Username + "/lambda." + str,
Credential: xmpp.Password(loadedConfig.Password),
Insecure: loadedConfig.Insecure,
Jid: loadedConfig.Username + "/lambda." + str,
Credential: xmpp.Password(loadedConfig.Password),
Insecure: loadedConfig.Insecure,
StreamLogger: os.Stdout,
}
router := xmpp.NewRouter()
@@ -282,10 +282,6 @@ func main() {
glib.IdleAdd(func() {
//uiQueue <- func() {
b := gtk.NewBox(gtk.OrientationVertical, 0)
ba, ok := generateMessageWidget(p).(*gtk.Box)
if ok {
b = ba
}
tab, ok := tabs.Load(originator)
typed_tab := tab.(*chatTab)
@@ -296,6 +292,11 @@ func main() {
} else {
fmt.Println("Got message when the tab does not exist!")
}
ba, ok := generateMessageWidget(p).(*gtk.Box)
if ok {
b.Append(ba)
}
//}
})
})
@@ -336,6 +337,26 @@ func main() {
typed_unit := unit.(mucUnit)
if presence.Type != "unavailable" {
_, ok := typed_unit.Members.Load(id)
if !ok {
glib.IdleAdd(func() {
b := gtk.NewLabel("")
ba, ok := generatePresenceWidget(p).(*gtk.Label)
if ok {
b = ba
}
tab, ok := tabs.Load(muc)
typed_tab := tab.(*chatTab)
if ok {
typed_tab.msgs.Append(b)
scrollToBottomAfterUpdate(scroller)
} else {
fmt.Println("Got message when the tab does not exist!")
}
})
}
typed_unit.Members.Store(id, presence)
} else {
typed_unit.Members.Delete(id)