Merge pull request 'create new conversation on unknown accept' (#419) from newContact into master
continuous-integration/drone/tag Build is passing Details
continuous-integration/drone/push Build is passing Details

Reviewed-on: #419
This commit is contained in:
Sarah Jamie Lewis 2021-12-19 20:32:44 +00:00
commit 069c754595
1 changed files with 9 additions and 2 deletions

View File

@ -333,7 +333,7 @@ func ImportLegacyProfile(profile *model.Profile, cps *CwtchProfileStorage) Cwtch
zone, path := attr.ParseZone(parts[1])
cp.SetScopedZonedAttribute(scope, zone, path, v)
} else {
log.Errorf("could not import legacy style attribute %v", k)
log.Debugf("could not import legacy style attribute %v", k)
}
}
@ -364,7 +364,7 @@ func ImportLegacyProfile(profile *model.Profile, cps *CwtchProfileStorage) Cwtch
case lastKnownSignature:
cp.SetConversationAttribute(conversationID, attr.LocalScope.ConstructScopedZonedPath(attr.ProfileZone.ConstructZonedPath(lastReceivedSignature)), value)
default:
log.Errorf("could not import conversation attribute %v", key)
log.Debugf("could not import conversation attribute %v", key)
}
}
@ -1169,6 +1169,13 @@ func (cp *cwtchPeer) eventHandler() {
}
}
case event.PeerStateChange:
handle := ev.Data[event.RemotePeer]
if connections.ConnectionStateToType()[ev.Data[event.ConnectionState]] == connections.AUTHENTICATED {
_, err := cp.FetchConversationInfo(handle)
if err != nil {
cp.NewContactConversation(handle, model.DefaultP2PAccessControl(), false)
}
}
cp.mutex.Lock()
cp.state[ev.Data[event.RemotePeer]] = connections.ConnectionStateToType()[ev.Data[event.ConnectionState]]
cp.mutex.Unlock()