forked from cwtch.im/ui
Merge branch 'bugfix' of erinn/bounce into master
This commit is contained in:
commit
45da4d33cb
|
@ -1,9 +1,9 @@
|
||||||
package characters
|
package characters
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"cwtch.im/cwtch/model"
|
|
||||||
"bounce/go/the"
|
|
||||||
"bounce/go/gobjects"
|
"bounce/go/gobjects"
|
||||||
|
"bounce/go/the"
|
||||||
|
"cwtch.im/cwtch/model"
|
||||||
)
|
)
|
||||||
|
|
||||||
func CwtchListener(callback func(message *gobjects.Message), groupID string, channel chan model.Message) {
|
func CwtchListener(callback func(message *gobjects.Message), groupID string, channel chan model.Message) {
|
||||||
|
@ -14,17 +14,14 @@ func CwtchListener(callback func(message *gobjects.Message), groupID string, cha
|
||||||
if name == the.Peer.GetProfile().Onion {
|
if name == the.Peer.GetProfile().Onion {
|
||||||
name = "me"
|
name = "me"
|
||||||
} else {
|
} else {
|
||||||
var exists bool // lol this is a golang antifeature
|
contact := the.Peer.GetContact(m.PeerID)
|
||||||
name, exists = the.Peer.GetContact(m.PeerID).GetAttribute("name")
|
if contact != nil {
|
||||||
if !exists {
|
name, _ = contact.GetAttribute("name")
|
||||||
name = ""
|
} else {
|
||||||
|
name = m.PeerID[:16] + "..."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if name == "" {
|
|
||||||
name = m.PeerID[:16] + "..."
|
|
||||||
}
|
|
||||||
|
|
||||||
callback(&gobjects.Message{
|
callback(&gobjects.Message{
|
||||||
groupID,
|
groupID,
|
||||||
m.PeerID,
|
m.PeerID,
|
||||||
|
|
Loading…
Reference in New Issue