Merge branch 'ebf201902111339' of cwtch.im/cwtch into master

This commit is contained in:
Sarah Jamie Lewis 2019-02-11 21:53:54 +00:00 committed by Gogs
commit 1620621d89
3 changed files with 10 additions and 3 deletions

View File

@ -16,6 +16,12 @@ const (
ProtocolEngineStopped = Type("ProtocolEngineStopped") ProtocolEngineStopped = Type("ProtocolEngineStopped")
InvitePeerToGroup = Type("InvitePeerToGroup") InvitePeerToGroup = Type("InvitePeerToGroup")
// a group invite has been received from a remote peer
// attributes:
// TimestampReceived [eg time.Now().Format(time.RFC3339Nano)]
// RemotePeer: [eg "chpr7qm6op5vfcg2pi4vllco3h6aa7exexc4rqwnlupqhoogx2zgd6qd"]
// GroupInvite: [eg "torv3....."]
NewGroupInvite = Type("NewGroupInvite") NewGroupInvite = Type("NewGroupInvite")
SendMessageToGroup = Type("SendMessagetoGroup") SendMessageToGroup = Type("SendMessagetoGroup")

View File

@ -49,7 +49,9 @@ func generateRandomID() string {
} }
func (p *PublicProfile) init() { func (p *PublicProfile) init() {
p.Attributes = make(map[string]string) if p.Attributes == nil {
p.Attributes = make(map[string]string)
}
p.LocalID = generateRandomID() p.LocalID = generateRandomID()
} }

View File

@ -184,8 +184,7 @@ func (cp *cwtchPeer) GetGroup(groupID string) *model.Group {
} }
func (cp *cwtchPeer) AddContact(nick, onion string, publickey []byte, trusted bool) { func (cp *cwtchPeer) AddContact(nick, onion string, publickey []byte, trusted bool) {
pp := &model.PublicProfile{Name: nick, Ed25519PublicKey: publickey, Trusted: trusted, Blocked: false, Onion: onion, Attributes: map[string]string{"name": nick}} pp := &model.PublicProfile{Name: nick, Ed25519PublicKey: publickey, Trusted: trusted, Blocked: false, Onion: onion, Attributes: map[string]string{"nick": nick}}
cp.GetProfile().Contacts[onion] = pp
cp.Profile.AddContact(onion, pp) cp.Profile.AddContact(onion, pp)
pd, _ := json.Marshal(pp) pd, _ := json.Marshal(pp)
cp.eventBus.Publish(event.NewEvent(event.PeerCreated, map[event.Field]string{ cp.eventBus.Publish(event.NewEvent(event.PeerCreated, map[event.Field]string{