ban, kick and change role&affil menu, status icons in muc, blocking avatars that are invalid so we dont fetch them over and over again

This commit is contained in:
2026-03-15 09:55:26 +00:00
parent a7e90e4ae5
commit 71e6a58fbd
13 changed files with 256 additions and 22 deletions

31
main.go
View File

@@ -1,8 +1,8 @@
package main
import (
"strings"
"os"
"strings"
"sync"
"context"
@@ -188,8 +188,6 @@ func main() {
return
}
pretty.Println(m)
e := stanza.PubSubEvent{}
ok = m.Get(&e)
if ok {
@@ -211,6 +209,15 @@ func main() {
beeep.Notify("Attention", fmt.Sprintf("%s: %s", JidMustParse(m.From).Resource, m.Body), commentBytes) // TODO: Use localpart if DM
}
// Handle mentions
for _, ext := range m.Extensions {
mention, ok := ext.(*Mention)
if ok {
pretty.Println(mention)
}
}
sc := new(SentCarbon)
ok = m.Get(sc)
if ok {
@@ -492,7 +499,7 @@ func main() {
}
})
go func() {
conc := func() {
time.Sleep(3 * time.Second)
connectionStatus.SetText("Connecting...")
connectionIcon.SetFromPaintable(clientAssets["hourglass"])
@@ -503,10 +510,13 @@ func main() {
connectionStatus.SetText(fmt.Sprintf("Disconnected: %s", err.Error()))
connectionIcon.SetFromPaintable(clientAssets["disconnect"])
}
}()
}
app := gtk.NewApplication("net.sunglocto.lambda", gio.ApplicationFlagsNone)
app.ConnectActivate(func() { activate(app) })
app.ConnectActivate(func() {
go conc()
activate(app)
})
if code := app.Run(os.Args); code > 0 {
os.Exit(code)
@@ -870,8 +880,15 @@ func activate(app *gtk.Application) {
}
if strings.Contains(t, "@everyone") {
start := strings.Index(t, "@everyone")
end := start + len("@everyone")
new_mention := new(Mention)
new_mention.Mentions = "urn:xmpp:mentions:0#channel"
new_mention.Type = "urn:xmpp:mentions:0#channel"
new_mention.Begin = start
new_mention.End = end
exts = append(exts, new_mention)
} else if strings.Contains(t, "@here") {
new_attention := new(Attention)