this commit was sponsored by mizkif

This commit is contained in:
2026-07-14 16:25:18 +01:00
parent 7c19abb6ae
commit ede81d551c
6 changed files with 84 additions and 11 deletions
+50 -9
View File
@@ -362,9 +362,9 @@ func main() {
}
tab, ok := tabs.Load(muc)
typed_tab := tab.(*chatTab)
typed_tab, ok2 := tab.(*chatTab)
if ok {
if ok && ok2 {
typed_tab.msgs.Append(b)
if current == muc {
scrollToBottomAfterUpdate(scroller)
@@ -1171,6 +1171,7 @@ func activate(app *gtk.Application) {
i := gtk.NewPictureForPaintable(gdk.NewTextureForPixbuf(loader.Pixbuf()))
win := gtk.NewWindow()
win.SetDefaultSize(600, 400)
win.SetResizable(false)
win.SetTitle(loadedLocale["pingGraphTitle"])
box := gtk.NewBox(gtk.OrientationVertical, 0)
box.Append(i)
@@ -1236,13 +1237,6 @@ func activate(app *gtk.Application) {
sendtxt := func() {
t := message_en.Text()
if t == "" {
dialog := &gtk.AlertDialog{}
dialog.SetDetail("detail")
dialog.SetMessage("message")
dialog.SetButtons([]string{"yes, no"})
dialog.Choose(context.TODO(), &window.Window, nil)
}
message_type := stanza.MessageTypeChat
tab, ok := tabs.Load(current)
@@ -1253,6 +1247,51 @@ func activate(app *gtk.Application) {
typed_tab := tab.(*chatTab)
if typed_tab.isMuc {
message_type = stanza.MessageTypeGroupchat
// First check if the user is a visitor
mu, ok := mucmembers.Load(current)
if ok {
typed_mu := mu.(mucUnit)
typed_mu.Members.Range(func(k, v any) bool {
user, ok := v.(stanza.Presence)
if ok {
var mui MucUser
ok = user.Get(&mui)
if ok && mui.MucUserItem.JID != "" {
if JidMustParse(mui.MucUserItem.JID).Bare() == JidMustParse(clientroot.Session.BindJid).Bare() {
if mui.MucUserItem.Role == "visitor" {
win := gtk.NewWindow()
win.SetDefaultSize(1,1)
box := gtk.NewBox(gtk.OrientationVertical, 5)
txt := gtk.NewLabel("You are a visitor and do not have voice.\nWould you like to request voice from the moderators of this MUC?")
btn := gtk.NewButtonWithLabel("Request voice")
btn.ConnectClicked(func (){
sendVoiceRequest(client, current)
win.SetVisible(false)
})
dismiss := gtk.NewButtonWithLabel("Dismiss")
dismiss.ConnectClicked(func() {
win.SetVisible(false)
})
box.Append(txt)
box.Append(btn)
box.Append(dismiss)
win.SetChild(box)
win.SetResizable(false)
win.SetVisible(true)
}
return false
}
}
}
return true
})
}
}
exts := []stanza.MsgExtension{}
@@ -1278,6 +1317,8 @@ func activate(app *gtk.Application) {
exts = append(exts, new_attention)
}
err := sendMessage(client, current, message_type, t, "", "", exts)
if err != nil {
showErrorDialog(err, &window.Window)