From 24b72da0cce814efed467b6ee78d4e97c7716ca6 Mon Sep 17 00:00:00 2001 From: erinn Date: Wed, 29 Sep 2021 13:30:10 -0700 Subject: [PATCH] adding CheckDownloadStatus --- lib.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lib.go b/lib.go index c3e2696..f988274 100644 --- a/lib.go +++ b/lib.go @@ -707,6 +707,23 @@ func DownloadFile(profileOnion, handle, filepath, manifestpath, filekey string) } } +//export c_CheckDownloadStatus +func c_CheckDownloadStatus(profilePtr *C.char, profileLen C.int, fileKeyPtr *C.char, fileKeyLen C.int) { + CheckDownloadStatus(C.GoStringN(profilePtr, profileLen), C.GoStringN(fileKeyPtr, fileKeyLen)) +} + +func CheckDownloadStatus(profileOnion, fileKey string) { + profile := application.GetPeer(profileOnion) + if path, exists := profile.GetAttribute(attr.GetLocalScope(fileKey)); exists { + eventHandler.Push(event.NewEvent(event.FileDownloaded, map[event.Field]string{ + ProfileOnion: profileOnion, + event.FileKey: fileKey, + event.FilePath: path, + event.TempFile: "", + })) + } +} + //export c_ResetTor func c_ResetTor() { ResetTor()