Ring Daemon 16.0.0
Loading...
Searching...
No Matches
jami::TransferManager Class Reference

#include <data_transfer.h>

Inheritance diagram for jami::TransferManager:
Inheritance graph
Collaboration diagram for jami::TransferManager:
Collaboration graph

Classes

class  Impl
 

Public Member Functions

bool cancel (const std::string &fileId)
 Refuse a transfer.
 
bool info (const std::string &fileId, std::string &path, int64_t &total, int64_t &progress) const noexcept
 Get current transfer info.
 
bool isWaiting (const std::string &fileId) const
 
void onIncomingFileTransfer (const std::string &fileId, const std::shared_ptr< dhtnet::ChannelSocket > &channel, size_t start)
 Handle incoming transfer.
 
void onIncomingProfile (const std::shared_ptr< dhtnet::ChannelSocket > &channel, const std::string &sha3Sum="")
 
std::filesystem::path path (const std::string &fileId) const
 Retrieve path of a file.
 
std::filesystem::path profilePath (const std::string &contactId) const
 
void transferFile (const std::shared_ptr< dhtnet::ChannelSocket > &channel, const std::string &fileId, const std::string &interactionId, const std::string &path, size_t start=0, size_t end=0, OnFinishedCb onFinished={})
 Send a file to a channel.
 
 TransferManager (const std::string &accountId, const std::string &accountUri, const std::string &to, const std::mt19937_64 &rand)
 
void waitForTransfer (const std::string &fileId, const std::string &interactionId, const std::string &sha3sum, const std::string &path, std::size_t total)
 Inform the transfer manager that a transfer is waited (and will be automatically accepted)
 
std::vector< WaitingRequestwaitingRequests () const
 Retrieve waiting files.
 
 ~TransferManager ()
 

Detailed Description

Definition at line 117 of file data_transfer.h.

Constructor & Destructor Documentation

◆ TransferManager()

jami::TransferManager::TransferManager ( const std::string &  accountId,
const std::string &  accountUri,
const std::string &  to,
const std::mt19937_64 &  rand 
)

Definition at line 326 of file data_transfer.cpp.

◆ ~TransferManager()

jami::TransferManager::~TransferManager ( )

Definition at line 333 of file data_transfer.cpp.

Member Function Documentation

◆ cancel()

bool jami::TransferManager::cancel ( const std::string &  fileId)

Refuse a transfer.

Parameters
idof the transfer

Definition at line 375 of file data_transfer.cpp.

References JAMI_DBG.

◆ info()

bool jami::TransferManager::info ( const std::string &  fileId,
std::string &  path,
int64_t total,
int64_t progress 
) const
noexcept

Get current transfer info.

Parameters
idof the transfer
totalsize
pathpath of the file
progresscurrent progress
Returns
if found

Definition at line 393 of file data_transfer.cpp.

Referenced by transferFile().

◆ isWaiting()

bool jami::TransferManager::isWaiting ( const std::string &  fileId) const

Definition at line 633 of file data_transfer.cpp.

◆ onIncomingFileTransfer()

void jami::TransferManager::onIncomingFileTransfer ( const std::string &  fileId,
const std::shared_ptr< dhtnet::ChannelSocket > &  channel,
size_t  start 
)

Handle incoming transfer.

Parameters
idRelated id
channelRelated channel
startOffset in the file from which the transfer will start.

Definition at line 446 of file data_transfer.cpp.

◆ onIncomingProfile()

void jami::TransferManager::onIncomingProfile ( const std::shared_ptr< dhtnet::ChannelSocket > &  channel,
const std::string &  sha3Sum = "" 
)

Definition at line 521 of file data_transfer.cpp.

References jami::generateUID().

Here is the call graph for this function:

◆ path()

std::filesystem::path jami::TransferManager::path ( const std::string &  fileId) const

Retrieve path of a file.

Parameters
id

Definition at line 515 of file data_transfer.cpp.

Referenced by transferFile().

◆ profilePath()

std::filesystem::path jami::TransferManager::profilePath ( const std::string &  contactId) const
Parameters
contactIdcontact's id
Returns
where profile.vcf is stored

Definition at line 614 of file data_transfer.cpp.

◆ transferFile()

void jami::TransferManager::transferFile ( const std::shared_ptr< dhtnet::ChannelSocket > &  channel,
const std::string &  fileId,
const std::string &  interactionId,
const std::string &  path,
size_t  start = 0,
size_t  end = 0,
OnFinishedCb  onFinished = {} 
)

Send a file to a channel.

Parameters
channelchannel to use
fileIdfileId of the transfer
interactionIdinteractionId of the transfer
pathpath of the file
startstart offset
endend

Definition at line 336 of file data_transfer.cpp.

References libjami::DataTransferInfo::accountId, jami::emitSignal(), info(), and path().

Here is the call graph for this function:

◆ waitForTransfer()

void jami::TransferManager::waitForTransfer ( const std::string &  fileId,
const std::string &  interactionId,
const std::string &  sha3sum,
const std::string &  path,
std::size_t  total 
)

Inform the transfer manager that a transfer is waited (and will be automatically accepted)

Parameters
idof the transfer
interactionIdlinked interaction
sha3sumattended sha3sum
pathwhere the file will be downloaded
totaltotal size of the file

Definition at line 431 of file data_transfer.cpp.

◆ waitingRequests()

std::vector< WaitingRequest > jami::TransferManager::waitingRequests ( ) const

Retrieve waiting files.

Returns
waiting list

Definition at line 620 of file data_transfer.cpp.


The documentation for this class was generated from the following files: