rotund
This commit is contained in:
+24
-9
@@ -74,7 +74,7 @@ func generatePresenceWidget(p stanza.Packet) gtk.Widgetter {
|
||||
return b
|
||||
}
|
||||
|
||||
func generateMessageWidget(p stanza.Packet, blocked bool) (gtk.Widgetter, bool) {
|
||||
func generateMessageWidget(p stanza.Packet, blocked bool, target string) (gtk.Widgetter, bool) {
|
||||
m, ok := p.(stanza.Message)
|
||||
if !ok {
|
||||
return gtk.NewLabel("Unsupported message."), true
|
||||
@@ -107,6 +107,13 @@ func generateMessageWidget(p stanza.Packet, blocked bool) (gtk.Widgetter, bool)
|
||||
return error_box, true
|
||||
}
|
||||
|
||||
store_label := false
|
||||
tab, ok := tabs.Load(target)
|
||||
if ok {
|
||||
store_label = true
|
||||
}
|
||||
typed_tab := tab.(*chatTab)
|
||||
|
||||
sid := StanzaID{}
|
||||
m.Get(&sid)
|
||||
|
||||
@@ -257,7 +264,7 @@ func generateMessageWidget(p stanza.Packet, blocked bool) (gtk.Widgetter, bool)
|
||||
mainBox.Append(al)
|
||||
|
||||
body := m.Body
|
||||
body = XEPToPango(body)
|
||||
body = XEPToPango(body, false)
|
||||
|
||||
mlabel := gtk.NewLabel("")
|
||||
mlabel.SetMarkup(body)
|
||||
@@ -266,6 +273,11 @@ func generateMessageWidget(p stanza.Packet, blocked bool) (gtk.Widgetter, bool)
|
||||
mlabel.SetSelectable(true)
|
||||
// mlabel.SetHAlign(gtk.AlignFill)
|
||||
mainBox.Append(mlabel)
|
||||
|
||||
if store_label {
|
||||
typed_tab.msg_refsID[m.Id].label_ref = mlabel
|
||||
tabs.Store(target, tab)
|
||||
}
|
||||
} else {
|
||||
authorBox := gtk.NewBox(gtk.OrientationHorizontal, 10)
|
||||
contentBox := gtk.NewBox(gtk.OrientationHorizontal, 0)
|
||||
@@ -332,7 +344,7 @@ func generateMessageWidget(p stanza.Packet, blocked bool) (gtk.Widgetter, bool)
|
||||
}
|
||||
|
||||
body := m.Body
|
||||
body = XEPToPango(body)
|
||||
body = XEPToPango(body, false)
|
||||
|
||||
mlabel := gtk.NewLabel("")
|
||||
if m.Body == "" {
|
||||
@@ -348,14 +360,17 @@ func generateMessageWidget(p stanza.Packet, blocked bool) (gtk.Widgetter, bool)
|
||||
mlabel.SetSelectable(true)
|
||||
mlabel.SetHAlign(gtk.AlignFill)
|
||||
|
||||
/*
|
||||
mum := MucUser{}
|
||||
ok = m.Get(&mum)
|
||||
if ok {
|
||||
mlabel.SetText(fmt.Sprintf("%s%s%s", mum.MucUserItem.JID, loadedLocale["affilChange"], mum.MucUserItem.Affiliation))
|
||||
if store_label {
|
||||
msg, ok := typed_tab.msg_refsID[m.Id]
|
||||
if !ok {
|
||||
msg = new(abMessage)
|
||||
typed_tab.msg_refsID[m.Id] = msg
|
||||
}
|
||||
*/
|
||||
|
||||
msg.label_ref = mlabel
|
||||
msg.ocu_id = ocu.ID
|
||||
tabs.Store(target, typed_tab)
|
||||
}
|
||||
contentBox.Append(mlabel)
|
||||
|
||||
mainBox.Append(authorBox)
|
||||
|
||||
Reference in New Issue
Block a user