save contacts

This commit is contained in:
erinn 2019-02-02 17:19:51 -08:00
parent ef287938d9
commit 73eb5a6ef5
2 changed files with 1 additions and 17 deletions

View File

@ -1,8 +1,6 @@
package gothings
import (
"cwtch.im/cwtch/event"
"cwtch.im/cwtch/model"
"cwtch.im/ui/go/constants"
"cwtch.im/ui/go/gobjects"
"cwtch.im/ui/go/the"
@ -39,20 +37,7 @@ func (this *InterfaceState) AddContact(c *gobjects.Contact) {
if the.Peer.GetContact(c.Handle) == nil {
decodedPub, _ := base32.StdEncoding.DecodeString(strings.ToUpper(c.Handle))
pp := &model.PublicProfile{Name: c.DisplayName, Ed25519PublicKey: decodedPub[:32], Trusted: c.Trusted, Blocked: false, Onion: c.Handle, Attributes: make(map[string]string)}
pp.SetAttribute("name", c.DisplayName)
the.Peer.GetProfile().Contacts[c.Handle] = pp
if c.Trusted {
the.Peer.GetProfile().TrustPeer(c.Handle)
}
the.CwtchApp.EventBus().Publish(event.NewEvent(event.SetPeerAttribute, map[event.Field]string{
event.RemotePeer: c.Handle,
event.Key: "name",
event.Data: c.DisplayName,
}))
the.Peer.AddContact(c.DisplayName, c.Handle, decodedPub, c.Trusted)
go the.Peer.PeerWithOnion(c.Handle)
}

View File

@ -165,7 +165,6 @@ func loadCwtchData(gcd *gothings.GrandCentralDispatcher) {
groups := the.Peer.GetGroups()
for i := range groups {
log.Infof("adding saved group %v", groups[i])
group := the.Peer.GetGroup(groups[i])
group.NewMessage = make(chan model.Message)
the.Peer.JoinServer(group.GroupServer)