forked from sunglocto/lambda
remove some occurences of mellium jid lib and try to add experimental affiliation displays
This commit is contained in:
42
main.go
42
main.go
@@ -10,7 +10,7 @@ import (
|
||||
"github.com/diamondburned/gotk4/pkg/gio/v2"
|
||||
"github.com/diamondburned/gotk4/pkg/glib/v2"
|
||||
"github.com/diamondburned/gotk4/pkg/gtk/v4"
|
||||
"github.com/kr/pretty"
|
||||
_ "github.com/kr/pretty"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/BurntSushi/toml"
|
||||
@@ -67,7 +67,6 @@ func init() {
|
||||
}()
|
||||
}
|
||||
|
||||
|
||||
func main() {
|
||||
p, err := ensureConfig()
|
||||
if err != nil {
|
||||
@@ -97,10 +96,10 @@ func main() {
|
||||
TransportConfiguration: xmpp.TransportConfiguration{
|
||||
Address: loadedConfig.Server,
|
||||
},
|
||||
Jid: loadedConfig.Username + "/lambda."+str,
|
||||
Credential: xmpp.Password(loadedConfig.Password),
|
||||
Insecure: loadedConfig.Insecure,
|
||||
// StreamLogger: os.Stdout,
|
||||
Jid: loadedConfig.Username + "/lambda." + str,
|
||||
Credential: xmpp.Password(loadedConfig.Password),
|
||||
Insecure: loadedConfig.Insecure,
|
||||
StreamLogger: os.Stdout,
|
||||
}
|
||||
router := xmpp.NewRouter()
|
||||
|
||||
@@ -165,10 +164,11 @@ func main() {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
if m.Body == "" {
|
||||
return
|
||||
}
|
||||
if m.Body == "" {
|
||||
return
|
||||
}
|
||||
*/
|
||||
|
||||
originator := jid.MustParse(m.From).Bare().String()
|
||||
@@ -200,8 +200,6 @@ func main() {
|
||||
return
|
||||
}
|
||||
|
||||
pretty.Println(presence)
|
||||
|
||||
if presence.Error != *new(stanza.Err) {
|
||||
return
|
||||
}
|
||||
@@ -213,7 +211,8 @@ func main() {
|
||||
|
||||
if ok { // This is a presence stanza from a user in a MUC
|
||||
presence.Get(&ocu)
|
||||
muc := jid.MustParse(presence.From).Bare().String()
|
||||
from, _ := stanza.NewJid(presence.From)
|
||||
muc := from.Bare()
|
||||
_, ok = mucmembers.Load(muc)
|
||||
if !ok {
|
||||
mucmembers.Store(muc, mucUnit{})
|
||||
@@ -259,20 +258,21 @@ func main() {
|
||||
_, ok := userdevices.Load(user)
|
||||
_, mok := mucmembers.Load(user)
|
||||
if !ok && !mok { // FIXME: The initial muc presence gets picked up from this check
|
||||
userdevices.Store(user, userUnit{})
|
||||
createTab(user, false)
|
||||
ok := createTab(user, false)
|
||||
if ok {
|
||||
userdevices.Store(user, userUnit{})
|
||||
|
||||
b := gtk.NewButtonWithLabel(user)
|
||||
b.ConnectClicked(func() {
|
||||
b.AddCSSClass("accent")
|
||||
switchToTab(user, &window.Window)
|
||||
})
|
||||
menu.Append(b)
|
||||
b := gtk.NewButtonWithLabel(user)
|
||||
b.ConnectClicked(func() {
|
||||
b.AddCSSClass("accent")
|
||||
switchToTab(user, &window.Window)
|
||||
})
|
||||
menu.Append(b)
|
||||
}
|
||||
}
|
||||
|
||||
unit, ok := userdevices.Load(user)
|
||||
if !ok {
|
||||
fmt.Println("Could not load user presence even after recreating it! Something weird is going on!")
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user