Unknown Peers now Appear in Contact List

This commit is contained in:
Sarah Jamie Lewis 2019-02-14 09:54:15 -08:00
parent 2332d8e437
commit 6cd19e4aa8
2 changed files with 7 additions and 1 deletions

View File

@ -5,7 +5,9 @@ import (
"cwtch.im/ui/go/cwutil"
"cwtch.im/ui/go/gobjects"
"cwtch.im/ui/go/the"
"encoding/base32"
"git.openprivacy.ca/openprivacy/libricochet-go/log"
"strings"
"time"
)
@ -28,6 +30,10 @@ func IncomingListener(callback func(*gobjects.Message)) {
Image: cwutil.RandomProfileImage(e.Data[event.RemotePeer]),
Timestamp: ts,
})
if the.Peer.GetContact(e.Data[event.RemotePeer]) == nil {
decodedPub, _ := base32.StdEncoding.DecodeString(strings.ToUpper(e.Data[event.RemotePeer]))
the.Peer.AddContact(e.Data[event.RemotePeer], e.Data[event.RemotePeer], decodedPub, false)
}
the.Peer.PeerWithOnion(e.Data[event.RemotePeer])
if e.Data[event.Data] != "ack" {
the.Peer.SendMessageToPeer(e.Data[event.RemotePeer], "ack")

View File

@ -31,7 +31,7 @@ ColumnLayout {
}
RowLayout {
visible:!overlay.accepted
visible:!overlay.accepted && (gcd.currentOpenConversation.length == 32)
Text {
text: "Do you want to accept the invitation to " + overlay.name + "?"
}