file resumption support #42

Merged
sarah merged 5 commits from filey into trunk 2021-11-04 22:42:03 +00:00
1 changed files with 8 additions and 1 deletions
Showing only changes of commit 777d564ca4 - Show all commits

9
lib.go
View File

@ -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: ??,
}))
}
}