Merge branch 'groupimportfix' of cwtch.im/cwtch into master
This commit is contained in:
commit
6ebf8ebc88
|
@ -11,9 +11,7 @@ import (
|
||||||
"git.openprivacy.ca/openprivacy/libricochet-go/connectivity"
|
"git.openprivacy.ca/openprivacy/libricochet-go/connectivity"
|
||||||
"git.openprivacy.ca/openprivacy/libricochet-go/identity"
|
"git.openprivacy.ca/openprivacy/libricochet-go/identity"
|
||||||
"git.openprivacy.ca/openprivacy/libricochet-go/log"
|
"git.openprivacy.ca/openprivacy/libricochet-go/log"
|
||||||
"git.openprivacy.ca/openprivacy/libricochet-go/utils"
|
|
||||||
"github.com/golang/protobuf/proto"
|
"github.com/golang/protobuf/proto"
|
||||||
"golang.org/x/crypto/ed25519"
|
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
@ -114,12 +112,6 @@ func (cp *cwtchPeer) ImportGroup(exportedInvite string) (groupID string, err err
|
||||||
cpp := &protocol.CwtchPeerPacket{}
|
cpp := &protocol.CwtchPeerPacket{}
|
||||||
err = proto.Unmarshal(data, cpp)
|
err = proto.Unmarshal(data, cpp)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
pk, err := base64.StdEncoding.DecodeString(exportedInvite[5 : 5+44])
|
|
||||||
if err == nil {
|
|
||||||
edpk := ed25519.PublicKey(pk)
|
|
||||||
onion := utils.GetTorV3Hostname(edpk)
|
|
||||||
cp.Profile.AddContact(onion, &model.PublicProfile{Name: "", Ed25519PublicKey: edpk, Trusted: true, Blocked: false, Onion: onion})
|
|
||||||
cp.Profile.ProcessInvite(cpp.GetGroupChatInvite(), onion)
|
|
||||||
jsobj, err := json.Marshal(cpp.GetGroupChatInvite())
|
jsobj, err := json.Marshal(cpp.GetGroupChatInvite())
|
||||||
if err == nil {
|
if err == nil {
|
||||||
cp.eventBus.Publish(event.NewEvent(event.NewGroupInvite, map[event.Field]string{
|
cp.eventBus.Publish(event.NewEvent(event.NewGroupInvite, map[event.Field]string{
|
||||||
|
@ -131,7 +123,6 @@ func (cp *cwtchPeer) ImportGroup(exportedInvite string) (groupID string, err err
|
||||||
return cpp.GroupChatInvite.GetGroupName(), nil
|
return cpp.GroupChatInvite.GetGroupName(), nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
err = errors.New("unsupported exported group type")
|
err = errors.New("unsupported exported group type")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue