groupChat

package
v4.6.1 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2023 License: BSD-2-Clause, BSD-2-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Wrapper

type Wrapper struct {
	// contains filtered or unexported fields
}

Wrapper handles the sending and receiving of file transfers for group chats.

func NewWrapper

func NewWrapper(receiveCB ft.ReceiveCallback, ft ft.FileTransfer,
	gc gcManager) (*Wrapper, error)

NewWrapper generates a new file transfer Wrapper for group chat.

func (*Wrapper) CloseSend

func (w *Wrapper) CloseSend(tid *ftCrypto.TransferID) error

CloseSend deletes a file from the internal storage once a transfer has completed or reached the retry limit. Returns an error if the transfer has not run out of retries.

This function should be called once a transfer completes or errors out (as reported by the progress callback).

func (*Wrapper) MaxFileNameLen

func (w *Wrapper) MaxFileNameLen() int

MaxFileNameLen returns the max number of bytes allowed for a file name.

func (*Wrapper) MaxFileSize

func (w *Wrapper) MaxFileSize() int

MaxFileSize returns the max number of bytes allowed for a file.

func (*Wrapper) MaxFileTypeLen

func (w *Wrapper) MaxFileTypeLen() int

MaxFileTypeLen returns the max number of bytes allowed for a file type.

func (*Wrapper) MaxPreviewSize

func (w *Wrapper) MaxPreviewSize() int

MaxPreviewSize returns the max number of bytes allowed for a file preview.

func (*Wrapper) Receive

func (w *Wrapper) Receive(tid *ftCrypto.TransferID) ([]byte, error)

Receive returns the full file on the completion of the transfer. It deletes internal references to the data and unregisters any attached progress callback. Returns an error if the transfer is not complete, the full file cannot be verified, or if the transfer cannot be found.

Receive can only be called once the progress callback returns that the file transfer is complete.

func (*Wrapper) RegisterReceivedProgressCallback

func (w *Wrapper) RegisterReceivedProgressCallback(tid *ftCrypto.TransferID,
	progressCB ft.ReceivedProgressCallback, period time.Duration) error

RegisterReceivedProgressCallback allows for the registration of a callback to track the progress of an individual received file transfer. This must be done when a new transfer is received on the ReceiveCallback.

func (*Wrapper) RegisterSentProgressCallback

func (w *Wrapper) RegisterSentProgressCallback(tid *ftCrypto.TransferID,
	progressCB ft.SentProgressCallback, period time.Duration) error

RegisterSentProgressCallback allows for the registration of a callback to track the progress of an individual sent file transfer.

func (*Wrapper) Send

func (w *Wrapper) Send(groupID *id.ID, fileName, fileType string,
	fileData []byte, retry float32, preview []byte,
	progressCB ft.SentProgressCallback, period time.Duration) (
	*ftCrypto.TransferID, error)

Send initiates the sending of a file to a group and returns a transfer ID that uniquely identifies this file transfer.

Jump to

Keyboard shortcuts

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