attempt to fix presence
This commit is contained in:
12
main.go
12
main.go
@@ -13,6 +13,9 @@ import (
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
_ "embed"
|
||||
_ "image/png"
|
||||
_ "image/jpeg"
|
||||
|
||||
// gui - required
|
||||
"fyne.io/fyne/v2"
|
||||
@@ -33,11 +36,15 @@ import (
|
||||
"mellium.im/xmpp/bookmarks"
|
||||
"mellium.im/xmpp/jid"
|
||||
"mellium.im/xmpp/muc"
|
||||
"mellium.im/xmpp/stanza"
|
||||
"mellium.im/xmpp/pubsub"
|
||||
oasisSdk "github.com/sunglocto/oasis-sdk"
|
||||
// TODO: integrated theme switcher
|
||||
)
|
||||
|
||||
//go:embed pi.png
|
||||
var iconBytes []byte
|
||||
|
||||
var version string = "3.1i"
|
||||
var statBar widget.Label
|
||||
var chatInfo fyne.Container
|
||||
@@ -444,7 +451,9 @@ func dropToSignInPage(reason string) {
|
||||
func main() {
|
||||
muc.Since(time.Now())
|
||||
config = piConfig{}
|
||||
res := fyne.NewStaticResource("image", iconBytes)
|
||||
a = app.NewWithID("pi-im")
|
||||
a.SetIcon(res)
|
||||
reader, err := a.Storage().Open("pi.xml")
|
||||
if err != nil {
|
||||
dropToSignInPage(err.Error())
|
||||
@@ -693,7 +702,7 @@ func main() {
|
||||
})
|
||||
|
||||
client.SetPresenceHandler(func(client *oasisSdk.XmppClient, from jid.JID, p oasisSdk.UserPresence) {
|
||||
log.Println(p.Type)
|
||||
fmt.Println(p.Header.Type == stanza.UnavailablePresence)
|
||||
bareAcc := from.Bare()
|
||||
tab, ok := chatTabs[bareAcc.String()]
|
||||
if !ok {
|
||||
@@ -703,6 +712,7 @@ func main() {
|
||||
}
|
||||
|
||||
if tab.isMuc {
|
||||
fmt.Println(p.Type)
|
||||
tab.Members[from.String()] = p
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user