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()