filesharing

package
v0.16.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 5, 2022 License: MIT Imports: 19 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateDownloadPath added in v0.14.6

func GenerateDownloadPath(basePath, fileName string, overwrite bool) (filePath, manifestPath string)

GenerateDownloadPath creates a file path that doesn't currently exist on the filesystem

Types

type Functionality

type Functionality struct {
}

Functionality groups some common UI triggered functions for contacts...

func FunctionalityGate

func FunctionalityGate(experimentMap map[string]bool) (*Functionality, error)

FunctionalityGate returns filesharing if enabled in the given experiment map Note: Experiment maps are currently in libcwtch-go

func PreviewFunctionalityGate added in v0.14.6

func PreviewFunctionalityGate(experimentMap map[string]bool) (*Functionality, error)

PreviewFunctionalityGate returns filesharing if image previews are enabled

func (*Functionality) DownloadFile

func (f *Functionality) DownloadFile(profile peer.CwtchPeer, conversationID int, downloadFilePath string, manifestFilePath string, key string, limit uint64)

DownloadFile given a profile, a conversation handle and a file sharing key, start off a download process to downloadFilePath

func (*Functionality) ShareFile

func (f *Functionality) ShareFile(filepath string, profile peer.CwtchPeer) (string, string, error)

ShareFile given a profile and a conversation handle, sets up a file sharing process to share the file at filepath

type OverlayMessage

type OverlayMessage struct {
	Name  string `json:"f"`
	Hash  string `json:"h"`
	Nonce string `json:"n"`
	Size  uint64 `json:"s"`
}

OverlayMessage presents the canonical format of the File Sharing functionality Overlay Message This is the format that the UI will parse to display the message

func (*OverlayMessage) FileKey added in v0.14.6

func (om *OverlayMessage) FileKey() string

FileKey is the unique reference to a file offer

func (*OverlayMessage) ShouldAutoDL added in v0.14.6

func (om *OverlayMessage) ShouldAutoDL() bool

ShouldAutoDL checks file size and file name. *DOES NOT* check user settings or contact state

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL