QXmppTransferManager Class

The QXmppTransferManager class provides support for sending and receiving files, as defined by XEP-0096: SI File Transfer. More...

Header: #include <QXmppTransferManager.h>
Inherits: QXmppClientExtension

Properties

Public Functions

QXmppTransferManager()
QString proxy() const
bool proxyOnly() const
void setProxy(const QString &proxyJid)
void setProxyOnly(bool proxyOnly)
void setSupportedMethods(QXmppTransferJob::Methods methods)
QXmppTransferJob::Methods supportedMethods() const

Public Slots

QXmppTransferJob *sendFile(const QString &jid, const QString &filePath, const QString &description = QString())
QXmppTransferJob *sendFile(const QString &jid, QIODevice *device, const QXmppTransferFileInfo &fileInfo, const QString &sid = QString())

Signals

void fileReceived(QXmppTransferJob *job)
void jobFinished(QXmppTransferJob *job)
void jobStarted(QXmppTransferJob *job)

Detailed Description

Stream initiation is performed as described in XEP-0095: Stream Initiation and XEP-0096: SI File Transfer. The actual file transfer is then performed using either XEP-0065: SOCKS5 Bytestreams or XEP-0047: In-Band Bytestreams.

To make use of this manager, you need to instantiate it and load it into the QXmppClient instance as follows:

auto *manager = new QXmppTransferManager;
client->addExtension(manager);

Property Documentation

proxy : QString

The JID of the bytestream proxy to use for outgoing transfers

Access functions:

QString proxy() const
void setProxy(const QString &proxyJid)

proxyOnly : bool

Whether the proxy will systematically be used for outgoing SOCKS5 bytestream transfers

Access functions:

bool proxyOnly() const
void setProxyOnly(bool proxyOnly)

supportedMethods : QXmppTransferJob::Methods

The supported stream methods

Access functions:

QXmppTransferJob::Methods supportedMethods() const
void setSupportedMethods(QXmppTransferJob::Methods methods)

Member Function Documentation

QXmppTransferManager::QXmppTransferManager()

Constructs a QXmppTransferManager to handle incoming and outgoing file transfers.

[signal] void QXmppTransferManager::fileReceived(QXmppTransferJob *job)

This signal is emitted when a new file transfer offer is received.

To accept the transfer job, call the job's QXmppTransferJob::accept() method. To refuse the transfer job, call the job's QXmppTransferJob::abort() method.

job.

[signal] void QXmppTransferManager::jobFinished(QXmppTransferJob *job)

This signal is emitted whenever a transfer job is finished.

job.

See also QXmppTransferJob::finished().

[signal] void QXmppTransferManager::jobStarted(QXmppTransferJob *job)

This signal is emitted whenever a transfer job is started.

QString QXmppTransferManager::proxy() const

Returns the JID of the bytestream proxy to use for outgoing transfers.

Note: Getter function for property proxy.

See also setProxy().

bool QXmppTransferManager::proxyOnly() const

Returns whether the proxy will systematically be used for outgoing SOCKS5 bytestream transfers.

Note: Getter function for property proxyOnly.

See also setProxyOnly().

[slot] QXmppTransferJob *QXmppTransferManager::sendFile(const QString &jid, const QString &filePath, const QString &description = QString())

Sends the file at filePath to a remote party.

The remote party will be given the choice to accept or refuse the transfer.

Returns 0 if the jid is not valid or if the file at filePath cannot be read.

Note: The recipient's jid must be a full JID with a resource, for instance "user@host/resource".

description.

Note: This slot is overloaded. To connect to this slot:

// Connect using qOverload:
connect(sender, &SenderClass::signal,
        xmppTransferManager, qOverload(&QXmppTransferManager::sendFile));

// Or using a lambda as wrapper:
connect(sender, &SenderClass::signal,
        xmppTransferManager, [receiver = xmppTransferManager](const QString &jid, const QString &filePath, const QString &description) { receiver->sendFile(jid, filePath, description); });
For more examples and approaches, see connecting to overloaded slots.

[slot] QXmppTransferJob *QXmppTransferManager::sendFile(const QString &jid, QIODevice *device, const QXmppTransferFileInfo &fileInfo, const QString &sid = QString())

Sends the file in device to a remote party.

The remote party will be given the choice to accept or refuse the transfer.

Returns 0 if the jid is not valid.

Note: The recipient's jid must be a full JID with a resource, for instance "user@host/resource".

Note: The ownership of the device should be managed by the caller.

Note: This slot is overloaded. To connect to this slot:

// Connect using qOverload:
connect(sender, &SenderClass::signal,
        xmppTransferManager, qOverload(&QXmppTransferManager::sendFile));

// Or using a lambda as wrapper:
connect(sender, &SenderClass::signal,
        xmppTransferManager, [receiver = xmppTransferManager](const QString &jid, QIODevice *device, const QXmppTransferFileInfo &fileInfo, const QString &sid) { receiver->sendFile(jid, device, fileInfo, sid); });
For more examples and approaches, see connecting to overloaded slots.

void QXmppTransferManager::setProxy(const QString &proxyJid)

Set the JID of the SOCKS5 bytestream proxy to use for outgoing transfers.

If you set a proxy, when you send a file the proxy will be offered to the recipient in addition to your own IP addresses.

proxyJid.

Note: Setter function for property proxy.

See also proxy().

void QXmppTransferManager::setProxyOnly(bool proxyOnly)

Set whether the proxy should systematically be used for outgoing SOCKS5 bytestream transfers.

Note: If you set this to true and do not provide a proxy using setProxy(), your outgoing transfers will fail!

proxyOnly.

Note: Setter function for property proxyOnly.

See also proxyOnly().

void QXmppTransferManager::setSupportedMethods(QXmppTransferJob::Methods methods)

Set the supported stream methods. This allows you to selectively enable or disable stream methods (In-Band or SOCKS5 bytestreams).

The methods argument is a combination of zero or more QXmppTransferJob::Method.

methods.

Note: Setter function for property supportedMethods.

See also supportedMethods().

QXmppTransferJob::Methods QXmppTransferManager::supportedMethods() const

Returns the supported stream methods.

The methods are a combination of zero or more QXmppTransferJob::Method.

Note: Getter function for property supportedMethods.

See also setSupportedMethods().