Merge branch 'bugfix' of erinn/bounce into master
This commit is contained in:
commit
45da4d33cb
|
@ -1,9 +1,9 @@
|
|||
package characters
|
||||
|
||||
import (
|
||||
"cwtch.im/cwtch/model"
|
||||
"bounce/go/the"
|
||||
"bounce/go/gobjects"
|
||||
"bounce/go/the"
|
||||
"cwtch.im/cwtch/model"
|
||||
)
|
||||
|
||||
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 {
|
||||
name = "me"
|
||||
} else {
|
||||
var exists bool // lol this is a golang antifeature
|
||||
name, exists = the.Peer.GetContact(m.PeerID).GetAttribute("name")
|
||||
if !exists {
|
||||
name = ""
|
||||
contact := the.Peer.GetContact(m.PeerID)
|
||||
if contact != nil {
|
||||
name, _ = contact.GetAttribute("name")
|
||||
} else {
|
||||
name = m.PeerID[:16] + "..."
|
||||
}
|
||||
}
|
||||
|
||||
if name == "" {
|
||||
name = m.PeerID[:16] + "..."
|
||||
}
|
||||
|
||||
callback(&gobjects.Message{
|
||||
groupID,
|
||||
m.PeerID,
|
||||
|
@ -36,4 +33,4 @@ func CwtchListener(callback func(message *gobjects.Message), groupID string, cha
|
|||
m.Timestamp,
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Reference in New Issue