diff --git a/lib.go b/lib.go index 437e1f0..c0cf511 100644 --- a/lib.go +++ b/lib.go @@ -713,13 +713,20 @@ func c_CheckDownloadStatus(profilePtr *C.char, profileLen C.int, fileKeyPtr *C.c func CheckDownloadStatus(profileOnion, fileKey string) { profile := application.GetPeer(profileOnion) - if path, exists := profile.GetAttribute(attr.GetLocalScope(fileKey)); exists { + if path, exists := profile.GetAttribute(attr.GetLocalScope(fmt.Sprintf("%s.complete", fileKey))); exists { eventHandler.Push(event.NewEvent(event.FileDownloaded, map[event.Field]string{ ProfileOnion: profileOnion, event.FileKey: fileKey, event.FilePath: path, event.TempFile: "", })) + } else if path, exists = profile.GetAttribute(attr.GetLocalScope(fmt.Sprintf("%s.path", fileKey))); exists { + eventHandler.Push(event.NewEvent(event.FileDownloadProgressUpdate, map[event.Field]string{ + ProfileOnion: profileOnion, + event.FileKey: fileKey, + event.Progress: ??, + event.FileSizeInChunks: ??, + })) } }