add more support for other message types
This commit is contained in:
BIN
assets/cancel.png
Normal file
BIN
assets/cancel.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 607 B |
@@ -196,8 +196,11 @@ func switchToTab(jid string, w *gtk.Window) {
|
||||
win.Present()
|
||||
})
|
||||
userbox.AddController(gesture)
|
||||
|
||||
if mu.MucUserItem.Role == "moderator" {
|
||||
gen.Prepend(userbox)
|
||||
} else {
|
||||
gen.Append(userbox)
|
||||
}
|
||||
return true
|
||||
})
|
||||
|
||||
|
||||
@@ -49,7 +49,27 @@ func generateMessageWidget(p stanza.Packet) gtk.Widgetter {
|
||||
readmarker := Marker{}
|
||||
ok = m.Get(&readmarker)
|
||||
if ok {
|
||||
return gtk.NewLabel(fmt.Sprintf("%s has read to this point", JidMustParse(m.From).Resource))
|
||||
b := gtk.NewBox(gtk.OrientationHorizontal, 0)
|
||||
b.Append(gtk.NewLabel(fmt.Sprintf("%s has read to this point", JidMustParse(m.From).Resource)))
|
||||
return b
|
||||
}
|
||||
|
||||
indicator := stanza.StateComposing{}
|
||||
ok = m.Get(&indicator)
|
||||
if ok { // TODO: Display typing indicator in a stat bar or something similar
|
||||
b := gtk.NewBox(gtk.OrientationHorizontal, 0)
|
||||
b.Append(gtk.NewLabel(fmt.Sprintf("%s is typing...", JidMustParse(m.From).Resource)))
|
||||
return b
|
||||
}
|
||||
|
||||
if m.Error.Type != "" {
|
||||
error_box := gtk.NewBox(gtk.OrientationHorizontal, 0)
|
||||
cancel_img := gtk.NewImageFromPaintable(clientAssets["cancel"])
|
||||
error_label := gtk.NewLabel(m.Error.Text)
|
||||
|
||||
error_box.Append(cancel_img)
|
||||
error_box.Append(error_label)
|
||||
return error_box
|
||||
}
|
||||
|
||||
|
||||
|
||||
12
main.go
12
main.go
@@ -81,6 +81,9 @@ var noneMedalB64 string = base64.StdEncoding.EncodeToString(noneMedalBytes)
|
||||
var outcastMedalBytes []byte
|
||||
var outcastMedalB64 string = base64.StdEncoding.EncodeToString(outcastMedalBytes)
|
||||
|
||||
//go:embed assets/cancel.png
|
||||
var cancelBytes []byte
|
||||
var cancelB64 string = base64.StdEncoding.EncodeToString(cancelBytes)
|
||||
|
||||
var clientAssets map[string]gdk.Paintabler = make(map[string]gdk.Paintabler)
|
||||
|
||||
@@ -113,6 +116,14 @@ func init() {
|
||||
|
||||
loader = gdkpixbuf.NewPixbufLoader()
|
||||
|
||||
cancelData, _ := base64.StdEncoding.DecodeString(cancelB64)
|
||||
loader.Write(cancelData)
|
||||
loader.Close()
|
||||
|
||||
clientAssets["cancel"] = gdk.NewTextureForPixbuf(loader.Pixbuf())
|
||||
|
||||
loader = gdkpixbuf.NewPixbufLoader()
|
||||
|
||||
adminMedalData, _ := base64.StdEncoding.DecodeString(adminMedalB64)
|
||||
loader.Write(adminMedalData)
|
||||
loader.Close()
|
||||
@@ -364,6 +375,7 @@ func main() {
|
||||
|
||||
userdevices.Store(user, typed_unit)
|
||||
}
|
||||
time.Sleep(1 * time.Second)
|
||||
})
|
||||
|
||||
c, err := xmpp.NewClient(&config, router, func(err error) {
|
||||
|
||||
Reference in New Issue
Block a user