forked from cwtch.im/ui
save contacts
This commit is contained in:
parent
ef287938d9
commit
73eb5a6ef5
|
@ -1,8 +1,6 @@
|
||||||
package gothings
|
package gothings
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"cwtch.im/cwtch/event"
|
|
||||||
"cwtch.im/cwtch/model"
|
|
||||||
"cwtch.im/ui/go/constants"
|
"cwtch.im/ui/go/constants"
|
||||||
"cwtch.im/ui/go/gobjects"
|
"cwtch.im/ui/go/gobjects"
|
||||||
"cwtch.im/ui/go/the"
|
"cwtch.im/ui/go/the"
|
||||||
|
@ -39,20 +37,7 @@ func (this *InterfaceState) AddContact(c *gobjects.Contact) {
|
||||||
|
|
||||||
if the.Peer.GetContact(c.Handle) == nil {
|
if the.Peer.GetContact(c.Handle) == nil {
|
||||||
decodedPub, _ := base32.StdEncoding.DecodeString(strings.ToUpper(c.Handle))
|
decodedPub, _ := base32.StdEncoding.DecodeString(strings.ToUpper(c.Handle))
|
||||||
|
the.Peer.AddContact(c.DisplayName, c.Handle, decodedPub, c.Trusted)
|
||||||
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,
|
|
||||||
}))
|
|
||||||
|
|
||||||
go the.Peer.PeerWithOnion(c.Handle)
|
go the.Peer.PeerWithOnion(c.Handle)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
1
main.go
1
main.go
|
@ -165,7 +165,6 @@ func loadCwtchData(gcd *gothings.GrandCentralDispatcher) {
|
||||||
|
|
||||||
groups := the.Peer.GetGroups()
|
groups := the.Peer.GetGroups()
|
||||||
for i := range groups {
|
for i := range groups {
|
||||||
log.Infof("adding saved group %v", groups[i])
|
|
||||||
group := the.Peer.GetGroup(groups[i])
|
group := the.Peer.GetGroup(groups[i])
|
||||||
group.NewMessage = make(chan model.Message)
|
group.NewMessage = make(chan model.Message)
|
||||||
the.Peer.JoinServer(group.GroupServer)
|
the.Peer.JoinServer(group.GroupServer)
|
||||||
|
|
Loading…
Reference in New Issue