h
This commit is contained in:
+38
-10
@@ -105,11 +105,9 @@ func generateMessageWidget(p stanza.Packet) gtk.Widgetter {
|
||||
reactions := gtk.NewBox(gtk.OrientationHorizontal, 0)
|
||||
reaction := []string{"👍", "👎", "♥️", "🤣", "💀"}
|
||||
for _, v := range reaction {
|
||||
like := gtk.NewButton()
|
||||
like.SetLabel(v)
|
||||
like := gtk.NewButtonWithLabel(v)
|
||||
like.SetHExpand(true)
|
||||
like.ConnectClicked(func() {
|
||||
fmt.Println("licked") // TODO: Implement proper support for reactions via extension
|
||||
client.SendRaw(fmt.Sprintf(`
|
||||
<message from='%s' to='%s' id='%s' type='%s'>
|
||||
<reactions id='%s' xmlns='urn:xmpp:reactions:0'>
|
||||
@@ -122,6 +120,24 @@ func generateMessageWidget(p stanza.Packet) gtk.Widgetter {
|
||||
}
|
||||
|
||||
rc_box.Append(reactions)
|
||||
custom := gtk.NewEntry()
|
||||
custom.SetPlaceholderText("...")
|
||||
enter_custom := gtk.NewButtonWithLabel("React")
|
||||
enter_custom.SetLabel("React")
|
||||
enter_custom.SetHExpand(true)
|
||||
enter_custom.ConnectClicked(func() {
|
||||
|
||||
client.SendRaw(fmt.Sprintf(`
|
||||
<message from='%s' to='%s' id='%s' type='%s'>
|
||||
<reactions id='%s' xmlns='urn:xmpp:reactions:0'>
|
||||
<reaction>%s</reaction>
|
||||
</reactions>
|
||||
</message>
|
||||
`, m.To, jid.MustParse(m.From).Bare().String(), uuid.New().String(), m.Type, sid.ID, custom.Text()))
|
||||
})
|
||||
rc_box.Append(custom)
|
||||
rc_box.Append(enter_custom)
|
||||
|
||||
|
||||
quote := gtk.NewButtonWithLabel("Quote")
|
||||
quote.ConnectClicked(func() {
|
||||
@@ -149,13 +165,14 @@ func generateMessageWidget(p stanza.Packet) gtk.Widgetter {
|
||||
|
||||
m.Get(&ocu)
|
||||
id := JidMustParse(m.From).Resource
|
||||
name := id
|
||||
custom_nick, ok := loadedConfig.CustomNicks[ocu.ID]
|
||||
if ok {
|
||||
id = custom_nick
|
||||
name = custom_nick
|
||||
}
|
||||
|
||||
if id == "" {
|
||||
id = JidMustParse(m.From).Bare()
|
||||
if name == "" {
|
||||
name = JidMustParse(m.From).Bare()
|
||||
}
|
||||
|
||||
if loadedConfig.CompactMode {
|
||||
@@ -183,16 +200,27 @@ func generateMessageWidget(p stanza.Packet) gtk.Widgetter {
|
||||
authorBox := gtk.NewBox(gtk.OrientationHorizontal, 10)
|
||||
contentBox := gtk.NewBox(gtk.OrientationHorizontal, 0)
|
||||
|
||||
al := gtk.NewLabel(id)
|
||||
al := gtk.NewLabel(name)
|
||||
al.AddCSSClass("author")
|
||||
al.SetSelectable(true)
|
||||
|
||||
if m.Type == stanza.MessageTypeGroupchat {
|
||||
mo, _ := mucmembers.Load(JidMustParse(m.From).Bare())
|
||||
mm := mo.(mucUnit)
|
||||
can_generate := true
|
||||
mo, ok := mucmembers.Load(JidMustParse(m.From).Bare())
|
||||
if !ok {
|
||||
can_generate = false
|
||||
}
|
||||
|
||||
mm, ok := mo.(mucUnit)
|
||||
if !ok {
|
||||
can_generate = false
|
||||
}
|
||||
mmm := mm.Members
|
||||
mmmm, ok := mmm.Load(id)
|
||||
if ok {
|
||||
if !ok {
|
||||
can_generate = false
|
||||
}
|
||||
if can_generate {
|
||||
pres := mmmm.(stanza.Presence)
|
||||
var vu VCardUpdate
|
||||
pres.Get(&vu)
|
||||
|
||||
Reference in New Issue
Block a user