diff --git a/functionality/filesharing/filesharing_functionality.go b/functionality/filesharing/filesharing_functionality.go index 59f5192..8666ff8 100644 --- a/functionality/filesharing/filesharing_functionality.go +++ b/functionality/filesharing/filesharing_functionality.go @@ -43,7 +43,7 @@ type OverlayMessage struct { // to downloadFilePath func (f *Functionality) DownloadFile(profile peer.CwtchPeer, handle string, downloadFilePath string, manifestFilePath string, key string) { profile.SetAttribute(attr.GetLocalScope(fmt.Sprintf("%s.manifest", key)), manifestFilePath) - profile.SetAttribute(attr.GetLocalScope(key), downloadFilePath) + profile.SetAttribute(attr.GetLocalScope(fmt.Sprintf("%s.path", key)), downloadFilePath) profile.SendGetValToPeer(handle, attr.PublicScope, fmt.Sprintf("%s.manifest.size", key)) } diff --git a/peer/cwtch_peer.go b/peer/cwtch_peer.go index c6f6e97..ff25100 100644 --- a/peer/cwtch_peer.go +++ b/peer/cwtch_peer.go @@ -27,7 +27,7 @@ var autoHandleableEvents = map[event.Type]bool{event.EncryptedGroupMessage: true event.ServerStateChange: true, event.NewGroupInvite: true, event.NewMessageFromPeer: true, event.PeerAcknowledgement: true, event.PeerError: true, event.SendMessageToPeerError: true, event.SendMessageToGroupError: true, event.NewGetValMessageFromPeer: true, event.NewRetValMessageFromPeer: true, event.ProtocolEngineStopped: true, event.RetryServerRequest: true, - event.ManifestSizeReceived: true, event.ManifestReceived: true} + event.ManifestSizeReceived: true, event.ManifestReceived: true, event.FileDownloaded: true} // DefaultEventsToHandle specifies which events will be subscribed to // when a peer has its Init() function called @@ -875,7 +875,9 @@ func (cp *cwtchPeer) eventHandler() { } else { log.Errorf("no download path found for manifest: %v", fileKey) } - + case event.FileDownloaded: + fileKey := ev.Data[event.FileKey] + cp.SetAttribute(fmt.Sprintf("%s.complete", fileKey), "true") case event.NewRetValMessageFromPeer: onion := ev.Data[event.RemotePeer] scope := ev.Data[event.Scope]