Skip to content

Commit

Permalink
Allow modifying jingle-ft's acceptFile
Browse files Browse the repository at this point in the history
  • Loading branch information
Ri0n committed Apr 22, 2024
1 parent 1f22b3e commit e00460f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/xmpp/xmpp-im/jingle-ft.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ namespace XMPP { namespace Jingle { namespace FileTransfer {

inline std::size_t getBlockSize()
{
auto sz = qint64(connection->blockSize());
auto sz = connection->blockSize();
return sz ? sz : 8192;
}

Expand Down Expand Up @@ -322,7 +322,7 @@ namespace XMPP { namespace Jingle { namespace FileTransfer {

void readNextBlockFromTransport()
{
qint64 bytesAvail;
quint64 bytesAvail;
while ((!bytesLeft || *bytesLeft > 0)
&& ((bytesAvail = connection->bytesAvailable()) || (connection->hasPendingDatagrams()))) {
QByteArray data;
Expand Down Expand Up @@ -390,7 +390,7 @@ namespace XMPP { namespace Jingle { namespace FileTransfer {
hasher->addData(QByteArray::fromRawData(buf, size));
}
if (bytesLeft) {
*bytesLeft -= size;
*bytesLeft -= quint64(size);
}
if (bytesLeft && *bytesLeft == 0) {
tryFinalizeIncoming();
Expand Down Expand Up @@ -612,6 +612,8 @@ namespace XMPP { namespace Jingle { namespace FileTransfer {

File Application::acceptFile() const { return d->acceptFile; }

void Application::setAcceptFile(const File &file) const { d->acceptFile = file; }

bool Application::isTransportReplaceEnabled() const { return _state < State::Active; }

void Application::prepareTransport()
Expand Down
1 change: 1 addition & 0 deletions src/xmpp/xmpp-im/jingle-ft.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ namespace XMPP { namespace Jingle { namespace FileTransfer {
void setFile(const QFileInfo &fi, const QString &description, const Thumbnail &thumb);
File file() const;
File acceptFile() const; // either local or remote File as an answer to the offer
void setAcceptFile(const File &file) const;

/**
* @brief setStreamingMode enables external download control.
Expand Down

0 comments on commit e00460f

Please sign in to comment.