NOBODYSETISGONELETSGO
This commit is contained in:
+12
-6
@@ -74,10 +74,10 @@ func generatePresenceWidget(p stanza.Packet) gtk.Widgetter {
|
|||||||
return b
|
return b
|
||||||
}
|
}
|
||||||
|
|
||||||
func generateMessageWidget(p stanza.Packet) gtk.Widgetter {
|
func generateMessageWidget(p stanza.Packet) (gtk.Widgetter, bool) {
|
||||||
m, ok := p.(stanza.Message)
|
m, ok := p.(stanza.Message)
|
||||||
if !ok {
|
if !ok {
|
||||||
return gtk.NewLabel("Unsupported message.")
|
return gtk.NewLabel("Unsupported message."), true
|
||||||
}
|
}
|
||||||
|
|
||||||
readmarker := Marker{}
|
readmarker := Marker{}
|
||||||
@@ -85,7 +85,7 @@ func generateMessageWidget(p stanza.Packet) gtk.Widgetter {
|
|||||||
if ok {
|
if ok {
|
||||||
b := gtk.NewBox(gtk.OrientationHorizontal, 0)
|
b := gtk.NewBox(gtk.OrientationHorizontal, 0)
|
||||||
b.Append(gtk.NewLabel(fmt.Sprintf("%s%s", JidMustParse(m.From).Resource, loadedLocale["readWidget"])))
|
b.Append(gtk.NewLabel(fmt.Sprintf("%s%s", JidMustParse(m.From).Resource, loadedLocale["readWidget"])))
|
||||||
return b
|
return b, true
|
||||||
}
|
}
|
||||||
|
|
||||||
composing := stanza.StateComposing{}
|
composing := stanza.StateComposing{}
|
||||||
@@ -93,7 +93,7 @@ func generateMessageWidget(p stanza.Packet) gtk.Widgetter {
|
|||||||
if ok {
|
if ok {
|
||||||
b := gtk.NewBox(gtk.OrientationHorizontal, 0)
|
b := gtk.NewBox(gtk.OrientationHorizontal, 0)
|
||||||
b.Append(gtk.NewLabel(fmt.Sprintf("%s%s", JidMustParse(m.From).Resource, loadedLocale["isTyping"])))
|
b.Append(gtk.NewLabel(fmt.Sprintf("%s%s", JidMustParse(m.From).Resource, loadedLocale["isTyping"])))
|
||||||
return b
|
return b, true
|
||||||
}
|
}
|
||||||
|
|
||||||
if m.Error.Type != "" {
|
if m.Error.Type != "" {
|
||||||
@@ -104,7 +104,7 @@ func generateMessageWidget(p stanza.Packet) gtk.Widgetter {
|
|||||||
error_box.Append(cancel_img)
|
error_box.Append(cancel_img)
|
||||||
error_box.Append(error_label)
|
error_box.Append(error_label)
|
||||||
error_box.Append(gtk.NewLabel(m.Error.Reason))
|
error_box.Append(gtk.NewLabel(m.Error.Reason))
|
||||||
return error_box
|
return error_box, true
|
||||||
}
|
}
|
||||||
|
|
||||||
sid := StanzaID{}
|
sid := StanzaID{}
|
||||||
@@ -252,8 +252,11 @@ func generateMessageWidget(p stanza.Packet) gtk.Widgetter {
|
|||||||
mlabel := gtk.NewLabel(m.Body)
|
mlabel := gtk.NewLabel(m.Body)
|
||||||
|
|
||||||
if m.Body == "" {
|
if m.Body == "" {
|
||||||
|
/*
|
||||||
mlabel.SetText(loadedLocale["noBodySet"])
|
mlabel.SetText(loadedLocale["noBodySet"])
|
||||||
mlabel.AddCSSClass("visitor")
|
mlabel.AddCSSClass("visitor")
|
||||||
|
*/
|
||||||
|
return nil, false
|
||||||
}
|
}
|
||||||
mlabel.SetWrap(true)
|
mlabel.SetWrap(true)
|
||||||
mlabel.SetSelectable(true)
|
mlabel.SetSelectable(true)
|
||||||
@@ -329,8 +332,11 @@ func generateMessageWidget(p stanza.Packet) gtk.Widgetter {
|
|||||||
|
|
||||||
mlabel := gtk.NewLabel(m.Body)
|
mlabel := gtk.NewLabel(m.Body)
|
||||||
if m.Body == "" {
|
if m.Body == "" {
|
||||||
|
/*
|
||||||
mlabel.SetText(loadedLocale["noBodySet"])
|
mlabel.SetText(loadedLocale["noBodySet"])
|
||||||
mlabel.AddCSSClass("visitor")
|
mlabel.AddCSSClass("visitor")
|
||||||
|
*/
|
||||||
|
return nil, false
|
||||||
}
|
}
|
||||||
mlabel.SetWrap(true)
|
mlabel.SetWrap(true)
|
||||||
mlabel.SetSelectable(true)
|
mlabel.SetSelectable(true)
|
||||||
@@ -398,7 +404,7 @@ func generateMessageWidget(p stanza.Packet) gtk.Widgetter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return mainBox
|
return mainBox, true
|
||||||
}
|
}
|
||||||
|
|
||||||
func getVAdjustment(scrolledWindow *gtk.ScrolledWindow) *gtk.Adjustment {
|
func getVAdjustment(scrolledWindow *gtk.ScrolledWindow) *gtk.Adjustment {
|
||||||
|
|||||||
@@ -293,7 +293,6 @@ func main() {
|
|||||||
typed_tab := tab.(*chatTab)
|
typed_tab := tab.(*chatTab)
|
||||||
|
|
||||||
if ok {
|
if ok {
|
||||||
typed_tab.msgs.Append(b)
|
|
||||||
if current == JidMustParse(m.From).Bare() {
|
if current == JidMustParse(m.From).Bare() {
|
||||||
scrollToBottomAfterUpdate(scroller)
|
scrollToBottomAfterUpdate(scroller)
|
||||||
}
|
}
|
||||||
@@ -301,10 +300,13 @@ func main() {
|
|||||||
fmt.Println("Got message when the tab does not exist!")
|
fmt.Println("Got message when the tab does not exist!")
|
||||||
}
|
}
|
||||||
|
|
||||||
ba, ok := generateMessageWidget(p).(*gtk.Box)
|
untyped_box, valid := generateMessageWidget(p)
|
||||||
if ok {
|
ba, converted_successfully := untyped_box.(*gtk.Box)
|
||||||
|
|
||||||
|
if valid && converted_successfully {
|
||||||
|
typed_tab.msgs.Append(b)
|
||||||
b.Append(ba)
|
b.Append(ba)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user