|
QXmpp Version: 1.12.0
|


Public Types | |
| using | MetadataGenerator = std::function< QFuture< std::shared_ptr< MetadataGeneratorResult > >(std::unique_ptr< QIODevice >)> |
Public Member Functions | |
| void | setMetadataGenerator (MetadataGenerator &&generator) |
| Register a function that is called when metadata needs to be gererated for a file. | |
| template<typename ProviderType > | |
| void | registerProvider (std::shared_ptr< ProviderType > manager) |
| Register a provider for automatic downloads. | |
| std::shared_ptr< QXmppFileUpload > | uploadFile (std::shared_ptr< QXmppFileSharingProvider > provider, const QString &filePath, const std::optional< QString > &description={}) |
| Upload a file in a way that it can be attached to a message. | |
| std::shared_ptr< QXmppFileDownload > | downloadFile (const QXmppFileShare &fileShare, std::unique_ptr< QIODevice > output) |
| Download a file from a QXmppFileShare. | |
Public Member Functions inherited from QXmppClientExtension | |
| QXmppClientExtension () | |
| virtual QStringList | discoveryFeatures () const |
| virtual QList< QXmppDiscoIdentity > | discoveryIdentities () const |
| virtual bool | handleStanza (const QDomElement &stanza) |
| You need to implement this method to process incoming XMPP stanzas. | |
| virtual bool | handleStanza (const QDomElement &stanza, const std::optional< QXmppE2eeMetadata > &e2eeMetadata) |
| You need to implement this method to process incoming XMPP stanzas. | |
Public Member Functions inherited from QXmppLoggable | |
| QXmppLoggable (QObject *parent=nullptr) | |
Friends | |
| class | QXmppEncryptedFileSharingProvider |
Additional Inherited Members | |
Signals inherited from QXmppLoggable | |
| void | setGauge (const QString &gauge, double value) |
| Sets the given gauge to value. | |
| void | logMessage (QXmppLogger::MessageType type, const QString &msg) |
| This signal is emitted to send logging messages. | |
| void | updateCounter (const QString &counter, qint64 amount=1) |
| Updates the given counter by amount. | |
Protected Member Functions inherited from QXmppClientExtension | |
| QXmppClient * | client () const |
| virtual void | setClient (QXmppClient *client) |
| virtual void | onRegistered (QXmppClient *client) |
| virtual void | onUnregistered (QXmppClient *client) |
| void | injectIq (const QDomElement &element, const std::optional< QXmppE2eeMetadata > &e2eeMetadata) |
| bool | injectMessage (QXmppMessage &&message) |
Protected Member Functions inherited from QXmppLoggable | |
| void | debug (const QString &message) |
| void | info (const QString &message) |
| void | warning (const QString &message) |
| void | logReceived (const QString &message) |
| void | logSent (const QString &message) |
The file sharing manager allows to easily send and retrieve files in a chat.
The function signature of a metadata generator function
| std::shared_ptr< QXmppFileDownload > QXmppFileSharingManager::downloadFile | ( | const QXmppFileShare & | fileShare, |
| std::unique_ptr< QIODevice > | output | ||
| ) |
Download a file from a QXmppFileShare.
Make sure to register the provider that handles the sources used in this file share before calling this function.
| fileShare | The file share object which you want to download |
| output | An open QIODevice that the data should be written into. In most cases, a QFile |
|
inline |
Register a provider for automatic downloads.
| manager | A shared_ptr to a QXmppFileSharingProvider subclass The provider must define SourceType to the type of the accepted file source. |
| void QXmppFileSharingManager::setMetadataGenerator | ( | MetadataGenerator && | generator | ) |
Register a function that is called when metadata needs to be gererated for a file.
The function is passed a QIODevice, so if you need the path of the file on disk, you can dynamically cast it to a QFile and access the fileName. When doing that, make sure to check the result, as in the future this function might be passed other QIODevices than QFile.
| std::shared_ptr< QXmppFileUpload > QXmppFileSharingManager::uploadFile | ( | std::shared_ptr< QXmppFileSharingProvider > | provider, |
| const QString & | filePath, | ||
| const std::optional< QString > & | description = {} |
||
| ) |
Upload a file in a way that it can be attached to a message.
| provider | The provider class decides how the file is uploaded |
| filePath | Path to a file that should be uploaded |
| description | Optional description of the file |